1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.ldap.server.partition.impl.btree.gui ;
18
19
20 import java.awt.Dimension;
21 import java.awt.Toolkit;
22
23 import javax.naming.NamingException;
24
25 import org.apache.ldap.server.partition.impl.btree.BTreeContextPartition;
26 import org.apache.ldap.server.partition.impl.btree.SearchEngine;
27 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory;
29
30
31 /***
32 * A partition database viewer.
33 *
34 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
35 * @version $Rev: 264732 $
36 */
37 public class PartitionViewer
38 {
39 private static final Logger log = LoggerFactory.getLogger(PartitionViewer.class);
40
41 /*** A handle on the atomic partition */
42 private BTreeContextPartition partition;
43 private SearchEngine eng;
44
45
46 public PartitionViewer( BTreeContextPartition db, SearchEngine eng )
47 {
48 this.partition = db;
49 this.eng = eng;
50 }
51
52
53 /***
54 // * Viewer main is not really used.
55 // *
56 // * @param argv the var args
57 // */
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86 public void execute() throws NamingException
87 {
88 MainFrame frame = new MainFrame( partition, eng ) ;
89
90 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize() ;
91 Dimension frameSize = frame.getSize() ;
92 frameSize.height = ( ( frameSize.height > screenSize.height )
93 ? screenSize.height : frameSize.height) ;
94 frameSize.width = ( ( frameSize.width > screenSize.width )
95 ? screenSize.width : frameSize.width ) ;
96 frame.setLocation( ( screenSize.width - frameSize.width ) / 2,
97 ( screenSize.height - frameSize.height ) / 2) ;
98
99 frame.setVisible( true );
100 log.debug( frameSize + "") ;
101 }
102 }