KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > verifier > gui > MainFrame


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23 package com.sun.enterprise.tools.verifier.gui;
24
25 import javax.swing.*;
26 import java.awt.Container JavaDoc;
27 import java.awt.event.WindowAdapter JavaDoc;
28 import java.awt.event.WindowEvent JavaDoc;
29 import java.io.File JavaDoc;
30
31 import com.sun.enterprise.tools.verifier.StringManagerHelper;
32 import com.sun.enterprise.tools.verifier.Verifier;
33
34 public class MainFrame extends JFrame {
35
36
37     /**
38      * Deploytool gui entry point (acessed via reflection)
39      */

40     private static MainFrame verifierPanel = null;
41     private static boolean exitOnClose = false;
42     MainPanel mp = null;
43
44     /**
45      * Constructor.
46      */

47     public MainFrame() {
48         this(null);
49     }
50
51     public MainFrame(String JavaDoc jarFileName) {
52         this(jarFileName, false, null);
53     }
54
55     public MainFrame(String JavaDoc jarFileName, boolean exitOnClose,
56                      Verifier verifier) {
57         super((StringManagerHelper.getLocalStringsManager().getLocalString
58                 ("com.sun.enterprise.tools.verifier.gui.MainFrame" + // NOI18N
59
".WindowTitle", // NOI18N
60
"Verify Specification Compliance"))); // NOI18N
61
setExitOnClose(exitOnClose);
62
63         // 508 compliance for the JFrame
64
this.getAccessibleContext().setAccessibleName(StringManagerHelper.getLocalStringsManager()
65                 .getLocalString("com.sun.enterprise.tools.verifier.gui.MainFrame" + // NOI18N
66
".jfName", // NOI18N
67
"Main Window")); // NOI18N
68
this.getAccessibleContext().setAccessibleDescription(StringManagerHelper.getLocalStringsManager()
69                 .getLocalString("com.sun.enterprise.tools.verifier.gui.MainFrame" + // NOI18N
70
".jfDesc", // NOI18N
71
"This is the main window of the verifier tool")); // NOI18N
72

73         if (exitOnClose) {
74             this.addWindowListener(new WindowAdapter JavaDoc() {
75                 public void windowClosing(WindowEvent JavaDoc e) {
76                     System.exit(0);
77                 }
78             });
79         }
80         Container JavaDoc contentPane = getContentPane();
81         mp = new MainPanel(this, jarFileName, verifier);
82         contentPane.add(mp);
83         JOptionPane.showMessageDialog(this,
84                 StringManagerHelper.getLocalStringsManager()
85                 .getLocalString("com.sun.enterprise.tools.verifier.gui.Deprecation", // NOI18N
86
"\nThis GUI has been deprecated. Please use the GUI that comes with NetBeans."), // NOI18N
87
"WARNING", JOptionPane.WARNING_MESSAGE); // NOI18N
88
}
89
90     public static JFrame getDeploytoolVerifierFrame(File JavaDoc jarFile) {
91         StringManagerHelper.setLocalStringsManager(Verifier.class);
92         if (verifierPanel == null) {
93             verifierPanel = new MainFrame();
94         } else {
95             verifierPanel.getMainPanel().reset();
96         }
97         if (jarFile != null) {
98             verifierPanel.getMainPanel().setJarFilename(
99                     jarFile.getAbsolutePath());
100         }
101         return verifierPanel;
102     }
103
104
105     public MainPanel getMainPanel() {
106         return mp;
107     }
108
109     public static boolean getExitOnClose() {
110         return exitOnClose;
111     }
112
113     public static void setExitOnClose(boolean b) {
114         exitOnClose = b;
115     }
116 }
117
Popular Tags