21
21
import java .util .Iterator ;
22
22
import java .util .Map ;
23
23
24
- import javax .swing .AbstractAction ;
24
+ import javax .swing .Box ;
25
25
import javax .swing .BoxLayout ;
26
26
import javax .swing .DefaultCellEditor ;
27
27
import javax .swing .JButton ;
@@ -100,10 +100,8 @@ private final void createColumnSelectionTab() {
100
100
m_appendColsCB = new JCheckBox ("Append columns to input table spec" );
101
101
newtableCBPanel .add (m_appendColsCB , BorderLayout .WEST );
102
102
103
- JButton addButton = new JButton (new AbstractAction () {
104
-
105
- private static final long serialVersionUID = -743704737927962277L ;
106
-
103
+ JButton addButton = new JButton ("Add Output Column" );
104
+ addButton .addActionListener ( new ActionListener () {
107
105
public void actionPerformed (final ActionEvent e ) {
108
106
String name ;
109
107
ScriptNodeOutputColumnsTableModel model = ((ScriptNodeOutputColumnsTableModel ) m_table
@@ -126,12 +124,9 @@ public void actionPerformed(final ActionEvent e) {
126
124
model .addRow (name , "String" );
127
125
}
128
126
});
129
- addButton .setText ("Add Output Column" );
130
-
131
- JButton removeButton = new JButton (new AbstractAction () {
132
-
133
- private static final long serialVersionUID = 743704737927962277L ;
134
127
128
+ JButton removeButton = new JButton ("Remove Output Column" );
129
+ removeButton .addActionListener ( new ActionListener () {
135
130
public void actionPerformed (final ActionEvent e ) {
136
131
int [] selectedRows = m_table .getSelectedRows ();
137
132
logger .debug ("selectedRows = " + selectedRows );
@@ -148,10 +143,41 @@ public void actionPerformed(final ActionEvent e) {
148
143
}
149
144
}
150
145
});
151
- removeButton .setText ("Remove Output Column" );
146
+
147
+ JButton upButton = new JButton ("Up" );
148
+ upButton .addActionListener (new ActionListener () {
149
+ public void actionPerformed (final ActionEvent e ) {
150
+ int [] selectedRows = m_table .getSelectedRows ();
151
+ logger .debug ("selectedRows = " + selectedRows );
152
+
153
+ if (selectedRows .length == 0 ) {
154
+ return ;
155
+ }
156
+ ((ScriptNodeOutputColumnsTableModel ) m_table .getModel ())
157
+ .moveRowsUp (selectedRows );
158
+ }
159
+ });
160
+
161
+ JButton downButton = new JButton ("Down" );
162
+ downButton .addActionListener (new ActionListener () {
163
+ public void actionPerformed (final ActionEvent e ) {
164
+ int [] selectedRows = m_table .getSelectedRows ();
165
+ logger .debug ("selectedRows = " + selectedRows );
166
+
167
+ if (selectedRows .length == 0 ) {
168
+ return ;
169
+ }
170
+
171
+ ((ScriptNodeOutputColumnsTableModel ) m_table .getModel ())
172
+ .moveRowsDown (selectedRows );
173
+ }
174
+ });
152
175
153
176
outputButtonPanel .add (addButton );
154
177
outputButtonPanel .add (removeButton );
178
+ outputButtonPanel .add (Box .createHorizontalStrut (40 ));
179
+ outputButtonPanel .add (upButton );
180
+ outputButtonPanel .add (downButton );
155
181
156
182
m_table = new JTable ();
157
183
m_table .putClientProperty ("terminateEditOnFocusLost" , Boolean .TRUE );
@@ -211,9 +237,8 @@ private final void createScriptTab() {
211
237
JPanel scriptButtonPanel = new JPanel ();
212
238
213
239
// script load button
214
- JButton scriptButton = new JButton (new AbstractAction () {
215
-
216
- private static final long serialVersionUID = 6097485154386131768L ;
240
+ JButton scriptButton = new JButton ("Load Script from File" );
241
+ scriptButton .addActionListener ( new ActionListener () {
217
242
private JFileChooser fileChooser = new JFileChooser ();
218
243
219
244
public void actionPerformed (final ActionEvent e ) {
@@ -252,7 +277,6 @@ public void actionPerformed(final ActionEvent e) {
252
277
clearErrorHighlight ();
253
278
}
254
279
});
255
- scriptButton .setText ("Load Script from File" );
256
280
scriptButtonPanel .add (scriptButton );
257
281
258
282
JPanel scriptMainPanel = new JPanel (new BorderLayout ());
@@ -273,7 +297,9 @@ public void actionPerformed(final ActionEvent e) {
273
297
274
298
JPanel inputColumnsPanel = new JPanel ();
275
299
inputColumnsPanel .setLayout (new BoxLayout (inputColumnsPanel , BoxLayout .PAGE_AXIS ));
276
- inputColumnsPanel .setMinimumSize (new Dimension (20 , 150 ));
300
+
301
+ if (num > 0 )
302
+ inputColumnsPanel .setMinimumSize (new Dimension (20 , 150 ));
277
303
278
304
for (int i = 0 ; i < num ; i ++) {
279
305
inputColumnsPanel .add (addColumnPane (
0 commit comments