KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > gulden > framework > amoda > environment > gui > component > GUIFrame


1 /*
2  * Project: AMODA - Abstract Modeled Application
3  * Class: de.gulden.framework.amoda.environment.gui.component.GUIFrame
4  * Version: snapshot-beautyj-1.1
5  *
6  * Date: 2004-09-29
7  *
8  * This is a snapshot version of the AMODA 0.2 development branch,
9  * it is not released as a seperate version.
10  * For AMODA, see http://amoda.berlios.de/.
11  *
12  * This is licensed under the GNU Lesser General Public License (LGPL)
13  * and comes with NO WARRANTY.
14  *
15  * Author: Jens Gulden
16  * Email: amoda@jensgulden.de
17  */

18
19 package de.gulden.framework.amoda.environment.gui.component;
20
21 import de.gulden.framework.amoda.environment.gui.GUIApplicationEnvironment;
22 import de.gulden.framework.amoda.model.interaction.*;
23 import javax.swing.*;
24 import java.util.Stack JavaDoc;
25
26 /**
27  * Class GUIFrame.
28  *
29  * @author Jens Gulden
30  * @version snapshot-beautyj-1.1
31  */

32 public class GUIFrame extends GUIFrameAbstract implements ErrorMessagePerformer {
33
34     // ------------------------------------------------------------------------
35
// --- fields ---
36
// ------------------------------------------------------------------------
37

38     protected Stack JavaDoc statusStack;
39
40     private JSplitPane mainSplitPane;
41
42     private JScrollPane desktopScrollPane;
43
44     private JPanel editorPanel;
45
46     private JDesktopPane desktopPane;
47
48     private JLabel statusLabel;
49
50     private JPanel treePanel;
51
52     private JMenuBar menuBar;
53
54     private JSplitPane editorSplitPane;
55
56     private JPanel statusPanel;
57
58     private JPanel toolbarsPanel;
59
60
61     // ------------------------------------------------------------------------
62
// --- constructor ---
63
// ------------------------------------------------------------------------
64

65     public GUIFrame(GUIApplicationEnvironment environment) {
66         super(environment);
67         statusStack=new Stack JavaDoc();
68         initComponents();
69         getJMenuBar().setFont(environment.getFont(GUIApplicationEnvironment.FONT_MENU));
70     }
71
72
73     // ------------------------------------------------------------------------
74
// --- methods ---
75
// ------------------------------------------------------------------------
76

77     public JDesktopPane getDesktopPane() {
78         return desktopPane;
79     }
80
81     public JPanel getTreePanel() {
82         return treePanel;
83     }
84
85     public JPanel getEditorPanel() {
86         return editorPanel;
87     }
88
89     public void setStatus(String JavaDoc text) {
90         statusLabel.setText(text);
91     }
92
93     public void resetStatus() {
94         String JavaDoc text;
95             text=" ";
96         statusLabel.setText(text);
97     }
98
99     /**
100      *
101      * @param errorMessage ...
102      * </p>
103      */

104     public void doErrorMessage(ErrorMessage errorMessage) {
105         errorDialog.doErrorMessage(errorMessage);
106     }
107
108     private void initComponents() {
109         //GEN-BEGIN:initComponents
110
statusPanel = new javax.swing.JPanel JavaDoc();
111                 statusLabel = new javax.swing.JLabel JavaDoc();
112                 toolbarsPanel = new javax.swing.JPanel JavaDoc();
113                 mainSplitPane = new javax.swing.JSplitPane JavaDoc();
114                 treePanel = new javax.swing.JPanel JavaDoc();
115                 editorSplitPane = new javax.swing.JSplitPane JavaDoc();
116                 desktopScrollPane = new javax.swing.JScrollPane JavaDoc();
117                 desktopPane = new javax.swing.JDesktopPane JavaDoc();
118                 editorPanel = new javax.swing.JPanel JavaDoc();
119                 menuBar = new javax.swing.JMenuBar JavaDoc();
120
121                 setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
122                 addWindowListener(new java.awt.event.WindowAdapter JavaDoc() {
123                     public void windowClosing(java.awt.event.WindowEvent JavaDoc evt) {
124                         exitForm(evt);
125                     }
126                 });
127
128                 statusPanel.setLayout(new java.awt.BorderLayout JavaDoc());
129
130                 statusPanel.setBorder(new javax.swing.border.EtchedBorder JavaDoc());
131                 statusLabel.setFont(new java.awt.Font JavaDoc("Dialog", 0, 12));
132                 statusLabel.setText("Initializing...");
133                 statusPanel.add(statusLabel, java.awt.BorderLayout.CENTER);
134
135                 getContentPane().add(statusPanel, java.awt.BorderLayout.SOUTH);
136
137                 getContentPane().add(toolbarsPanel, java.awt.BorderLayout.NORTH);
138
139                 mainSplitPane.setDividerLocation(200);
140                 mainSplitPane.setDividerSize(8);
141                 mainSplitPane.setContinuousLayout(true);
142                 mainSplitPane.setOneTouchExpandable(true);
143                 treePanel.setLayout(new java.awt.BorderLayout JavaDoc());
144
145                 mainSplitPane.setLeftComponent(treePanel);
146
147                 editorSplitPane.setDividerLocation(800);
148                 editorSplitPane.setDividerSize(8);
149                 editorSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
150                 editorSplitPane.setContinuousLayout(true);
151                 editorSplitPane.setOneTouchExpandable(true);
152                 desktopScrollPane.setViewportView(desktopPane);
153
154                 editorSplitPane.setLeftComponent(desktopScrollPane);
155
156                 editorSplitPane.setRightComponent(editorPanel);
157
158                 mainSplitPane.setRightComponent(editorSplitPane);
159
160                 getContentPane().add(mainSplitPane, java.awt.BorderLayout.CENTER);
161
162                 setJMenuBar(menuBar);
163
164                 pack();
165     }
166
167     private void exitForm(java.awt.event.WindowEvent JavaDoc evt) {
168         //GEN-FIRST:event_exitForm
169
environment.getExitCommand().perform();
170     }
171
172 } // end GUIFrame
173
Popular Tags