001: /*
002: * Project: AMODA - Abstract Modeled Application
003: * Class: de.gulden.framework.amoda.environment.gui.component.GUIFrame
004: * Version: snapshot-beautyj-1.1
005: *
006: * Date: 2004-09-29
007: *
008: * This is a snapshot version of the AMODA 0.2 development branch,
009: * it is not released as a seperate version.
010: * For AMODA, see http://amoda.berlios.de/.
011: *
012: * This is licensed under the GNU Lesser General Public License (LGPL)
013: * and comes with NO WARRANTY.
014: *
015: * Author: Jens Gulden
016: * Email: amoda@jensgulden.de
017: */
018:
019: package de.gulden.framework.amoda.environment.gui.component;
020:
021: import de.gulden.framework.amoda.environment.gui.GUIApplicationEnvironment;
022: import de.gulden.framework.amoda.model.interaction.*;
023: import javax.swing.*;
024: import java.util.Stack;
025:
026: /**
027: * Class GUIFrame.
028: *
029: * @author Jens Gulden
030: * @version snapshot-beautyj-1.1
031: */
032: public class GUIFrame extends GUIFrameAbstract implements
033: ErrorMessagePerformer {
034:
035: // ------------------------------------------------------------------------
036: // --- fields ---
037: // ------------------------------------------------------------------------
038:
039: protected Stack statusStack;
040:
041: private JSplitPane mainSplitPane;
042:
043: private JScrollPane desktopScrollPane;
044:
045: private JPanel editorPanel;
046:
047: private JDesktopPane desktopPane;
048:
049: private JLabel statusLabel;
050:
051: private JPanel treePanel;
052:
053: private JMenuBar menuBar;
054:
055: private JSplitPane editorSplitPane;
056:
057: private JPanel statusPanel;
058:
059: private JPanel toolbarsPanel;
060:
061: // ------------------------------------------------------------------------
062: // --- constructor ---
063: // ------------------------------------------------------------------------
064:
065: public GUIFrame(GUIApplicationEnvironment environment) {
066: super (environment);
067: statusStack = new Stack();
068: initComponents();
069: getJMenuBar().setFont(
070: environment
071: .getFont(GUIApplicationEnvironment.FONT_MENU));
072: }
073:
074: // ------------------------------------------------------------------------
075: // --- methods ---
076: // ------------------------------------------------------------------------
077:
078: public JDesktopPane getDesktopPane() {
079: return desktopPane;
080: }
081:
082: public JPanel getTreePanel() {
083: return treePanel;
084: }
085:
086: public JPanel getEditorPanel() {
087: return editorPanel;
088: }
089:
090: public void setStatus(String text) {
091: statusLabel.setText(text);
092: }
093:
094: public void resetStatus() {
095: String text;
096: text = " ";
097: statusLabel.setText(text);
098: }
099:
100: /**
101: *
102: * @param errorMessage ...
103: * </p>
104: */
105: public void doErrorMessage(ErrorMessage errorMessage) {
106: errorDialog.doErrorMessage(errorMessage);
107: }
108:
109: private void initComponents() {
110: //GEN-BEGIN:initComponents
111: statusPanel = new javax.swing.JPanel();
112: statusLabel = new javax.swing.JLabel();
113: toolbarsPanel = new javax.swing.JPanel();
114: mainSplitPane = new javax.swing.JSplitPane();
115: treePanel = new javax.swing.JPanel();
116: editorSplitPane = new javax.swing.JSplitPane();
117: desktopScrollPane = new javax.swing.JScrollPane();
118: desktopPane = new javax.swing.JDesktopPane();
119: editorPanel = new javax.swing.JPanel();
120: menuBar = new javax.swing.JMenuBar();
121:
122: setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
123: addWindowListener(new java.awt.event.WindowAdapter() {
124: public void windowClosing(java.awt.event.WindowEvent evt) {
125: exitForm(evt);
126: }
127: });
128:
129: statusPanel.setLayout(new java.awt.BorderLayout());
130:
131: statusPanel.setBorder(new javax.swing.border.EtchedBorder());
132: statusLabel.setFont(new java.awt.Font("Dialog", 0, 12));
133: statusLabel.setText("Initializing...");
134: statusPanel.add(statusLabel, java.awt.BorderLayout.CENTER);
135:
136: getContentPane().add(statusPanel, java.awt.BorderLayout.SOUTH);
137:
138: getContentPane()
139: .add(toolbarsPanel, java.awt.BorderLayout.NORTH);
140:
141: mainSplitPane.setDividerLocation(200);
142: mainSplitPane.setDividerSize(8);
143: mainSplitPane.setContinuousLayout(true);
144: mainSplitPane.setOneTouchExpandable(true);
145: treePanel.setLayout(new java.awt.BorderLayout());
146:
147: mainSplitPane.setLeftComponent(treePanel);
148:
149: editorSplitPane.setDividerLocation(800);
150: editorSplitPane.setDividerSize(8);
151: editorSplitPane
152: .setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
153: editorSplitPane.setContinuousLayout(true);
154: editorSplitPane.setOneTouchExpandable(true);
155: desktopScrollPane.setViewportView(desktopPane);
156:
157: editorSplitPane.setLeftComponent(desktopScrollPane);
158:
159: editorSplitPane.setRightComponent(editorPanel);
160:
161: mainSplitPane.setRightComponent(editorSplitPane);
162:
163: getContentPane().add(mainSplitPane,
164: java.awt.BorderLayout.CENTER);
165:
166: setJMenuBar(menuBar);
167:
168: pack();
169: }
170:
171: private void exitForm(java.awt.event.WindowEvent evt) {
172: //GEN-FIRST:event_exitForm
173: environment.getExitCommand().perform();
174: }
175:
176: } // end GUIFrame
|