You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2006/02/20 04:58:21 UTC
svn commit: r379013 [16/45] - in /directory/trunks/apacheds: ./ core-plugin/
core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/
core-plugin/src/test/java/org/apache/directory/server/core/tools/schema/
core-shared/ core-shared/src/...
Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/IndexDialog.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/IndexDialog.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/IndexDialog.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/IndexDialog.java Sun Feb 19 19:57:02 2006
@@ -1,4 +1,4 @@
-package org.apache.directory.server.core.partition.impl.btree.gui ;
+package org.apache.directory.server.core.partition.impl.btree.gui;
import java.awt.Color;
@@ -43,15 +43,15 @@
*/
public class IndexDialog extends JDialog
{
- private static final Logger log = LoggerFactory.getLogger(IndexDialog.class);
+ private static final Logger log = LoggerFactory.getLogger( IndexDialog.class );
private static final long serialVersionUID = 3689917253680445238L;
- public static final String DEFAULT_CURSOR = "Default" ;
- public static final String EQUALITY_CURSOR = "Equality" ;
- public static final String GREATER_CURSOR = "Greater" ;
- public static final String LESS_CURSOR = "Less" ;
- public static final String REGEX_CURSOR = "Regex" ;
+ public static final String DEFAULT_CURSOR = "Default";
+ public static final String EQUALITY_CURSOR = "Equality";
+ public static final String GREATER_CURSOR = "Greater";
+ public static final String LESS_CURSOR = "Less";
+ public static final String REGEX_CURSOR = "Regex";
private Panel mainPnl = new Panel();
private JTabbedPane tabbedPane = new JTabbedPane();
@@ -66,59 +66,60 @@
private JTextField keyText = new JTextField();
private JLabel jLabel2 = new JLabel();
private JButton scanBut = new JButton();
-
- private Index index = null ;
+
+ private Index index = null;
+
/** Creates new form JDialog */
- public IndexDialog( Frame parent, boolean modal, Index index )
+ public IndexDialog(Frame parent, boolean modal, Index index)
{
- super ( parent, modal ) ;
- this.index = index ;
- initGUI() ;
+ super( parent, modal );
+ this.index = index;
+ initGUI();
}
+
/**
* This method is called from within the constructor to initialize the
* form.
*/
private void initGUI()
{
- addWindowListener(new java.awt.event.WindowAdapter()
+ addWindowListener( new java.awt.event.WindowAdapter()
{
- public void windowClosing(java.awt.event.WindowEvent evt)
+ public void windowClosing( java.awt.event.WindowEvent evt )
{
closeDialog();
}
- });
+ } );
pack();
- setTitle("Index On Attribute '" + index.getAttribute().getName() + "'");
- setBounds(new java.awt.Rectangle(0, 0, 512, 471));
- getContentPane().add(mainPnl, java.awt.BorderLayout.CENTER);
- mainPnl.setLayout(new java.awt.BorderLayout());
- mainPnl.add(tabbedPane, java.awt.BorderLayout.CENTER);
- tabbedPane.add(listPnl, "Listing");
- listPnl.setLayout(new java.awt.GridBagLayout());
+ setTitle( "Index On Attribute '" + index.getAttribute().getName() + "'" );
+ setBounds( new java.awt.Rectangle( 0, 0, 512, 471 ) );
+ getContentPane().add( mainPnl, java.awt.BorderLayout.CENTER );
+ mainPnl.setLayout( new java.awt.BorderLayout() );
+ mainPnl.add( tabbedPane, java.awt.BorderLayout.CENTER );
+ tabbedPane.add( listPnl, "Listing" );
+ listPnl.setLayout( new java.awt.GridBagLayout() );
-
RadioButtonListener radioListener = new RadioButtonListener();
JRadioButton radioDefault = new JRadioButton( DEFAULT_CURSOR );
radioDefault.setActionCommand( DEFAULT_CURSOR );
radioDefault.setSelected( true );
radioDefault.addActionListener( radioListener );
-
+
JRadioButton radioEquality = new JRadioButton( EQUALITY_CURSOR );
radioEquality.setActionCommand( EQUALITY_CURSOR );
radioEquality.addActionListener( radioListener );
-
+
JRadioButton radioGreater = new JRadioButton( GREATER_CURSOR );
radioGreater.setActionCommand( GREATER_CURSOR );
radioGreater.addActionListener( radioListener );
-
+
JRadioButton radioLess = new JRadioButton( LESS_CURSOR );
radioLess.setActionCommand( LESS_CURSOR );
radioLess.addActionListener( radioListener );
-
+
JRadioButton radioRegex = new JRadioButton( REGEX_CURSOR );
radioRegex.setActionCommand( REGEX_CURSOR );
radioRegex.addActionListener( radioListener );
@@ -137,169 +138,78 @@
radioPanel.add( radioGreater );
radioPanel.add( radioLess );
radioPanel.add( radioRegex );
-
- listPnl.add(
- cursorPnl,
- new java.awt.GridBagConstraints(
- 0,
- 0,
- 1,
- 1,
- 1.0,
- 0.15,
- java.awt.GridBagConstraints.NORTH,
- java.awt.GridBagConstraints.BOTH,
- new java.awt.Insets(15, 0, 30, 0),
- 0,
- 0));
- listPnl.add(
- resultsPnl,
- new java.awt.GridBagConstraints(
- 0,
- 1,
- 1,
- 1,
- 1.0,
- 0.8,
- java.awt.GridBagConstraints.CENTER,
- java.awt.GridBagConstraints.BOTH,
- new java.awt.Insets(0, 0, 0, 0),
- 0,
- 0));
- listPnl.add(
- buttonPnl,
- new java.awt.GridBagConstraints(
- 0,
- 2,
- 1,
- 1,
- 1.0,
- 0.05,
- java.awt.GridBagConstraints.CENTER,
- java.awt.GridBagConstraints.BOTH,
- new java.awt.Insets(0, 0, 0, 0),
- 0,
- 0));
- cursorPnl.setLayout(new java.awt.GridBagLayout());
- cursorPnl.setBorder(
- javax.swing.BorderFactory.createTitledBorder(
- javax.swing.BorderFactory.createLineBorder(
- new java.awt.Color(153, 153, 153),
- 1),
- "Display Cursor Constraints",
- javax.swing.border.TitledBorder.LEADING,
- javax.swing.border.TitledBorder.TOP,
- new java.awt.Font("SansSerif", 0, 14),
- new java.awt.Color(60, 60, 60)));
- cursorPnl.add(
- jLabel1,
- new java.awt.GridBagConstraints(
- 0,
- 1,
- 1,
- 1,
- 0.0,
- 0.0,
- java.awt.GridBagConstraints.WEST,
- java.awt.GridBagConstraints.NONE,
- new java.awt.Insets(0, 15, 0, 10),
- 0,
- 0));
- cursorPnl.add(
- keyText,
- new java.awt.GridBagConstraints(
- 1,
- 1,
- 1,
- 1,
- 0.4,
- 0.0,
- java.awt.GridBagConstraints.WEST,
- java.awt.GridBagConstraints.BOTH,
- new java.awt.Insets(5, 5, 5, 236),
- 0,
- 0));
- cursorPnl.add(
- jLabel2,
- new java.awt.GridBagConstraints(
- 0,
- 0,
- 1,
- 1,
- 0.0,
- 0.0,
- java.awt.GridBagConstraints.WEST,
- java.awt.GridBagConstraints.NONE,
- new java.awt.Insets(0, 15, 0, 10),
- 0,
- 0));
- cursorPnl.add(
- radioPanel,
- new java.awt.GridBagConstraints(
- 1,
- 0,
- 1,
- 1,
- 0.4,
- 0.0,
- java.awt.GridBagConstraints.WEST,
- java.awt.GridBagConstraints.NONE,
- new java.awt.Insets(5, 5, 5, 0),
- 0,
- 0));
- resultsPnl.setLayout(new java.awt.BorderLayout());
- resultsPnl.setBorder(
- javax.swing.BorderFactory.createTitledBorder(
- javax.swing.BorderFactory.createLineBorder(
- new java.awt.Color(153, 153, 153),
- 1),
- "Scan Results",
- javax.swing.border.TitledBorder.LEADING,
- javax.swing.border.TitledBorder.TOP,
- new java.awt.Font("SansSerif", 0, 14),
- new java.awt.Color(60, 60, 60)));
- resultsPnl.add(jScrollPane2, java.awt.BorderLayout.CENTER);
- jScrollPane2.getViewport().add(resultsTbl);
- buttonPnl.setLayout(
- new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 15, 5));
- buttonPnl.add(doneBut);
- buttonPnl.add(scanBut);
- doneBut.setText("Done");
- doneBut.addActionListener(new ActionListener()
+
+ listPnl.add( cursorPnl, new java.awt.GridBagConstraints( 0, 0, 1, 1, 1.0, 0.15,
+ java.awt.GridBagConstraints.NORTH, java.awt.GridBagConstraints.BOTH, new java.awt.Insets( 15, 0, 30, 0 ),
+ 0, 0 ) );
+ listPnl.add( resultsPnl, new java.awt.GridBagConstraints( 0, 1, 1, 1, 1.0, 0.8,
+ java.awt.GridBagConstraints.CENTER, java.awt.GridBagConstraints.BOTH, new java.awt.Insets( 0, 0, 0, 0 ), 0,
+ 0 ) );
+ listPnl.add( buttonPnl, new java.awt.GridBagConstraints( 0, 2, 1, 1, 1.0, 0.05,
+ java.awt.GridBagConstraints.CENTER, java.awt.GridBagConstraints.BOTH, new java.awt.Insets( 0, 0, 0, 0 ), 0,
+ 0 ) );
+ cursorPnl.setLayout( new java.awt.GridBagLayout() );
+ cursorPnl.setBorder( javax.swing.BorderFactory.createTitledBorder( javax.swing.BorderFactory.createLineBorder(
+ new java.awt.Color( 153, 153, 153 ), 1 ), "Display Cursor Constraints",
+ javax.swing.border.TitledBorder.LEADING, javax.swing.border.TitledBorder.TOP, new java.awt.Font(
+ "SansSerif", 0, 14 ), new java.awt.Color( 60, 60, 60 ) ) );
+ cursorPnl.add( jLabel1, new java.awt.GridBagConstraints( 0, 1, 1, 1, 0.0, 0.0,
+ java.awt.GridBagConstraints.WEST, java.awt.GridBagConstraints.NONE, new java.awt.Insets( 0, 15, 0, 10 ), 0,
+ 0 ) );
+ cursorPnl.add( keyText, new java.awt.GridBagConstraints( 1, 1, 1, 1, 0.4, 0.0,
+ java.awt.GridBagConstraints.WEST, java.awt.GridBagConstraints.BOTH, new java.awt.Insets( 5, 5, 5, 236 ), 0,
+ 0 ) );
+ cursorPnl.add( jLabel2, new java.awt.GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0,
+ java.awt.GridBagConstraints.WEST, java.awt.GridBagConstraints.NONE, new java.awt.Insets( 0, 15, 0, 10 ), 0,
+ 0 ) );
+ cursorPnl.add( radioPanel,
+ new java.awt.GridBagConstraints( 1, 0, 1, 1, 0.4, 0.0, java.awt.GridBagConstraints.WEST,
+ java.awt.GridBagConstraints.NONE, new java.awt.Insets( 5, 5, 5, 0 ), 0, 0 ) );
+ resultsPnl.setLayout( new java.awt.BorderLayout() );
+ resultsPnl.setBorder( javax.swing.BorderFactory.createTitledBorder( javax.swing.BorderFactory.createLineBorder(
+ new java.awt.Color( 153, 153, 153 ), 1 ), "Scan Results", javax.swing.border.TitledBorder.LEADING,
+ javax.swing.border.TitledBorder.TOP, new java.awt.Font( "SansSerif", 0, 14 ), new java.awt.Color( 60, 60,
+ 60 ) ) );
+ resultsPnl.add( jScrollPane2, java.awt.BorderLayout.CENTER );
+ jScrollPane2.getViewport().add( resultsTbl );
+ buttonPnl.setLayout( new java.awt.FlowLayout( java.awt.FlowLayout.CENTER, 15, 5 ) );
+ buttonPnl.add( doneBut );
+ buttonPnl.add( scanBut );
+ doneBut.setText( "Done" );
+ doneBut.addActionListener( new ActionListener()
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed( ActionEvent e )
{
closeDialog();
}
- });
+ } );
- jLabel1.setText("Key Constraint:");
- keyText.setText("");
- keyText.setMinimumSize(new java.awt.Dimension(130, 20));
- keyText.setPreferredSize(new java.awt.Dimension(130, 20));
- keyText.setMaximumSize(new java.awt.Dimension(130, 20));
- keyText.setFont(
- new java.awt.Font("SansSerif", java.awt.Font.PLAIN, 14));
- keyText.setSize(new java.awt.Dimension(130, 20));
- jLabel2.setText("Cursor Type:");
+ jLabel1.setText( "Key Constraint:" );
+ keyText.setText( "" );
+ keyText.setMinimumSize( new java.awt.Dimension( 130, 20 ) );
+ keyText.setPreferredSize( new java.awt.Dimension( 130, 20 ) );
+ keyText.setMaximumSize( new java.awt.Dimension( 130, 20 ) );
+ keyText.setFont( new java.awt.Font( "SansSerif", java.awt.Font.PLAIN, 14 ) );
+ keyText.setSize( new java.awt.Dimension( 130, 20 ) );
+ jLabel2.setText( "Cursor Type:" );
- scanBut.setText("Scan");
- scanBut.addActionListener(new ActionListener()
+ scanBut.setText( "Scan" );
+ scanBut.addActionListener( new ActionListener()
{
public void actionPerformed( ActionEvent e )
{
doScan( keyText.getText(), selectedCursorType );
}
- });
+ } );
doScan( null, DEFAULT_CURSOR );
}
-
private String selectedCursorType = DEFAULT_CURSOR;
+
class RadioButtonListener implements ActionListener
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed( ActionEvent e )
{
if ( e.getActionCommand() == DEFAULT_CURSOR )
{
@@ -324,124 +234,113 @@
}
}
-
+
private void closeDialog()
{
- setVisible( false ) ;
- dispose() ;
+ setVisible( false );
+ dispose();
}
public boolean doScan( String key, String scanType )
{
- if ( key == null || key.trim().equals( "" ) )
+ if ( key == null || key.trim().equals( "" ) )
{
- key = null ;
+ key = null;
}
- if ( key == null && scanType != DEFAULT_CURSOR )
+ if ( key == null && scanType != DEFAULT_CURSOR )
{
- JOptionPane.showMessageDialog( null, "Cannot use a " +
- scanType + " scan type with a null key constraint.",
- "Missing Key Constraint", JOptionPane.ERROR_MESSAGE ) ;
- return false ;
+ JOptionPane.showMessageDialog( null, "Cannot use a " + scanType + " scan type with a null key constraint.",
+ "Missing Key Constraint", JOptionPane.ERROR_MESSAGE );
+ return false;
}
- try
+ try
{
- NamingEnumeration list = null ;
+ NamingEnumeration list = null;
- if ( scanType == EQUALITY_CURSOR )
+ if ( scanType == EQUALITY_CURSOR )
{
- list = index.listIndices( key ) ;
- }
- else if (scanType == GREATER_CURSOR )
+ list = index.listIndices( key );
+ }
+ else if ( scanType == GREATER_CURSOR )
{
- list = index.listIndices( key, true ) ;
- }
- else if ( scanType == LESS_CURSOR )
+ list = index.listIndices( key, true );
+ }
+ else if ( scanType == LESS_CURSOR )
{
- list = index.listIndices( key, false ) ;
- }
- else if ( scanType == REGEX_CURSOR )
+ list = index.listIndices( key, false );
+ }
+ else if ( scanType == REGEX_CURSOR )
{
- Pattern regex = StringTools.getRegex( key ) ;
- int starIndex = key.indexOf( '*' ) ;
+ Pattern regex = StringTools.getRegex( key );
+ int starIndex = key.indexOf( '*' );
- if ( starIndex > 0 )
+ if ( starIndex > 0 )
{
- String prefix = key.substring( 0, starIndex ) ;
+ String prefix = key.substring( 0, starIndex );
- if (log.isDebugEnabled())
- log.debug( "Regex prefix = " + prefix ) ;
+ if ( log.isDebugEnabled() )
+ log.debug( "Regex prefix = " + prefix );
- list = index.listIndices( regex, prefix ) ;
- }
- else
+ list = index.listIndices( regex, prefix );
+ }
+ else
{
- list = index.listIndices( regex ) ;
+ list = index.listIndices( regex );
}
- }
- else
+ }
+ else
{
- list = index.listIndices() ;
+ list = index.listIndices();
}
- Object [] cols = new Object [2] ;
- Object [] row = null ;
- cols[0] = "Keys ( Attribute Value )" ;
- cols[1] = "Values ( Entry Id )" ;
- DefaultTableModel model = new DefaultTableModel( cols, 0 ) ;
- int count = 0 ;
-
- while( list.hasMore() )
- {
- IndexRecord rec = ( IndexRecord ) list.next() ;
- row = new Object [2] ;
- row[0] = rec.getIndexKey() ;
- row[1] = rec.getEntryId() ;
- model.addRow( row ) ;
- count++ ;
- }
-
- resultsTbl.setModel( model ) ;
- resultsPnl.setBorder(
- BorderFactory.createTitledBorder(
- BorderFactory.createLineBorder(
- new Color( 153, 153, 153 ), 1 ),
- "Scan Results: " + count,
- TitledBorder.LEADING,
- TitledBorder.TOP,
- new Font( "SansSerif", 0, 14 ),
- new Color( 60, 60, 60 ) ) ) ;
+ Object[] cols = new Object[2];
+ Object[] row = null;
+ cols[0] = "Keys ( Attribute Value )";
+ cols[1] = "Values ( Entry Id )";
+ DefaultTableModel model = new DefaultTableModel( cols, 0 );
+ int count = 0;
- if ( isVisible() )
+ while ( list.hasMore() )
{
- validate() ;
+ IndexRecord rec = ( IndexRecord ) list.next();
+ row = new Object[2];
+ row[0] = rec.getIndexKey();
+ row[1] = rec.getEntryId();
+ model.addRow( row );
+ count++;
}
- }
- catch ( Exception e )
+
+ resultsTbl.setModel( model );
+ resultsPnl.setBorder( BorderFactory.createTitledBorder( BorderFactory.createLineBorder( new Color( 153,
+ 153, 153 ), 1 ), "Scan Results: " + count, TitledBorder.LEADING, TitledBorder.TOP, new Font(
+ "SansSerif", 0, 14 ), new Color( 60, 60, 60 ) ) );
+
+ if ( isVisible() )
+ {
+ validate();
+ }
+ }
+ catch ( Exception e )
{
String msg = ExceptionUtils.getStackTrace( e );
- if ( msg.length() > 1024 )
+ if ( msg.length() > 1024 )
{
- msg = msg.substring( 0, 1024 )
- + "\n. . . TRUNCATED . . ." ;
+ msg = msg.substring( 0, 1024 ) + "\n. . . TRUNCATED . . .";
}
- msg = "Error while scanning index "
- + "on attribute " + index.getAttribute() + " using a "
- + scanType + " cursor type with a key constraint of '"
- + key + "':\n" + msg ;
-
- JTextArea area = new JTextArea() ;
- area.setText( msg ) ;
- JOptionPane.showMessageDialog( null, area, "Index Scan Error",
- JOptionPane.ERROR_MESSAGE ) ;
- return false ;
+ msg = "Error while scanning index " + "on attribute " + index.getAttribute() + " using a " + scanType
+ + " cursor type with a key constraint of '" + key + "':\n" + msg;
+
+ JTextArea area = new JTextArea();
+ area.setText( msg );
+ JOptionPane.showMessageDialog( null, area, "Index Scan Error", JOptionPane.ERROR_MESSAGE );
+ return false;
}
- return true ;
+ return true;
}
}
Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/IndexDialog.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/IndexDialog.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id
Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java Sun Feb 19 19:57:02 2006
@@ -86,7 +86,7 @@
*/
public class PartitionFrame extends JFrame
{
- private static final Logger log = LoggerFactory.getLogger(PartitionFrame.class);
+ private static final Logger log = LoggerFactory.getLogger( PartitionFrame.class );
private static final long serialVersionUID = 4049353102291513657L;
@@ -120,8 +120,7 @@
/**
* Creates new form JFrame
*/
- public PartitionFrame( BTreeDirectoryPartition db, SearchEngine eng )
- throws NamingException
+ public PartitionFrame(BTreeDirectoryPartition db, SearchEngine eng) throws NamingException
{
partition = db;
this.eng = eng;
@@ -169,9 +168,9 @@
// --------------------------------------------------------------------
// 'Backend' Menu
// --------------------------------------------------------------------
-
+
JMenu backendMenu = new JMenu( "Backend" );
- backendMenu.setText("Partition");
+ backendMenu.setText( "Partition" );
backendMenu.setBackground( new java.awt.Color( 205, 205, 205 ) );
backendMenu.setMnemonic( 'B' );
@@ -182,7 +181,7 @@
add.setBackground( new java.awt.Color( 205, 205, 205 ) );
add.addActionListener( new ActionListener()
{
- public void actionPerformed( ActionEvent e )
+ public void actionPerformed( ActionEvent e )
{
doAddDialog();
}
@@ -195,7 +194,7 @@
importItem.setBackground( new java.awt.Color( 205, 205, 205 ) );
importItem.addActionListener( new ActionListener()
{
- public void actionPerformed( ActionEvent e )
+ public void actionPerformed( ActionEvent e )
{
doImport();
}
@@ -208,7 +207,7 @@
exit.setBackground( new java.awt.Color( 205, 205, 205 ) );
exit.addActionListener( new ActionListener()
{
- public void actionPerformed( ActionEvent e )
+ public void actionPerformed( ActionEvent e )
{
exitForm();
}
@@ -219,23 +218,22 @@
helpMenu.setMnemonic( 'H' );
JMenuItem about = new JMenuItem( "About" );
about.setMnemonic( 'A' );
- about.setBackground( new java.awt.Color( 205,205,205 ) );
+ about.setBackground( new java.awt.Color( 205, 205, 205 ) );
about.addActionListener( new ActionListener()
{
- public void actionPerformed( ActionEvent e )
+ public void actionPerformed( ActionEvent e )
{
- AboutDialog aboutDialog =
- new AboutDialog ( PartitionFrame.this, true );
+ AboutDialog aboutDialog = new AboutDialog( PartitionFrame.this, true );
PartitionFrame.this.centerOnScreen( aboutDialog );
aboutDialog.setVisible( true );
}
} );
- helpMenu.setBackground( new java.awt.Color( 205,205,205 ) );
+ helpMenu.setBackground( new java.awt.Color( 205, 205, 205 ) );
helpMenu.add( about );
-
+
// create Save menu item
// create Print menu item
- menuBar.setBackground( new java.awt.Color( 196,197,203 ) );
+ menuBar.setBackground( new java.awt.Color( 196, 197, 203 ) );
menuBar.add( backendMenu );
menuBar.add( searchMenu );
menuBar.add( indices );
@@ -243,26 +241,25 @@
// sets menu bar
setJMenuBar( menuBar );
setBounds( new java.awt.Rectangle( 0, 0, 802, 515 ) );
- setSize( new java.awt.Dimension( 802,515 ) );
+ setSize( new java.awt.Dimension( 802, 515 ) );
setResizable( true );
-
- addWindowListener( new java.awt.event.WindowAdapter()
+
+ addWindowListener( new java.awt.event.WindowAdapter()
{
- public void windowClosing( java.awt.event.WindowEvent evt )
+ public void windowClosing( java.awt.event.WindowEvent evt )
{
exitForm();
}
} );
-
+
treePane.getViewport().add( tree );
- tree.setBounds( new java.awt.Rectangle( 6,184,82,80 ) );
+ tree.setBounds( new java.awt.Rectangle( 6, 184, 82, 80 ) );
tree.setShowsRootHandles( true );
tree.setToolTipText( "DB DIT" );
tree.setScrollsOnExpand( true );
- tree.getSelectionModel().addTreeSelectionListener(
- new TreeSelectionListener()
+ tree.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener()
{
- public void valueChanged( TreeSelectionEvent e )
+ public void valueChanged( TreeSelectionEvent e )
{
TreePath path = e.getNewLeadSelectionPath();
@@ -272,15 +269,14 @@
}
Object last = path.getLastPathComponent();
- try
+ try
{
if ( last instanceof EntryNode )
{
- displayEntry( ( ( EntryNode ) last ).getEntryId(),
- ( ( EntryNode ) last).getLdapEntry() );
+ displayEntry( ( ( EntryNode ) last ).getEntryId(), ( ( EntryNode ) last ).getLdapEntry() );
}
- }
- catch( Exception ex )
+ }
+ catch ( Exception ex )
{
ex.printStackTrace();
}
@@ -288,31 +284,31 @@
} );
entryPane.getViewport().add( entryTbl );
- entryTbl.setBounds( new java.awt.Rectangle( 321,103,32,32 ) );
+ entryTbl.setBounds( new java.awt.Rectangle( 321, 103, 32, 32 ) );
idxPane.getViewport().add( idxTbl );
- idxTbl.setBounds( new java.awt.Rectangle( 429,134,32,32 ) );
+ idxTbl.setBounds( new java.awt.Rectangle( 429, 134, 32, 32 ) );
treePane.setSize( new java.awt.Dimension( 285, 435 ) );
treePane.setPreferredSize( new java.awt.Dimension( 285, 403 ) );
searchMenu.setText( "Search" );
- searchMenu.setBackground( new java.awt.Color( 205,205,205 ) );
+ searchMenu.setBackground( new java.awt.Color( 205, 205, 205 ) );
searchMenu.add( run );
searchMenu.add( debug );
searchMenu.add( annotate );
ActionListener searchHandler = new ActionListener()
{
- public void actionPerformed( ActionEvent an_event )
+ public void actionPerformed( ActionEvent an_event )
{
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
log.debug( "action command = " + an_event.getActionCommand() );
try
{
doFilterDialog( an_event.getActionCommand() );
}
- catch( NamingException e )
+ catch ( NamingException e )
{
e.printStackTrace();
}
@@ -321,17 +317,17 @@
annotate.setText( FilterDialog.ANNOTATE_MODE );
annotate.setActionCommand( FilterDialog.ANNOTATE_MODE );
- annotate.setBackground( new java.awt.Color( 205,205,205 ) );
+ annotate.setBackground( new java.awt.Color( 205, 205, 205 ) );
annotate.addActionListener( searchHandler );
run.setText( FilterDialog.RUN_MODE );
run.setActionCommand( FilterDialog.RUN_MODE );
- run.setBackground( new java.awt.Color( 205,205,205 ) );
+ run.setBackground( new java.awt.Color( 205, 205, 205 ) );
run.addActionListener( searchHandler );
debug.setText( FilterDialog.DEBUG_MODE );
debug.setActionCommand( FilterDialog.DEBUG_MODE );
- debug.setBackground( new java.awt.Color( 205,205,205 ) );
+ debug.setBackground( new java.awt.Color( 205, 205, 205 ) );
debug.addActionListener( searchHandler );
indices.setText( "Indices" );
@@ -343,22 +339,19 @@
{
Dimension frameSize = window.getSize();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
-
- frameSize.height = ( ( frameSize.height > screenSize.height )
- ? screenSize.height : frameSize.height );
- frameSize.width = ( ( frameSize.width > screenSize.width )
- ? screenSize.width : frameSize.width );
- window.setLocation( ( screenSize.width - frameSize.width ) / 2,
- ( screenSize.height - frameSize.height ) / 2 );
+
+ frameSize.height = ( ( frameSize.height > screenSize.height ) ? screenSize.height : frameSize.height );
+ frameSize.width = ( ( frameSize.width > screenSize.width ) ? screenSize.width : frameSize.width );
+ window.setLocation( ( screenSize.width - frameSize.width ) / 2, ( screenSize.height - frameSize.height ) / 2 );
}
-
+
/**
* Displays a entry addition dialog.
*/
public void doAddDialog()
{
- try
+ try
{
TreePath path = tree.getSelectionModel().getSelectionPath();
String parentDn = partition.getSuffix( false ).toString();
@@ -367,22 +360,21 @@
{
Object last = path.getLastPathComponent();
- if( last instanceof EntryNode )
+ if ( last instanceof EntryNode )
{
parentDn = ( ( EntryNode ) last ).getEntryDn();
- }
+ }
}
-
+
if ( null == parentDn )
{
- JOptionPane.showMessageDialog( this,
- "Must select a parent entry to add a child to!" );
+ JOptionPane.showMessageDialog( this, "Must select a parent entry to add a child to!" );
return;
}
-
+
AddEntryDialog dialog = new AddEntryDialog( this, false );
dialog.setParentDn( parentDn );
-
+
centerOnScreen( dialog );
dialog.setEnabled( true );
dialog.setVisible( true );
@@ -392,7 +384,7 @@
e.printStackTrace();
}
}
-
+
/**
* Gets the DN of the DIT node selected in the tree view.
@@ -403,16 +395,16 @@
public String getSelectedDn() throws NamingException
{
TreePath path = tree.getSelectionModel().getSelectionPath();
-
+
if ( null == path )
{
return partition.getSuffix( false ).toString();
- }
-
+ }
+
Object last = path.getLastPathComponent();
String base = null;
-
- if( last instanceof EntryNode )
+
+ if ( last instanceof EntryNode )
{
try
{
@@ -422,15 +414,15 @@
{
e.printStackTrace();
}
- }
- else
+ }
+ else
{
base = partition.getSuffix( false ).toString();
}
-
+
return base;
}
-
+
public void doImport()
{
@@ -440,25 +432,24 @@
JFileChooser chooser = new JFileChooser();
int choice = chooser.showOpenDialog( this );
File selected = chooser.getSelectedFile();
-
+
if ( JFileChooser.APPROVE_OPTION != choice )
{
return;
}
- try
+ try
{
in = new FileReader( selected );
list = new LdifIterator( in );
-
+
while ( list.hasNext() )
{
String dif = ( String ) list.next();
LockableAttributesImpl attrs = new LockableAttributesImpl();
parser.parse( attrs, dif );
String updn = ( String ) attrs.get( "dn" ).get();
- LdapName ndn =
- new LdapName( StringTools.deepTrimToLower( updn ) );
+ LdapName ndn = new LdapName( StringTools.deepTrimToLower( updn ) );
attrs.remove( "dn" );
if ( null == partition.getEntryId( ndn.toString() ) )
@@ -468,25 +459,25 @@
}
}
}
- catch( NamingException e )
+ catch ( NamingException e )
{
// @todo display popup with error here!
e.printStackTrace();
return;
- }
- catch( FileNotFoundException e )
+ }
+ catch ( FileNotFoundException e )
{
// @todo display popup with error here!
e.printStackTrace();
return;
}
- catch( IOException e )
+ catch ( IOException e )
{
// @todo display popup with error here!
e.printStackTrace();
return;
}
- catch( Exception e )
+ catch ( Exception e )
{
// @todo display popup with error here!
e.printStackTrace();
@@ -498,7 +489,7 @@
/**
* Exit the Application
*/
- private void exitForm()
+ private void exitForm()
{
setEnabled( false );
setVisible( false );
@@ -516,39 +507,37 @@
e.printStackTrace();
}
- System.exit( 0 );
+ System.exit( 0 );
}
}
-
-
+
+
public void doRunDebugAnnotate( FilterDialog dialog, String mode )
{
- try
+ try
{
if ( mode == FilterDialog.RUN_MODE )
{
- doRun( dialog.getFilter(), dialog.getScope(),
- dialog.getBase(), dialog.getLimit() );
- }
+ doRun( dialog.getFilter(), dialog.getScope(), dialog.getBase(), dialog.getLimit() );
+ }
else if ( mode == FilterDialog.DEBUG_MODE )
{
- doDebug( dialog.getFilter(), dialog.getScope(),
- dialog.getBase(), dialog.getLimit() );
- }
+ doDebug( dialog.getFilter(), dialog.getScope(), dialog.getBase(), dialog.getLimit() );
+ }
else if ( mode == FilterDialog.ANNOTATE_MODE )
{
if ( doAnnotate( dialog.getFilter() ) )
{
// continue
- }
- else
+ }
+ else
{
// We failed don't loose users filter buf
// allow user to make edits.
return;
}
- }
- else
+ }
+ else
{
throw new RuntimeException( "Unrecognized mode." );
}
@@ -568,34 +557,33 @@
if ( tree.getSelectionModel().getSelectionPath() != null )
{
dialog.setBase( getSelectedDn() );
- }
- else
+ }
+ else
{
dialog.setBase( partition.getSuffix( false ).toString() );
}
dialog.addActionListener( new ActionListener()
{
- public void actionPerformed( ActionEvent an_event )
+ public void actionPerformed( ActionEvent an_event )
{
String cmd = an_event.getActionCommand();
if ( cmd.equals( FilterDialog.SEARCH_CMD ) )
{
doRunDebugAnnotate( dialog, mode );
- }
- else if ( cmd.equals(FilterDialog.CANCEL_CMD ) )
+ }
+ else if ( cmd.equals( FilterDialog.CANCEL_CMD ) )
{
// Do nothing! Just exit dialog.
- }
- else
+ }
+ else
{
- throw new RuntimeException(
- "Unrecognized FilterDialog command: " + cmd );
+ throw new RuntimeException( "Unrecognized FilterDialog command: " + cmd );
}
- dialog.setVisible( false );
- dialog.dispose();
+ dialog.setVisible( false );
+ dialog.dispose();
}
} );
@@ -604,28 +592,25 @@
centerOnScreen( dialog );
dialog.setEnabled( true );
dialog.setVisible( true );
- }
+ }
- public boolean doRun( String filter, String scope, String base,
- String limit )
- throws Exception
+ public boolean doRun( String filter, String scope, String base, String limit ) throws Exception
{
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug( "Search attempt using filter '" + filter + "' "
- + "with scope '" + scope + "' and a return limit of '" + limit
- + "'" );
+ log.debug( "Search attempt using filter '" + filter + "' " + "with scope '" + scope
+ + "' and a return limit of '" + limit + "'" );
}
FilterParser parser = new FilterParserImpl();
ExprNode root = null;
- try
+ try
{
root = parser.parse( filter );
- }
- catch ( Exception e )
+ }
+ catch ( Exception e )
{
e.printStackTrace();
JTextArea text = new JTextArea();
@@ -638,8 +623,7 @@
text.setText( msg );
text.setEnabled( false );
- JOptionPane.showMessageDialog( null, text, "Syntax Error",
- JOptionPane.ERROR_MESSAGE );
+ JOptionPane.showMessageDialog( null, text, "Syntax Error", JOptionPane.ERROR_MESSAGE );
return false;
}
@@ -647,38 +631,37 @@
if ( scope == FilterDialog.BASE_SCOPE )
{
- ctls.setSearchScope( SearchControls.OBJECT_SCOPE );
- }
+ ctls.setSearchScope( SearchControls.OBJECT_SCOPE );
+ }
else if ( scope == FilterDialog.SINGLE_SCOPE )
{
ctls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
- }
+ }
else if ( scope == FilterDialog.SUBTREE_SCOPE )
{
ctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- } else {
- throw new RuntimeException( "Unexpected scope parameter: " +
- scope );
+ }
+ else
+ {
+ throw new RuntimeException( "Unexpected scope parameter: " + scope );
}
int limitMax = Integer.MAX_VALUE;
- if ( ! limit.equals( FilterDialog.UNLIMITED ) )
+ if ( !limit.equals( FilterDialog.UNLIMITED ) )
{
limitMax = Integer.parseInt( limit );
}
Hashtable env = new Hashtable();
- env.put( DerefAliasesEnum.JNDI_PROP,
- DerefAliasesEnum.DEREFALWAYS_NAME );
+ env.put( DerefAliasesEnum.JNDI_PROP, DerefAliasesEnum.DEREFALWAYS_NAME );
- NamingEnumeration cursor = eng.search( new LdapName( base ),
- env, root, ctls );
- String [] cols = new String [2];
+ NamingEnumeration cursor = eng.search( new LdapName( base ), env, root, ctls );
+ String[] cols = new String[2];
cols[0] = "id";
cols[1] = "dn";
DefaultTableModel tableModel = new DefaultTableModel( cols, 0 );
- Object [] row = new Object[2];
+ Object[] row = new Object[2];
int count = 0;
while ( cursor.hasMore() && count < limitMax )
{
@@ -718,14 +701,12 @@
}
- public void doDebug( String filter, String scope, String base,
- String limit )
+ public void doDebug( String filter, String scope, String base, String limit )
{
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug( "Search attempt using filter '" + filter + "' "
- + "with scope '" + scope + "' and a return limit of '" + limit
- + "'" );
+ log.debug( "Search attempt using filter '" + filter + "' " + "with scope '" + scope
+ + "' and a return limit of '" + limit + "'" );
}
}
@@ -733,7 +714,7 @@
public void selectTreeNode( BigInteger id )
{
Stack stack = new Stack();
- Object [] comps = null;
+ Object[] comps = null;
TreeNode parent = ( EntryNode ) nodes.get( id );
while ( parent != null && ( parent != parent.getParent() ) )
@@ -746,8 +727,8 @@
{
comps = new Object[1];
comps[0] = root;
- }
- else
+ }
+ else
{
comps = new Object[stack.size()];
}
@@ -764,17 +745,16 @@
}
- public boolean doAnnotate( String filter )
- throws Exception
+ public boolean doAnnotate( String filter ) throws Exception
{
- FilterParser parser = new FilterParserImpl();
+ FilterParser parser = new FilterParserImpl();
ExprNode root = null;
- try
+ try
{
root = parser.parse( filter );
- }
- catch( Exception e )
+ }
+ catch ( Exception e )
{
JTextArea text = new JTextArea();
String msg = e.getMessage();
@@ -786,19 +766,17 @@
text.setText( msg );
text.setEnabled( false );
- JOptionPane.showMessageDialog( null, text, "Syntax Error",
- JOptionPane.ERROR_MESSAGE );
+ JOptionPane.showMessageDialog( null, text, "Syntax Error", JOptionPane.ERROR_MESSAGE );
return false;
}
- AnnotatedFilterTreeDialog treeDialog = new
- AnnotatedFilterTreeDialog( PartitionFrame.this, false );
- treeDialog.setFilter( filter );
+ AnnotatedFilterTreeDialog treeDialog = new AnnotatedFilterTreeDialog( PartitionFrame.this, false );
+ treeDialog.setFilter( filter );
eng.getOptimizer().annotate( root );
- TreeNode astRoot = new ASTNode( null, root );
- TreeModel model = new DefaultTreeModel( astRoot, true );
- treeDialog.setModel( model );
+ TreeNode astRoot = new ASTNode( null, root );
+ TreeModel model = new DefaultTreeModel( astRoot, true );
+ treeDialog.setModel( model );
treeDialog.setVisible( true );
return true;
}
@@ -810,17 +788,16 @@
* @param idxAttr the name of the index or its attribute
* @throws Exception if the indices cannot be accessed
*/
- public void showIndexDialog( String idxAttr )
- throws Exception
+ public void showIndexDialog( String idxAttr ) throws Exception
{
Index index = null;
boolean isSystem = partition.hasSystemIndexOn( idxAttr );
-
+
if ( isSystem )
{
index = partition.getSystemIndex( idxAttr );
}
- else
+ else
{
index = partition.getUserIndex( idxAttr );
}
@@ -838,16 +815,16 @@
public void buildIndicesMenu( BTreeDirectoryPartition partition )
{
JMenuItem item = null;
-
+
ActionListener listener = new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
- try
+ try
{
showIndexDialog( event.getActionCommand() );
- }
- catch ( Exception e )
+ }
+ catch ( Exception e )
{
e.printStackTrace();
}
@@ -871,7 +848,7 @@
while ( list.hasNext() )
{
String idx = ( String ) list.next();
- item = new JMenuItem();
+ item = new JMenuItem();
item.setBackground( new java.awt.Color( 205, 205, 205 ) );
indices.add( item );
item.setText( idx );
@@ -881,16 +858,13 @@
}
- void displayEntry( BigInteger id, Attributes entry )
- throws Exception
+ void displayEntry( BigInteger id, Attributes entry ) throws Exception
{
String dn = partition.getEntryUpdn( id );
- AttributesTableModel model =
- new AttributesTableModel( entry, id, dn, false );
+ AttributesTableModel model = new AttributesTableModel( entry, id, dn, false );
entryTbl.setModel( model );
- model = new AttributesTableModel(
- partition.getIndices( id ), id, dn, false );
+ model = new AttributesTableModel( partition.getIndices( id ), id, dn, false );
idxTbl.setModel( model );
validate();
@@ -903,66 +877,65 @@
nodes = new HashMap();
Attributes suffix = partition.getSuffixEntry();
- BigInteger id = partition.getEntryId(
- partition.getSuffix( false ).toString() );
+ BigInteger id = partition.getEntryId( partition.getSuffix( false ).toString() );
root = new EntryNode( id, null, partition, suffix, nodes );
/*
- int option = JOptionPane.showConfirmDialog( null,
- "Would you like to filter leaf nodes on load?", "Use Filter?",
- JOptionPane.OK_CANCEL_OPTION );
- doFiltered = option == JOptionPane.OK_OPTION;
-
- if(doFiltered) {
- SearchEngine engine = new SearchEngine();
- final FilterDialog dialog =
- new FilterDialog(FilterDialog.LOAD_MODE, this, true);
- dialog.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- dialog.setVisible(false);
- dialog.dispose();
- }
- });
-
- dialog.setBase(database.getSuffix().toString());
- dialog.setScope(FilterDialog.SUBTREE_SCOPE);
-
- //Center the frame on screen
- dialog.setSize(456, 256);
- this.centerOnScreen( dialog );
- dialog.setEnabled(true);
- dialog.setVisible(true);
-
- FilterParser parser = new FilterParserImpl();
- parser.enableLogging(logger);
- ExprNode exprNode = parser.parse(dialog.getFilter());
-
- int scope = -1;
- String scopeStr = dialog.getScope();
- if(scopeStr == FilterDialog.BASE_SCOPE) {
- scope = Backend.BASE_SCOPE;
- } else if(scopeStr == FilterDialog.SINGLE_SCOPE) {
- scope = Backend.SINGLE_SCOPE;
- } else if(scopeStr == FilterDialog.SUBTREE_SCOPE) {
- scope = Backend.SUBTREE_SCOPE;
- } else {
- throw new RuntimeException("Unrecognized scope");
- }
-
- exprNode =
- engine.addScopeNode(exprNode, dialog.getBase(), scope);
- root = new EntryNode(null, database,
- database.getSuffixEntry(), nodes, exprNode, engine);
- } else {
- root = new EntryNode(null, database,
- database.getSuffixEntry(), nodes);
- }
- */
+ int option = JOptionPane.showConfirmDialog( null,
+ "Would you like to filter leaf nodes on load?", "Use Filter?",
+ JOptionPane.OK_CANCEL_OPTION );
+ doFiltered = option == JOptionPane.OK_OPTION;
+
+ if(doFiltered) {
+ SearchEngine engine = new SearchEngine();
+ final FilterDialog dialog =
+ new FilterDialog(FilterDialog.LOAD_MODE, this, true);
+ dialog.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ dialog.setVisible(false);
+ dialog.dispose();
+ }
+ });
+
+ dialog.setBase(database.getSuffix().toString());
+ dialog.setScope(FilterDialog.SUBTREE_SCOPE);
+
+ //Center the frame on screen
+ dialog.setSize(456, 256);
+ this.centerOnScreen( dialog );
+ dialog.setEnabled(true);
+ dialog.setVisible(true);
+
+ FilterParser parser = new FilterParserImpl();
+ parser.enableLogging(logger);
+ ExprNode exprNode = parser.parse(dialog.getFilter());
+
+ int scope = -1;
+ String scopeStr = dialog.getScope();
+ if(scopeStr == FilterDialog.BASE_SCOPE) {
+ scope = Backend.BASE_SCOPE;
+ } else if(scopeStr == FilterDialog.SINGLE_SCOPE) {
+ scope = Backend.SINGLE_SCOPE;
+ } else if(scopeStr == FilterDialog.SUBTREE_SCOPE) {
+ scope = Backend.SUBTREE_SCOPE;
+ } else {
+ throw new RuntimeException("Unrecognized scope");
+ }
+
+ exprNode =
+ engine.addScopeNode(exprNode, dialog.getBase(), scope);
+ root = new EntryNode(null, database,
+ database.getSuffixEntry(), nodes, exprNode, engine);
+ } else {
+ root = new EntryNode(null, database,
+ database.getSuffixEntry(), nodes);
+ }
+ */
DefaultTreeModel model = new DefaultTreeModel( root );
tree.setModel( model );
- if ( isVisible() )
+ if ( isVisible() )
{
tree.validate();
}
Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id
Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionViewer.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionViewer.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionViewer.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionViewer.java Sun Feb 19 19:57:02 2006
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.directory.server.core.partition.impl.btree.gui ;
+package org.apache.directory.server.core.partition.impl.btree.gui;
import java.awt.Dimension;
@@ -36,67 +36,63 @@
*/
public class PartitionViewer
{
- private static final Logger log = LoggerFactory.getLogger(PartitionViewer.class);
+ private static final Logger log = LoggerFactory.getLogger( PartitionViewer.class );
/** A handle on the atomic partition */
private BTreeDirectoryPartition partition;
private SearchEngine eng;
- public PartitionViewer( BTreeDirectoryPartition db, SearchEngine eng )
+ public PartitionViewer(BTreeDirectoryPartition db, SearchEngine eng)
{
this.partition = db;
this.eng = eng;
}
-// /**
-// * Viewer main is not really used.
-// *
-// * @param argv the var args
-// */
-// public static void main( String [] argv )
-// {
-// // set up system Look&Feel
-// try
-// {
-// UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() ) ;
-// }
-// catch ( Exception e )
-// {
-// System.out.println( "Could not set look and feel to use " +
-// UIManager.getSystemLookAndFeelClassName() + "." ) ;
-// e.printStackTrace() ;
-// }
-//
-// PartitionViewer viewer = new PartitionViewer( ) ;
-//
-// try
-// {
-// viewer.execute() ;
-// }
-// catch ( Exception e )
-// {
-// e.printStackTrace() ;
-// System.exit( -1 ) ;
-// }
-// }
-
+ // /**
+ // * Viewer main is not really used.
+ // *
+ // * @param argv the var args
+ // */
+ // public static void main( String [] argv )
+ // {
+ // // set up system Look&Feel
+ // try
+ // {
+ // UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() ) ;
+ // }
+ // catch ( Exception e )
+ // {
+ // System.out.println( "Could not set look and feel to use " +
+ // UIManager.getSystemLookAndFeelClassName() + "." ) ;
+ // e.printStackTrace() ;
+ // }
+ //
+ // PartitionViewer viewer = new PartitionViewer( ) ;
+ //
+ // try
+ // {
+ // viewer.execute() ;
+ // }
+ // catch ( Exception e )
+ // {
+ // e.printStackTrace() ;
+ // System.exit( -1 ) ;
+ // }
+ // }
public void execute() throws NamingException
{
- PartitionFrame frame = new PartitionFrame( partition, eng ) ;
+ PartitionFrame frame = new PartitionFrame( partition, eng );
- Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize() ;
- Dimension frameSize = frame.getSize() ;
- frameSize.height = ( ( frameSize.height > screenSize.height )
- ? screenSize.height : frameSize.height) ;
- frameSize.width = ( ( frameSize.width > screenSize.width )
- ? screenSize.width : frameSize.width ) ;
- frame.setLocation( ( screenSize.width - frameSize.width ) / 2,
- ( screenSize.height - frameSize.height ) / 2) ;
+ Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+ Dimension frameSize = frame.getSize();
+ frameSize.height = ( ( frameSize.height > screenSize.height ) ? screenSize.height : frameSize.height );
+ frameSize.width = ( ( frameSize.width > screenSize.width ) ? screenSize.width : frameSize.width );
+ frame.setLocation( ( screenSize.width - frameSize.width ) / 2, ( screenSize.height - frameSize.height ) / 2 );
frame.setVisible( true );
- log.debug( frameSize + "") ;
+ log.debug( frameSize + "" );
}
}
Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionViewer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionViewer.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id
Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/SearchResultDialog.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/SearchResultDialog.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/SearchResultDialog.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/SearchResultDialog.java Sun Feb 19 19:57:02 2006
@@ -1,175 +1,190 @@
-/*
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.directory.server.core.partition.impl.btree.gui ;
-
-
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowEvent;
-import java.math.BigInteger;
-
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JTextArea;
-import javax.swing.JTree;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.table.TableModel;
-import javax.swing.tree.TreeModel;
-
-
-/**
- * Dialog showing the search results.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
- */
-public class SearchResultDialog extends JDialog implements ListSelectionListener
-{
- private static final long serialVersionUID = 3256999964914757684L;
-
- private JPanel jPanel1 = new JPanel();
- private JTree jTree1 = new JTree();
- private JPanel jPanel2 = new JPanel();
- private JPanel jPanel3 = new JPanel();
- private JTextArea jTextArea1 = new JTextArea();
- private JScrollPane jScrollPane1 = new JScrollPane();
- private JButton jButton1 = new JButton();
- private JPanel jPanel4 = new JPanel();
- private JScrollPane jScrollPane2 = new JScrollPane();
- private JTable m_resultsTbl = new JTable();
-
- /** Creates new form JDialog */
- public SearchResultDialog(Frame parent, boolean modal) {
- super(parent, modal);
- initGUI();
- }
-
- /**
- * This method is called from within the constructor to initialize the form.
- */
- private void initGUI() {
- addWindowListener(
- new java.awt.event.WindowAdapter() {
- public void windowClosing(java.awt.event.WindowEvent evt) {
- closeDialog(evt);
- }
- });
- pack();
- getContentPane().setLayout(new java.awt.GridBagLayout());
- getContentPane().add(jPanel1,
- new java.awt.GridBagConstraints(0, 0, 1, 1, 1.0, 0.1, java.awt.GridBagConstraints.NORTH, java.awt.GridBagConstraints.BOTH,
- new java.awt.Insets(10, 5, 5, 5), 0, 0));
- getContentPane().add(jPanel2,
- new java.awt.GridBagConstraints(0, 1, 1, 1, 1.0, 0.4, java.awt.GridBagConstraints.CENTER, java.awt.GridBagConstraints.BOTH,
- new java.awt.Insets(5, 5, 5, 5), 0, 0));
- getContentPane().add(jPanel3,
- new java.awt.GridBagConstraints(0, 3, 1, 1, 1.0, 0.1, java.awt.GridBagConstraints.SOUTH, java.awt.GridBagConstraints.BOTH,
- new java.awt.Insets(0, 0, 0, 0), 0, 0));
- getContentPane().add(jPanel4,
- new java.awt.GridBagConstraints(0, 2, 1, 1, 1.0, 0.4, java.awt.GridBagConstraints.CENTER, java.awt.GridBagConstraints.BOTH,
- new java.awt.Insets(5, 5, 5, 5), 0, 0));
- jPanel1.setLayout(new java.awt.BorderLayout(10, 10));
- jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(
- new java.awt.Color(153, 153, 153), 1), "Specifications", javax.swing.border.TitledBorder.LEADING, javax.swing.border.TitledBorder.TOP,
- new java.awt.Font("SansSerif", 0, 14), new java.awt.Color(60, 60, 60)));
- jPanel1.add(jTextArea1, java.awt.BorderLayout.CENTER);
- jScrollPane1.getViewport().add(jTree1);
- jTree1.setBounds(new java.awt.Rectangle(238,142,82,80));
- jTextArea1.setText("");
- jTextArea1.setEditable(false);
- setBounds(new java.awt.Rectangle(0, 0, 485, 434));
- setTitle("Search Results");
- jPanel2.setLayout(new java.awt.BorderLayout());
- jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(
- new java.awt.Color(153, 153, 153), 1),
- "Filter Expression Tree", javax.swing.border.TitledBorder.LEADING, javax.swing.border.TitledBorder.TOP,
- new java.awt.Font("SansSerif", 0, 14), new java.awt.Color(60, 60, 60)));
- jPanel2.add(jScrollPane1, java.awt.BorderLayout.CENTER);
- jButton1.setText("Done");
- jButton1.setActionCommand("Done");
- jButton1.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent event) {
- SearchResultDialog.this.setVisible(false) ;
- SearchResultDialog.this.dispose() ;
- }
- }) ;
- jButton1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
- jButton1.setAlignmentX(0.5f);
- jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
- jPanel3.setPreferredSize(new java.awt.Dimension(79, 41));
- jPanel3.setMinimumSize(new java.awt.Dimension(79, 41));
- jPanel3.setSize(new java.awt.Dimension(471,35));
- jPanel3.setToolTipText("");
- jPanel3.add(jButton1);
- jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(
- new java.awt.Color(153, 153, 153), 1), "Search Results", javax.swing.border.TitledBorder.LEADING, javax.swing.border.TitledBorder.TOP,
- new java.awt.Font("SansSerif", 0, 14), new java.awt.Color(60, 60, 60)));
- jPanel4.setLayout(new java.awt.BorderLayout());
- jPanel4.add(jScrollPane2, java.awt.BorderLayout.CENTER);
- jScrollPane2.getViewport().add(m_resultsTbl);
- m_resultsTbl.setSize(new java.awt.Dimension(450,10));
- m_resultsTbl.getSelectionModel().addListSelectionListener(this) ;
- }
-
-
- public void valueChanged(ListSelectionEvent an_event)
- {
- ListSelectionModel selectionModel = (ListSelectionModel) an_event.getSource() ;
- int minIndex = selectionModel.getMinSelectionIndex() ;
- int maxIndex = selectionModel.getMaxSelectionIndex() ;
-
- for(int ii = minIndex ; ii <= maxIndex; ii++) {
- if(selectionModel.isSelectedIndex(ii) && !an_event.getValueIsAdjusting()) {
- BigInteger id = (BigInteger)
- m_resultsTbl.getModel().getValueAt(ii, 0) ;
- ((PartitionFrame) getParent()).selectTreeNode(id) ;
- }
- }
- }
-
-
- /** Closes the dialog */
- private void closeDialog(WindowEvent evt) {
- evt.getWindow();
- setVisible(false);
- dispose();
- }
-
-
- public void setTreeModel(TreeModel model)
- {
- this.jTree1.setModel(model) ;
- }
-
-
- public void setFilter(String filter)
- {
- this.jTextArea1.setText(filter) ;
- }
-
-
- public void setTableModel(TableModel model)
- {
- m_resultsTbl.setModel(model) ;
- }
-}
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.directory.server.core.partition.impl.btree.gui;
+
+
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowEvent;
+import java.math.BigInteger;
+
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.JTextArea;
+import javax.swing.JTree;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.TableModel;
+import javax.swing.tree.TreeModel;
+
+
+/**
+ * Dialog showing the search results.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class SearchResultDialog extends JDialog implements ListSelectionListener
+{
+ private static final long serialVersionUID = 3256999964914757684L;
+
+ private JPanel jPanel1 = new JPanel();
+ private JTree jTree1 = new JTree();
+ private JPanel jPanel2 = new JPanel();
+ private JPanel jPanel3 = new JPanel();
+ private JTextArea jTextArea1 = new JTextArea();
+ private JScrollPane jScrollPane1 = new JScrollPane();
+ private JButton jButton1 = new JButton();
+ private JPanel jPanel4 = new JPanel();
+ private JScrollPane jScrollPane2 = new JScrollPane();
+ private JTable m_resultsTbl = new JTable();
+
+
+ /** Creates new form JDialog */
+ public SearchResultDialog(Frame parent, boolean modal)
+ {
+ super( parent, modal );
+ initGUI();
+ }
+
+
+ /**
+ * This method is called from within the constructor to initialize the form.
+ */
+ private void initGUI()
+ {
+ addWindowListener( new java.awt.event.WindowAdapter()
+ {
+ public void windowClosing( java.awt.event.WindowEvent evt )
+ {
+ closeDialog( evt );
+ }
+ } );
+ pack();
+ getContentPane().setLayout( new java.awt.GridBagLayout() );
+ getContentPane().add(
+ jPanel1,
+ new java.awt.GridBagConstraints( 0, 0, 1, 1, 1.0, 0.1, java.awt.GridBagConstraints.NORTH,
+ java.awt.GridBagConstraints.BOTH, new java.awt.Insets( 10, 5, 5, 5 ), 0, 0 ) );
+ getContentPane().add(
+ jPanel2,
+ new java.awt.GridBagConstraints( 0, 1, 1, 1, 1.0, 0.4, java.awt.GridBagConstraints.CENTER,
+ java.awt.GridBagConstraints.BOTH, new java.awt.Insets( 5, 5, 5, 5 ), 0, 0 ) );
+ getContentPane().add(
+ jPanel3,
+ new java.awt.GridBagConstraints( 0, 3, 1, 1, 1.0, 0.1, java.awt.GridBagConstraints.SOUTH,
+ java.awt.GridBagConstraints.BOTH, new java.awt.Insets( 0, 0, 0, 0 ), 0, 0 ) );
+ getContentPane().add(
+ jPanel4,
+ new java.awt.GridBagConstraints( 0, 2, 1, 1, 1.0, 0.4, java.awt.GridBagConstraints.CENTER,
+ java.awt.GridBagConstraints.BOTH, new java.awt.Insets( 5, 5, 5, 5 ), 0, 0 ) );
+ jPanel1.setLayout( new java.awt.BorderLayout( 10, 10 ) );
+ jPanel1.setBorder( javax.swing.BorderFactory.createTitledBorder( javax.swing.BorderFactory.createLineBorder(
+ new java.awt.Color( 153, 153, 153 ), 1 ), "Specifications", javax.swing.border.TitledBorder.LEADING,
+ javax.swing.border.TitledBorder.TOP, new java.awt.Font( "SansSerif", 0, 14 ), new java.awt.Color( 60, 60,
+ 60 ) ) );
+ jPanel1.add( jTextArea1, java.awt.BorderLayout.CENTER );
+ jScrollPane1.getViewport().add( jTree1 );
+ jTree1.setBounds( new java.awt.Rectangle( 238, 142, 82, 80 ) );
+ jTextArea1.setText( "" );
+ jTextArea1.setEditable( false );
+ setBounds( new java.awt.Rectangle( 0, 0, 485, 434 ) );
+ setTitle( "Search Results" );
+ jPanel2.setLayout( new java.awt.BorderLayout() );
+ jPanel2.setBorder( javax.swing.BorderFactory.createTitledBorder( javax.swing.BorderFactory.createLineBorder(
+ new java.awt.Color( 153, 153, 153 ), 1 ), "Filter Expression Tree",
+ javax.swing.border.TitledBorder.LEADING, javax.swing.border.TitledBorder.TOP, new java.awt.Font(
+ "SansSerif", 0, 14 ), new java.awt.Color( 60, 60, 60 ) ) );
+ jPanel2.add( jScrollPane1, java.awt.BorderLayout.CENTER );
+ jButton1.setText( "Done" );
+ jButton1.setActionCommand( "Done" );
+ jButton1.addActionListener( new ActionListener()
+ {
+ public void actionPerformed( ActionEvent event )
+ {
+ SearchResultDialog.this.setVisible( false );
+ SearchResultDialog.this.dispose();
+ }
+ } );
+ jButton1.setHorizontalAlignment( javax.swing.SwingConstants.CENTER );
+ jButton1.setAlignmentX( 0.5f );
+ jButton1.setHorizontalTextPosition( javax.swing.SwingConstants.CENTER );
+ jPanel3.setPreferredSize( new java.awt.Dimension( 79, 41 ) );
+ jPanel3.setMinimumSize( new java.awt.Dimension( 79, 41 ) );
+ jPanel3.setSize( new java.awt.Dimension( 471, 35 ) );
+ jPanel3.setToolTipText( "" );
+ jPanel3.add( jButton1 );
+ jPanel4.setBorder( javax.swing.BorderFactory.createTitledBorder( javax.swing.BorderFactory.createLineBorder(
+ new java.awt.Color( 153, 153, 153 ), 1 ), "Search Results", javax.swing.border.TitledBorder.LEADING,
+ javax.swing.border.TitledBorder.TOP, new java.awt.Font( "SansSerif", 0, 14 ), new java.awt.Color( 60, 60,
+ 60 ) ) );
+ jPanel4.setLayout( new java.awt.BorderLayout() );
+ jPanel4.add( jScrollPane2, java.awt.BorderLayout.CENTER );
+ jScrollPane2.getViewport().add( m_resultsTbl );
+ m_resultsTbl.setSize( new java.awt.Dimension( 450, 10 ) );
+ m_resultsTbl.getSelectionModel().addListSelectionListener( this );
+ }
+
+
+ public void valueChanged( ListSelectionEvent an_event )
+ {
+ ListSelectionModel selectionModel = ( ListSelectionModel ) an_event.getSource();
+ int minIndex = selectionModel.getMinSelectionIndex();
+ int maxIndex = selectionModel.getMaxSelectionIndex();
+
+ for ( int ii = minIndex; ii <= maxIndex; ii++ )
+ {
+ if ( selectionModel.isSelectedIndex( ii ) && !an_event.getValueIsAdjusting() )
+ {
+ BigInteger id = ( BigInteger ) m_resultsTbl.getModel().getValueAt( ii, 0 );
+ ( ( PartitionFrame ) getParent() ).selectTreeNode( id );
+ }
+ }
+ }
+
+
+ /** Closes the dialog */
+ private void closeDialog( WindowEvent evt )
+ {
+ evt.getWindow();
+ setVisible( false );
+ dispose();
+ }
+
+
+ public void setTreeModel( TreeModel model )
+ {
+ this.jTree1.setModel( model );
+ }
+
+
+ public void setFilter( String filter )
+ {
+ this.jTextArea1.setText( filter );
+ }
+
+
+ public void setTableModel( TableModel model )
+ {
+ m_resultsTbl.setModel( model );
+ }
+}
Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/SearchResultDialog.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/SearchResultDialog.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id