001: /*
002: * argun 1.0
003: * Web 2.0 delivery framework
004: * Copyright (C) 2007 Hammurapi Group
005: *
006: * This program is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2 of the License, or (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: *
020: * URL: http://www.hammurapi.biz
021: * e-Mail: support@hammurapi.biz
022: */
023: package biz.hammurapi.web.webdiagram;
024:
025: import java.awt.GridBagConstraints;
026: import java.awt.GridBagLayout;
027: import java.awt.Insets;
028: import java.awt.event.ActionEvent;
029: import java.awt.event.ActionListener;
030:
031: import javax.swing.ComboBoxModel;
032: import javax.swing.DefaultComboBoxModel;
033: import javax.swing.JButton;
034: import javax.swing.JCheckBox;
035: import javax.swing.JComboBox;
036: import javax.swing.JEditorPane;
037: import javax.swing.JFrame;
038: import javax.swing.JLabel;
039: import javax.swing.JScrollPane;
040: import javax.swing.JTabbedPane;
041: import javax.swing.JTextArea;
042: import javax.swing.JTextField;
043: import javax.swing.JTextPane;
044:
045: /**
046: * This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
047: * Builder, which is free for non-commercial use. If Jigloo is being used
048: * commercially (ie, by a corporation, company or business for any purpose
049: * whatever) then you should purchase a license for each developer using Jigloo.
050: * Please visit www.cloudgarden.com for details. Use of Jigloo implies
051: * acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
052: * PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
053: * ANY CORPORATE OR COMMERCIAL PURPOSE.
054: */
055: public class WebDiagramPropertiesDialog extends javax.swing.JDialog {
056: private JButton okButton;
057:
058: private JButton cancelButton;
059:
060: private JTextArea afterTextArea;
061:
062: private JScrollPane afterScrollPane;
063:
064: private JTextArea beforeTextArea;
065:
066: private JScrollPane beforeScrollPane;
067:
068: private JCheckBox verticalCheckBox;
069: private JComboBox scopeComboBox;
070: private JLabel scopeLabel;
071:
072: private JLabel nameLabel;
073:
074: private JEditorPane descriptionEditorPane;
075:
076: private JScrollPane descriptionScrollPane;
077:
078: private JTabbedPane tabbedPanel;
079:
080: private JTextField nameField;
081:
082: private WebDiagramModel data;
083:
084: /**
085: * Auto-generated main method to display this JDialog
086: */
087: public static void main(String[] args) {
088: JFrame frame = new JFrame();
089: frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
090: WebDiagramPropertiesDialog inst = new WebDiagramPropertiesDialog(
091: frame, null);
092: inst.setVisible(true);
093: frame.dispose();
094: //System.exit(0);
095: }
096:
097: public WebDiagramPropertiesDialog(JFrame frame, WebDiagramModel data) {
098: super (frame);
099: this .data = data;
100: initGUI();
101: nameField.setText(data.getName());
102: //descriptionEditorPane.setEditorKit(new HTMLEditorKit());
103: descriptionEditorPane.setText(data.getDescription());
104: }
105:
106: private void initGUI() {
107: try {
108: GridBagLayout this Layout = new GridBagLayout();
109: this Layout.rowWeights = new double[] { 0.0, 0.1, 0.0 };
110: this Layout.rowHeights = new int[] { 32, 303, 7 };
111: this Layout.columnWeights = new double[] { 0.0, 0.0, 0.0,
112: 0.1, 0.0 };
113: this Layout.columnWidths = new int[] { 45, 85, 42, 20, 7 };
114: getContentPane().setLayout(this Layout);
115: this .setName("Properties");
116: this .setModal(true);
117: this .setTitle("Properties");
118: this .setFocusable(false);
119: {
120: nameField = new JTextField();
121: getContentPane().add(
122: nameField,
123: new GridBagConstraints(1, 0, 4, 1, 0.0, 0.0,
124: GridBagConstraints.WEST,
125: GridBagConstraints.HORIZONTAL,
126: new Insets(0, 0, 0, 0), 0, 0));
127: nameField.setText("Step name");
128: nameField.setSize(200, 20);
129: }
130: {
131: okButton = new JButton();
132: getContentPane().add(
133: okButton,
134: new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0,
135: GridBagConstraints.EAST,
136: GridBagConstraints.NONE, new Insets(3,
137: 0, 3, 5), 0, 0));
138: okButton.setText("OK");
139: okButton.addActionListener(new ActionListener() {
140: public void actionPerformed(ActionEvent evt) {
141: okButtonActionPerformed(evt);
142: }
143: });
144: }
145: {
146: cancelButton = new JButton();
147: getContentPane().add(
148: cancelButton,
149: new GridBagConstraints(4, 2, 1, 1, 0.0, 0.0,
150: GridBagConstraints.WEST,
151: GridBagConstraints.NONE, new Insets(3,
152: 0, 3, 3), 0, 0));
153: cancelButton.setText("Cancel");
154: cancelButton.addActionListener(new ActionListener() {
155: public void actionPerformed(ActionEvent evt) {
156: cancelButtonActionPerformed(evt);
157: }
158: });
159: }
160: {
161: tabbedPanel = new JTabbedPane();
162: getContentPane().add(
163: tabbedPanel,
164: new GridBagConstraints(0, 1, 5, 1, 0.0, 0.0,
165: GridBagConstraints.NORTHWEST,
166: GridBagConstraints.BOTH, new Insets(0,
167: 0, 0, 0), 0, 0));
168: {
169: descriptionScrollPane = new JScrollPane();
170: tabbedPanel.addTab("Description", null,
171: descriptionScrollPane, null);
172: descriptionScrollPane
173: .setPreferredSize(new java.awt.Dimension(
174: 360, 159));
175: descriptionScrollPane.setAutoscrolls(true);
176: {
177: descriptionEditorPane = new JTextPane();
178: descriptionScrollPane
179: .setViewportView(descriptionEditorPane);
180: descriptionEditorPane.setText("Description");
181: descriptionEditorPane
182: .setPreferredSize(new java.awt.Dimension(
183: 411, 284));
184: }
185: }
186: {
187: beforeScrollPane = new JScrollPane();
188: tabbedPanel.addTab("Before", null,
189: beforeScrollPane, null);
190: {
191: beforeTextArea = new JTextArea();
192: beforeScrollPane
193: .setViewportView(beforeTextArea);
194: beforeTextArea
195: .setText("// Put condition code here");
196: beforeTextArea.setFont(new java.awt.Font(
197: "Courier New", 0, 11));
198: beforeTextArea.setTabSize(4);
199: }
200: }
201: {
202: afterScrollPane = new JScrollPane();
203: tabbedPanel.addTab("After", null, afterScrollPane,
204: null);
205: afterScrollPane
206: .setPreferredSize(new java.awt.Dimension(
207: 501, 287));
208: {
209: afterTextArea = new JTextArea();
210: afterScrollPane.setViewportView(afterTextArea);
211: afterTextArea
212: .setText("// Put action code here");
213: afterTextArea.setFont(new java.awt.Font(
214: "Courier New", 0, 11));
215: afterTextArea.setTabSize(4);
216: }
217: }
218: }
219: {
220: nameLabel = new JLabel();
221: getContentPane().add(
222: nameLabel,
223: new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
224: GridBagConstraints.CENTER,
225: GridBagConstraints.NONE, new Insets(0,
226: 0, 0, 5), 0, 0));
227: nameLabel.setText("Name");
228: }
229: {
230: verticalCheckBox = new JCheckBox();
231: getContentPane().add(
232: verticalCheckBox,
233: new GridBagConstraints(0, 2, 2, 1, 0.0, 0.0,
234: GridBagConstraints.WEST,
235: GridBagConstraints.NONE, new Insets(0,
236: 5, 0, 0), 0, 0));
237: verticalCheckBox.setText("Vertical orientation");
238: }
239: {
240: scopeLabel = new JLabel();
241: getContentPane().add(
242: scopeLabel,
243: new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0,
244: GridBagConstraints.WEST,
245: GridBagConstraints.NONE, new Insets(0,
246: 5, 0, 0), 0, 0));
247: scopeLabel.setText("Scope");
248: }
249: {
250: ComboBoxModel scopeComboBoxModel = new DefaultComboBoxModel(
251: new String[] { "Public", "Parent", "Hidden" });
252: scopeComboBox = new JComboBox();
253: getContentPane().add(
254: scopeComboBox,
255: new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0,
256: GridBagConstraints.WEST,
257: GridBagConstraints.NONE, new Insets(0,
258: 2, 0, 0), 0, 0));
259: scopeComboBox.setModel(scopeComboBoxModel);
260: }
261: this .setSize(500, 400);
262: } catch (Exception e) {
263: e.printStackTrace();
264: }
265: }
266:
267: private void okButtonActionPerformed(ActionEvent evt) {
268: data.setName(nameField.getText());
269: data.setDescription(descriptionEditorPane.getText());
270: cancelButtonActionPerformed(evt);
271: }
272:
273: private void cancelButtonActionPerformed(ActionEvent evt) {
274: setVisible(false);
275: dispose();
276: }
277: }
|