KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ldap > server > db > gui > PartitionViewer


1 /*
2  * Copyright 2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17 package org.apache.ldap.server.db.gui ;
18
19
20 import org.apache.ldap.server.db.Database;
21 import org.apache.ldap.server.db.SearchEngine;
22
23 import javax.naming.NamingException JavaDoc;
24 import java.awt.*;
25
26
27 /**
28  * A partition database viewer.
29  *
30  * @author <a HREF="mailto:dev@directory.apache.org">Apache Directory Project</a>
31  * @version $Rev: 169198 $
32  */

33 public class PartitionViewer
34 {
35     /** A handle on the atomic partition */
36     private Database db;
37     private SearchEngine eng;
38
39
40     public PartitionViewer( Database db, SearchEngine eng )
41     {
42         this.db = db;
43         this.eng = eng;
44     }
45
46
47 // /**
48
// * Viewer main is not really used.
49
// *
50
// * @param argv the var args
51
// */
52
// public static void main( String [] argv )
53
// {
54
// // set up system Look&Feel
55
// try
56
// {
57
// UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() ) ;
58
// }
59
// catch ( Exception e )
60
// {
61
// System.out.println( "Could not set look and feel to use " +
62
// UIManager.getSystemLookAndFeelClassName() + "." ) ;
63
// e.printStackTrace() ;
64
// }
65
//
66
// PartitionViewer viewer = new PartitionViewer( ) ;
67
//
68
// try
69
// {
70
// viewer.execute() ;
71
// }
72
// catch ( Exception e )
73
// {
74
// e.printStackTrace() ;
75
// System.exit( -1 ) ;
76
// }
77
// }
78

79
80     public void execute() throws NamingException JavaDoc
81     {
82         MainFrame frame = new MainFrame( db, eng ) ;
83
84         Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize() ;
85         Dimension frameSize = frame.getSize() ;
86         frameSize.height = ( ( frameSize.height > screenSize.height )
87             ? screenSize.height : frameSize.height) ;
88         frameSize.width = ( ( frameSize.width > screenSize.width )
89             ? screenSize.width : frameSize.width ) ;
90         frame.setLocation( ( screenSize.width - frameSize.width ) / 2,
91             ( screenSize.height - frameSize.height ) / 2) ;
92
93         frame.setVisible( true );
94         System.out.println( frameSize ) ;
95     }
96 }
97
Popular Tags