5
5
import java.awt.GridBagLayout;
6
6
import java.awt.Insets;
7
7
import java.awt.event.KeyEvent;
8
import java.io.IOException;
9
8
import java.util.regex.Pattern;
11
10
import javax.swing.JButton;
23
22
import dk.aau.cs.model.tapn.Constant;
24
23
import dk.aau.cs.model.tapn.TimedArcPetriNetNetwork;
27
* LeftConstantsPane.java
29
* Created on 08-10-2009, 13:51:42
34
* @author Morten Jacobsen
36
25
public class ConstantsDialogPanel extends javax.swing.JPanel {
38
private JRootPane rootPane;
39
private TimedArcPetriNetNetwork model;
27
private final TimedArcPetriNetNetwork model;
40
28
private int lowerBound;
41
29
private int upperBound;
42
30
private int initialValue = 0;
43
31
private EscapableDialog dialog;
45
JPanel nameTextFieldPane;
46
JTextField nameTextField;
33
JTextField nameTextField;
49
JPanel valueSpinnerPane;
51
37
CustomJSpinner valueSpinner;
53
39
JPanel buttonContainer;
55
41
JButton cancelButton;
57
private String oldName;
59
public ConstantsDialogPanel() throws IOException {
63
public ConstantsDialogPanel(JRootPane pane, TimedArcPetriNetNetwork model) throws IOException {
68
nameTextField.setText(oldName);
71
public ConstantsDialogPanel(JRootPane pane, TimedArcPetriNetNetwork model,
72
Constant constant) throws IOException {
76
initialValue = constant.value();
79
oldName = constant.name();
80
lowerBound = constant.lowerBound();
81
upperBound = constant.upperBound();
43
private final String oldName;
45
public ConstantsDialogPanel(TimedArcPetriNetNetwork model) {
49
public ConstantsDialogPanel(TimedArcPetriNetNetwork model, Constant constant) {
52
if (constant != null) {
53
initialValue = constant.value();
54
oldName = constant.name();
55
lowerBound = constant.lowerBound();
56
upperBound = constant.upperBound();
82
62
nameTextField.setText(oldName);
85
65
public void showDialog() {
86
dialog = new EscapableDialog(CreateGui.getApp(),
87
"Edit Constant", true);
66
dialog = new EscapableDialog(CreateGui.getApp(), "Edit Constant", true);
88
67
dialog.add(container);
89
68
dialog.getRootPane().setDefaultButton(okButton);
90
69
dialog.setResizable(false);
93
72
dialog.setVisible(true);
96
private void initComponents() throws IOException {
75
private void initComponents() {
97
76
container = new JPanel();
98
77
container.setLayout(new GridBagLayout());
99
78
size = new Dimension(330, 25);