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.process;
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.JButton;
032: import javax.swing.JCheckBox;
033: import javax.swing.JEditorPane;
034: import javax.swing.JFrame;
035: import javax.swing.JLabel;
036: import javax.swing.JScrollPane;
037: import javax.swing.JTabbedPane;
038: import javax.swing.JTextArea;
039: import javax.swing.JTextField;
040: import javax.swing.JTextPane;
041:
042: /**
043: * This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
044: * Builder, which is free for non-commercial use. If Jigloo is being used
045: * commercially (ie, by a corporation, company or business for any purpose
046: * whatever) then you should purchase a license for each developer using Jigloo.
047: * Please visit www.cloudgarden.com for details. Use of Jigloo implies
048: * acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
049: * PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
050: * ANY CORPORATE OR COMMERCIAL PURPOSE.
051: */
052: public class ProcessPropertiesDialog extends javax.swing.JDialog {
053: private JButton okButton;
054:
055: private JButton cancelButton;
056:
057: private JTextArea afterTextArea;
058:
059: private JScrollPane afterScrollPane;
060:
061: private JTextArea beforeTextArea;
062:
063: private JScrollPane beforeScrollPane;
064: private JCheckBox verticalCheckBox;
065:
066: private JLabel nameLabel;
067:
068: private JEditorPane summaryEditorPane;
069:
070: private JScrollPane summaryScrollPane;
071:
072: private JTabbedPane tabbedPanel;
073:
074: private JTextField nameField;
075:
076: private Process data;
077:
078: /**
079: * Auto-generated main method to display this JDialog
080: */
081: public static void main(String[] args) {
082: JFrame frame = new JFrame();
083: frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
084: ProcessPropertiesDialog inst = new ProcessPropertiesDialog(
085: frame, null);
086: inst.setVisible(true);
087: frame.dispose();
088: //System.exit(0);
089: }
090:
091: public ProcessPropertiesDialog(JFrame frame, Process data) {
092: super (frame);
093: this .data = data;
094: initGUI();
095: nameField.setText(data.getName());
096: afterTextArea.setText(data.getAfterCode());
097: beforeTextArea.setText(data.getBeforeCode());
098: //summaryEditorPane.setEditorKit(new HTMLEditorKit());
099: summaryEditorPane.setText(data.getSummary());
100: verticalCheckBox.setSelected(data.getIsVertical());
101: }
102:
103: private void initGUI() {
104: try {
105: GridBagLayout this Layout = new GridBagLayout();
106: this Layout.rowWeights = new double[] { 0.0, 0.1, 0.0 };
107: this Layout.rowHeights = new int[] { 32, 303, 7 };
108: this Layout.columnWeights = new double[] { 0.0, 0.1, 0.0 };
109: this Layout.columnWidths = new int[] { 45, 354, 7 };
110: getContentPane().setLayout(this Layout);
111: this .setName("Properties");
112: this .setModal(true);
113: this .setTitle("Properties");
114: this .setFocusable(false);
115: {
116: nameField = new JTextField();
117: getContentPane().add(
118: nameField,
119: new GridBagConstraints(1, 0, 2, 1, 0.0, 0.0,
120: GridBagConstraints.WEST,
121: GridBagConstraints.HORIZONTAL,
122: new Insets(0, 0, 0, 0), 0, 0));
123: nameField.setText("Task name");
124: nameField.setSize(200, 20);
125: }
126: {
127: okButton = new JButton();
128: getContentPane().add(
129: okButton,
130: new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0,
131: GridBagConstraints.EAST,
132: GridBagConstraints.NONE, new Insets(3,
133: 0, 3, 3), 0, 0));
134: okButton.setText("OK");
135: okButton.addActionListener(new ActionListener() {
136: public void actionPerformed(ActionEvent evt) {
137: okButtonActionPerformed(evt);
138: }
139: });
140: }
141: {
142: cancelButton = new JButton();
143: getContentPane().add(
144: cancelButton,
145: new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0,
146: GridBagConstraints.WEST,
147: GridBagConstraints.NONE, new Insets(3,
148: 0, 3, 3), 0, 0));
149: cancelButton.setText("Cancel");
150: cancelButton.addActionListener(new ActionListener() {
151: public void actionPerformed(ActionEvent evt) {
152: cancelButtonActionPerformed(evt);
153: }
154: });
155: }
156: {
157: tabbedPanel = new JTabbedPane();
158: getContentPane().add(
159: tabbedPanel,
160: new GridBagConstraints(0, 1, 3, 1, 0.0, 0.0,
161: GridBagConstraints.NORTHWEST,
162: GridBagConstraints.BOTH, new Insets(0,
163: 0, 0, 0), 0, 0));
164: {
165: summaryScrollPane = new JScrollPane();
166: tabbedPanel.addTab("Summary", null,
167: summaryScrollPane, null);
168: summaryScrollPane
169: .setPreferredSize(new java.awt.Dimension(
170: 360, 159));
171: summaryScrollPane.setAutoscrolls(true);
172: {
173: summaryEditorPane = new JTextPane();
174: summaryScrollPane
175: .setViewportView(summaryEditorPane);
176: summaryEditorPane.setText("Summary");
177: summaryEditorPane
178: .setPreferredSize(new java.awt.Dimension(
179: 185, 74));
180: }
181: }
182: {
183: beforeScrollPane = new JScrollPane();
184: tabbedPanel.addTab("Before", null,
185: beforeScrollPane, null);
186: {
187: beforeTextArea = new JTextArea();
188: beforeScrollPane
189: .setViewportView(beforeTextArea);
190: beforeTextArea
191: .setText("// Put condition code here");
192: beforeTextArea.setFont(new java.awt.Font(
193: "Courier New", 0, 11));
194: beforeTextArea.setTabSize(4);
195: }
196: }
197: {
198: afterScrollPane = new JScrollPane();
199: tabbedPanel.addTab("After", null, afterScrollPane,
200: null);
201: {
202: afterTextArea = new JTextArea();
203: afterScrollPane.setViewportView(afterTextArea);
204: afterTextArea
205: .setText("// Put action code here");
206: afterTextArea.setFont(new java.awt.Font(
207: "Courier New", 0, 11));
208: afterTextArea.setTabSize(4);
209: }
210: }
211: }
212: {
213: nameLabel = new JLabel();
214: getContentPane().add(
215: nameLabel,
216: new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
217: GridBagConstraints.CENTER,
218: GridBagConstraints.NONE, new Insets(0,
219: 0, 0, 5), 0, 0));
220: nameLabel.setText("Name");
221: }
222: {
223: verticalCheckBox = new JCheckBox();
224: getContentPane().add(
225: verticalCheckBox,
226: new GridBagConstraints(0, 2, 2, 1, 0.0, 0.0,
227: GridBagConstraints.WEST,
228: GridBagConstraints.NONE, new Insets(0,
229: 5, 0, 0), 0, 0));
230: verticalCheckBox.setText("Vertical orientation");
231: }
232: this .setSize(500, 400);
233: } catch (Exception e) {
234: e.printStackTrace();
235: }
236: }
237:
238: private void okButtonActionPerformed(ActionEvent evt) {
239: data.setAfterCode(afterTextArea.getText());
240: data.setBeforeCode(beforeTextArea.getText());
241: data.setName(nameField.getText());
242: data.setSummary(summaryEditorPane.getText());
243: data.setIsVertical(verticalCheckBox.isSelected());
244: data.getApplet().modelChanged();
245: cancelButtonActionPerformed(evt);
246: }
247:
248: private void cancelButtonActionPerformed(ActionEvent evt) {
249: setVisible(false);
250: dispose();
251: }
252: }
|