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.diagrameditor;
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.JEditorPane;
033: import javax.swing.JFrame;
034: import javax.swing.JLabel;
035: import javax.swing.JScrollPane;
036: import javax.swing.JTabbedPane;
037: import javax.swing.JTextField;
038: import javax.swing.JTextPane;
039:
040: /**
041: * This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
042: * Builder, which is free for non-commercial use. If Jigloo is being used
043: * commercially (ie, by a corporation, company or business for any purpose
044: * whatever) then you should purchase a license for each developer using Jigloo.
045: * Please visit www.cloudgarden.com for details. Use of Jigloo implies
046: * acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
047: * PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
048: * ANY CORPORATE OR COMMERCIAL PURPOSE.
049: */
050: public class DiagramPropertiesDialog extends javax.swing.JDialog {
051: private JButton okButton;
052:
053: private JButton cancelButton;
054:
055: private JLabel nameLabel;
056:
057: private JEditorPane descriptionEditorPane;
058:
059: private JScrollPane descriptionScrollPane;
060:
061: private JTabbedPane tabbedPanel;
062:
063: private JTextField nameField;
064:
065: private DiagramEditorApplet applet;
066:
067: public DiagramPropertiesDialog(JFrame frame,
068: DiagramEditorApplet applet) {
069: super (frame);
070: this .applet = applet;
071: initGUI();
072: nameField.setText(applet.getFileName());
073: descriptionEditorPane.setText(applet.getFileDescription());
074: }
075:
076: private void initGUI() {
077: try {
078: GridBagLayout this Layout = new GridBagLayout();
079: this Layout.rowWeights = new double[] { 0.0, 0.1, 0.0 };
080: this Layout.rowHeights = new int[] { 32, 303, 7 };
081: this Layout.columnWeights = new double[] { 0.0, 0.0, 0.0,
082: 0.1, 0.0 };
083: this Layout.columnWidths = new int[] { 45, 85, 42, 20, 7 };
084: getContentPane().setLayout(this Layout);
085: this .setName("Properties");
086: this .setModal(true);
087: this .setTitle("Properties");
088: this .setFocusable(false);
089: {
090: nameField = new JTextField();
091: getContentPane().add(
092: nameField,
093: new GridBagConstraints(1, 0, 4, 1, 0.0, 0.0,
094: GridBagConstraints.WEST,
095: GridBagConstraints.HORIZONTAL,
096: new Insets(0, 0, 0, 0), 0, 0));
097: nameField.setText("Step name");
098: nameField.setSize(200, 20);
099: }
100: {
101: okButton = new JButton();
102: getContentPane().add(
103: okButton,
104: new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0,
105: GridBagConstraints.EAST,
106: GridBagConstraints.NONE, new Insets(3,
107: 0, 3, 5), 0, 0));
108: okButton.setText("OK");
109: okButton.addActionListener(new ActionListener() {
110: public void actionPerformed(ActionEvent evt) {
111: okButtonActionPerformed(evt);
112: }
113: });
114: }
115: {
116: cancelButton = new JButton();
117: getContentPane().add(
118: cancelButton,
119: new GridBagConstraints(4, 2, 1, 1, 0.0, 0.0,
120: GridBagConstraints.WEST,
121: GridBagConstraints.NONE, new Insets(3,
122: 0, 3, 3), 0, 0));
123: cancelButton.setText("Cancel");
124: cancelButton.addActionListener(new ActionListener() {
125: public void actionPerformed(ActionEvent evt) {
126: cancelButtonActionPerformed(evt);
127: }
128: });
129: }
130: {
131: tabbedPanel = new JTabbedPane();
132: getContentPane().add(
133: tabbedPanel,
134: new GridBagConstraints(0, 1, 5, 1, 0.0, 0.0,
135: GridBagConstraints.NORTHWEST,
136: GridBagConstraints.BOTH, new Insets(0,
137: 0, 0, 0), 0, 0));
138: {
139: descriptionScrollPane = new JScrollPane();
140: tabbedPanel.addTab("Description", null,
141: descriptionScrollPane, null);
142: descriptionScrollPane
143: .setPreferredSize(new java.awt.Dimension(
144: 360, 159));
145: descriptionScrollPane.setAutoscrolls(true);
146: {
147: descriptionEditorPane = new JTextPane();
148: descriptionScrollPane
149: .setViewportView(descriptionEditorPane);
150: descriptionEditorPane.setText("Description");
151: descriptionEditorPane
152: .setPreferredSize(new java.awt.Dimension(
153: 411, 284));
154: }
155: }
156: }
157: {
158: nameLabel = new JLabel();
159: getContentPane().add(
160: nameLabel,
161: new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
162: GridBagConstraints.CENTER,
163: GridBagConstraints.NONE, new Insets(0,
164: 0, 0, 5), 0, 0));
165: nameLabel.setText("Name");
166: }
167: this .setSize(500, 400);
168: } catch (Exception e) {
169: e.printStackTrace();
170: }
171: }
172:
173: private void okButtonActionPerformed(ActionEvent evt) {
174: applet.setFileName(nameField.getText());
175: applet.setFileDescription(descriptionEditorPane.getText());
176: cancelButtonActionPerformed(evt);
177: }
178:
179: private void cancelButtonActionPerformed(ActionEvent evt) {
180: setVisible(false);
181: dispose();
182: }
183: }
|