1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.server.core.partition.impl.btree.gui;
21
22
23 import java.awt.Frame;
24 import java.awt.event.ActionEvent;
25 import java.awt.event.ActionListener;
26 import java.awt.event.WindowEvent;
27
28 import javax.swing.JButton;
29 import javax.swing.JDialog;
30 import javax.swing.JPanel;
31 import javax.swing.JScrollPane;
32 import javax.swing.JTextArea;
33 import javax.swing.JTree;
34 import javax.swing.tree.TreeModel;
35
36
37
38
39
40
41
42
43 public class AnnotatedFilterTreeDialog extends JDialog
44 {
45 private static final long serialVersionUID = 3690476917916513074L;
46 private JPanel jPanel1 = new JPanel();
47 private JTree jTree1 = new JTree();
48 private JPanel jPanel2 = new JPanel();
49 private JPanel jPanel3 = new JPanel();
50 private JTextArea jTextArea1 = new JTextArea();
51 private JScrollPane jScrollPane1 = new JScrollPane();
52 private JButton jButton1 = new JButton();
53
54
55
56 public AnnotatedFilterTreeDialog(Frame parent, boolean modal)
57 {
58 super( parent, modal );
59 initGUI();
60 }
61
62
63
64 private void initGUI()
65 {
66 addWindowListener( new java.awt.event.WindowAdapter()
67 {
68 public void windowClosing( java.awt.event.WindowEvent evt )
69 {
70 closeDialog( evt );
71 }
72 } );
73 pack();
74 getContentPane().setLayout( new java.awt.GridBagLayout() );
75 getContentPane().add(
76 jPanel1,
77 new java.awt.GridBagConstraints( 0, 0, 1, 1, 1.0, 0.1, java.awt.GridBagConstraints.NORTH,
78 java.awt.GridBagConstraints.BOTH, new java.awt.Insets( 10, 5, 5, 5 ), 0, 0 ) );
79 getContentPane().add(
80 jPanel2,
81 new java.awt.GridBagConstraints( 0, 1, 1, 1, 1.0, 0.8, java.awt.GridBagConstraints.CENTER,
82 java.awt.GridBagConstraints.BOTH, new java.awt.Insets( 5, 5, 5, 5 ), 0, 0 ) );
83 getContentPane().add(
84 jPanel3,
85 new java.awt.GridBagConstraints( 0, 2, 1, 1, 1.0, 0.1, java.awt.GridBagConstraints.SOUTH,
86 java.awt.GridBagConstraints.HORIZONTAL, new java.awt.Insets( 0, 0, 0, 0 ), 0, 0 ) );
87 jPanel1.setLayout( new java.awt.BorderLayout( 10, 10 ) );
88 jPanel1.setBorder( javax.swing.BorderFactory.createTitledBorder( javax.swing.BorderFactory.createLineBorder(
89 new java.awt.Color( 153, 153, 153 ), 1 ), "Search Filter", javax.swing.border.TitledBorder.LEADING,
90 javax.swing.border.TitledBorder.TOP, new java.awt.Font( "SansSerif", 0, 14 ), new java.awt.Color( 60, 60,
91 60 ) ) );
92 jPanel1.add( jTextArea1, java.awt.BorderLayout.CENTER );
93 jScrollPane1.getViewport().add( jTree1 );
94 jTree1.setBounds( new java.awt.Rectangle( 238, 142, 82, 80 ) );
95 jTextArea1.setText( "" );
96 jTextArea1.setEditable( false );
97 setBounds( new java.awt.Rectangle( 0, 0, 485, 414 ) );
98 jPanel2.setLayout( new java.awt.BorderLayout() );
99 jPanel2.setBorder( javax.swing.BorderFactory.createTitledBorder( javax.swing.BorderFactory.createLineBorder(
100 new java.awt.Color( 153, 153, 153 ), 1 ), "Filter Expression Tree",
101 javax.swing.border.TitledBorder.LEADING, javax.swing.border.TitledBorder.TOP, new java.awt.Font(
102 "SansSerif", 0, 14 ), new java.awt.Color( 60, 60, 60 ) ) );
103 jPanel2.add( jScrollPane1, java.awt.BorderLayout.CENTER );
104 jButton1.setText( "Done" );
105 jButton1.setActionCommand( "Done" );
106 jButton1.addActionListener( new ActionListener()
107 {
108 public void actionPerformed( ActionEvent a_event )
109 {
110 AnnotatedFilterTreeDialog.this.setVisible( false );
111 AnnotatedFilterTreeDialog.this.dispose();
112 }
113 } );
114 jButton1.setHorizontalAlignment( javax.swing.SwingConstants.CENTER );
115 jButton1.setAlignmentX( 0.5f );
116 jButton1.setHorizontalTextPosition( javax.swing.SwingConstants.CENTER );
117 jPanel3.setPreferredSize( new java.awt.Dimension( 79, 41 ) );
118 jPanel3.setMinimumSize( new java.awt.Dimension( 79, 41 ) );
119 jPanel3.setSize( new java.awt.Dimension( 471, 35 ) );
120 jPanel3.setToolTipText( "" );
121 jPanel3.add( jButton1 );
122 }
123
124
125
126 private void closeDialog( WindowEvent evt )
127 {
128 evt.getWindow();
129 setVisible( false );
130 dispose();
131 }
132
133
134 public void setModel( TreeModel a_model )
135 {
136 this.jTree1.setModel( a_model );
137 }
138
139
140 public void setFilter( String a_filter )
141 {
142 this.jTextArea1.setText( a_filter );
143 }
144 }