1 | void modifyTestElement(TestElement args) {↵ | | 1 | void modifyTestElement(TestElement args) {↵
|
2 | stopTableEditing();↵ | | 2 | stopTableEditing();↵
|
3 | Iterator modelData = tableModel.iterator();↵ | | 3 | Iterator modelData = tableModel.iterator();↵
|
4 | LDAPArguments arguments = null;↵ | | 4 | Arguments arguments = null;↵
|
5 | if (args instanceof LDAPArguments) {↵ | | 5 | if (args instanceof Arguments) {↵
|
6 | arguments = (LDAPArguments) args;↵ | | 6 | arguments = (Arguments) args;↵
|
7 | arguments.clear();↵ | | 7 | arguments.clear();↵
|
8 | while (modelData.hasNext()) {↵ | | 8 | while (modelData.hasNext()) {↵
|
9 | LDAPArgument arg = (LDAPArgument) modelData.next();↵ | | 9 | Argument arg = (Argument) modelData.next();↵
|
10 | arg.setMetaData("=");↵ | | 10 | arg.setMetaData("="); // $NON-NLS-1$↵
|
11 | arguments.addArgument(arg);↵ | | 11 | arguments.addArgument(arg);↵
|
12 | }↵ | | 12 | }↵
|
13 | }↵ | | 13 | }↵
|
14 | this.configureTestElement(args);↵ | | 14 | this.configureTestElement(args);↵
|
15 | }↵ | | 15 | }↵
|
|
16 | /**↵ | | 16 | /**↵
|
17 | * A newly created component can be initialized with the contents of a Test↵ | | 17 | * A newly created component can be initialized with the contents of a Test↵
|
18 | * Element object by calling this method. The component is responsible for↵ | | 18 | * Element object by calling this method. The component is responsible for↵
|
19 | * querying the Test Element object for the relevant information to display↵ | | 19 | * querying the Test Element object for the relevant information to display↵
|
20 | * in its GUI.↵ | | 20 | * in its GUI.↵
|
21 | * ↵ | | 21 | * ↵
|
22 | * @param el↵ | | 22 | * @param el↵
|
23 | * the TestElement to configure↵ | | 23 | * the TestElement to configure↵
|
24 | */↵ | | 24 | */↵
|
25 | public void configure(TestElement el) {↵ | | 25 | public void configure(TestElement el) {↵
|
26 | super.configure(el);↵ | | 26 | super.configure(el);↵
|
27 | if (el instanceof LDAPArguments) {↵ | | 27 | if (el instanceof Arguments) {↵
|
28 | tableModel.clearData();↵ | | 28 | tableModel.clearData();↵
|
29 | PropertyIterator iter = ((LDAPArguments) el).iterator();↵ | | 29 | PropertyIterator iter = ((Arguments) el).iterator();↵
|
30 | while (iter.hasNext()) {↵ | | 30 | while (iter.hasNext()) {↵
|
31 | LDAPArgument arg = (LDAPArgument) iter.next().getObjectValue();↵ | | 31 | Argument arg = (Argument) iter.next().getObjectValue();↵
|
32 | tableModel.addRow(arg);↵ | | 32 | tableModel.addRow(arg);↵
|
33 | }↵ | | 33 | }↵
|
34 | }↵ | | 34 | }↵
|
35 | checkDeleteStatus();↵ | | 35 | checkDeleteStatus();↵
|
36 | }↵ | | 36 | }↵
|
|
37 | /**↵ | | 37 | /**↵
|
38 | * Get the table used to enter arguments.↵ | | 38 | * Get the table used to enter arguments.↵
|
39 | * ↵ | | 39 | * ↵
|
40 | * @return the table used to enter arguments↵ | | 40 | * @return the table used to enter arguments↵
|
41 | */↵ | | 41 | */↵
|
42 | protected JTable getTable() {↵ | | 42 | protected JTable getTable() {↵
|
43 | return table;↵ | | 43 | return table;↵
|
44 | }↵ | | 44 | }↵
|
|
45 | /**↵ | | 45 | /**↵
|
46 | * Get the title label for this component.↵ | | 46 | * Get the title label for this component.↵
|
47 | * ↵ | | 47 | * ↵
|
48 | * @return the title label displayed with the table↵ | | 48 | * @return the title label displayed with the table↵
|
49 | */↵ | | 49 | */↵
|
50 | protected JLabel getTableLabel() {↵ | | 50 | protected JLabel getTableLabel() {↵
|
51 | return tableLabel;↵ | | 51 | return tableLabel;↵
|
52 | }↵ | | 52 | }↵
|
|
53 | /**↵ | | 53 | /**↵
|
54 | * Get the button used to delete rows from the table.↵ | | 54 | * Get the button used to delete rows from the table.↵
|
55 | * ↵ | | 55 | * ↵
|
56 | * @return the button used to delete rows from the table↵ | | 56 | * @return the button used to delete rows from the table↵
|
57 | */↵ | | 57 | */↵
|
58 | protected JButton getDeleteButton() {↵ | | 58 | protected JButton getDeleteButton() {↵
|
59 | return delete;↵ | | 59 | return delete;↵
|
60 | }↵ | | 60 | }↵
|
|
61 | /**↵ | | 61 | /**↵
|
62 | * Get the button used to add rows to the table.↵ | | 62 | * Get the button used to add rows to the table.↵
|
63 | * ↵ | | 63 | * ↵
|
64 | * @return the button used to add rows to the table↵ | | 64 | * @return the button used to add rows to the table↵
|
65 | */↵ | | 65 | */↵
|
66 | protected JButton getAddButton() {↵ | | 66 | protected JButton getAddButton() {↵
|
67 | return add;↵ | | 67 | return add;↵
|
68 | }↵ | | 68 | }↵
|
|
69 | /**↵ | | 69 | /**↵
|
70 | * Enable or disable the delete button depending on whether or not there is↵ | | 70 | * Enable or disable the delete button depending on whether or not there is↵
|
71 | * a row to be deleted.↵ | | 71 | * a row to be deleted.↵
|
72 | */↵ | | 72 | */↵
|
73 | protected void checkDeleteStatus() {↵ | | 73 | protected void checkDeleteStatus() {↵
|
74 | // Disable DELETE if there are no rows in the table to delete.↵ | | 74 | // Disable DELETE if there are no rows in the table to delete.↵
|
75 | if (tableModel.getRowCount() == 0) {↵ | | 75 | if (tableModel.getRowCount() == 0) {↵
|
76 | delete.setEnabled(false);↵ | | 76 | delete.setEnabled(false);↵
|
77 | } else {↵ | | 77 | } else {↵
|
78 | delete.setEnabled(true);↵ | | 78 | delete.setEnabled(true);↵
|
79 | }↵ | | 79 | }↵
|
80 | } | | 80 | }
|