blob: 75a2decdadc4d3cf979a89df02625fcc2b6a7423 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
package client.inputforms;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.*;
import javax.swing.*;
import client.*;
/**
* This abstract class is the base class of all other classes of the same package.
* It contains some common members using by all other (specialized) input form classes.
* @author buetow
*
*/
public abstract class InputForm extends SubWindow {
protected final static long serialVersionUID = 1L;
protected Vector vecFields;
protected JPanel jPanelButtons;
protected JButton jButtonClear;
protected JButton jButtonApply;
protected JButton jButtonCancel;
protected JButton jButtonOK;
private boolean bApplyHasBeenPressed = false;
protected final static String BUTTON_CANCEL = "Cancel";
protected final static String BUTTON_CLEAR = "Clear";
protected final static String BUTTON_APPLY = "Apply";
protected final static String BUTTON_OK = "OK";
protected final static int TEXTFIELD_LENGTH = 20;
/**
* Creates the input form window and show it.
* @param sTitleText Specifies the title text of this JFrame.
* @param netCalendarClient Specifies the calendar client session object to use.
*/
public InputForm(String sTitleText, NetCalendarClient netCalendarClient) {
super(sTitleText, netCalendarClient);
}
/**
* Initializes the input form
* @param sTitleText Specifies the title text of this JFrame.
* @param netCalendarClient Specifies the calendar client session object to use.
*/
public void init(String sTitleText, NetCalendarClient netCalendarClient) {
super.init(sTitleText, netCalendarClient);
}
/**
* Initializes all the GUI components of the implementating class.
*/
protected void initComponents() {
jButtonClear = new JButton(BUTTON_CLEAR);
jButtonApply = new JButton(BUTTON_APPLY);
jButtonCancel = new JButton(BUTTON_CANCEL);
jButtonOK = new JButton(BUTTON_OK);
ActionListener actionListenerButtons = new ActionListener() {
public void actionPerformed(ActionEvent event) {
if (event.getActionCommand().equals(BUTTON_CANCEL)) {
dispose();
} else if (event.getActionCommand().equals(BUTTON_APPLY)) {
bApplyHasBeenPressed = true;
submit();
} else if (event.getActionCommand().equals(BUTTON_OK)) {
if (!bApplyHasBeenPressed)
submit();
dispose();
}
}
};
jButtonCancel.addActionListener(actionListenerButtons);
jButtonClear.addActionListener(actionListenerButtons);
jButtonApply.addActionListener(actionListenerButtons);
jButtonOK.addActionListener(actionListenerButtons);
jPanelButtons = new JPanel();
jPanelButtons.add(jButtonOK);
jPanelButtons.add(jButtonCancel);
jPanelButtons.add(jButtonApply);
jPanelButtons.add(jButtonClear);
}
/**
* Submits the input form of the implementating class.
*/
protected abstract void submit();
}
|