Lines 29-34
import java.awt.event.ActionListener;
Link Here
|
29 |
import java.io.IOException; |
29 |
import java.io.IOException; |
30 |
import java.util.Collection; |
30 |
import java.util.Collection; |
31 |
import java.util.Iterator; |
31 |
import java.util.Iterator; |
|
|
32 |
import java.util.function.Function; |
32 |
|
33 |
|
33 |
import javax.swing.BorderFactory; |
34 |
import javax.swing.BorderFactory; |
34 |
import javax.swing.Box; |
35 |
import javax.swing.Box; |
Lines 62-68
import org.apache.jorphan.reflect.Functor;
Link Here
|
62 |
@TestElementMetadata(labelResource = "user_defined_variables") |
63 |
@TestElementMetadata(labelResource = "user_defined_variables") |
63 |
public class ArgumentsPanel extends AbstractConfigGui implements ActionListener { |
64 |
public class ArgumentsPanel extends AbstractConfigGui implements ActionListener { |
64 |
|
65 |
|
65 |
private static final long serialVersionUID = 240L; |
66 |
private static final long serialVersionUID = 241L; |
66 |
|
67 |
|
67 |
/** The title label for this component. */ |
68 |
/** The title label for this component. */ |
68 |
private JLabel tableLabel; |
69 |
private JLabel tableLabel; |
Lines 107-112
public class ArgumentsPanel extends AbstractConfigGui implements ActionListener
Link Here
|
107 |
/** Disable buttons :Detail, Add, Add from Clipboard, Delete, Up and Down*/ |
108 |
/** Disable buttons :Detail, Add, Add from Clipboard, Delete, Up and Down*/ |
108 |
private final boolean disableButtons; |
109 |
private final boolean disableButtons; |
109 |
|
110 |
|
|
|
111 |
private final Function<String[], Argument> argCreator; |
112 |
|
110 |
/** Command for adding a row to the table. */ |
113 |
/** Command for adding a row to the table. */ |
111 |
private static final String ADD = "add"; // $NON-NLS-1$ |
114 |
private static final String ADD = "add"; // $NON-NLS-1$ |
112 |
|
115 |
|
Lines 175-181
public class ArgumentsPanel extends AbstractConfigGui implements ActionListener
Link Here
|
175 |
* @param label the title for the component. |
178 |
* @param label the title for the component. |
176 |
*/ |
179 |
*/ |
177 |
public ArgumentsPanel(boolean disableButtons, String label) { |
180 |
public ArgumentsPanel(boolean disableButtons, String label) { |
178 |
this(label, null, false, false, null, disableButtons); |
181 |
this(label, null, false, false, null, disableButtons, null); |
179 |
} |
182 |
} |
180 |
|
183 |
|
181 |
/** |
184 |
/** |
Lines 195-201
public class ArgumentsPanel extends AbstractConfigGui implements ActionListener
Link Here
|
195 |
* @param standalone is standalone |
198 |
* @param standalone is standalone |
196 |
*/ |
199 |
*/ |
197 |
public ArgumentsPanel(String label, Color bkg, boolean enableUpDown, boolean standalone) { |
200 |
public ArgumentsPanel(String label, Color bkg, boolean enableUpDown, boolean standalone) { |
198 |
this(label, bkg, enableUpDown, standalone, null, false); |
201 |
this(label, bkg, enableUpDown, standalone, null, false, null); |
199 |
} |
202 |
} |
200 |
|
203 |
|
201 |
/** |
204 |
/** |
Lines 207-213
public class ArgumentsPanel extends AbstractConfigGui implements ActionListener
Link Here
|
207 |
* @param model the table model to use |
210 |
* @param model the table model to use |
208 |
*/ |
211 |
*/ |
209 |
public ArgumentsPanel(String label, Color bkg, boolean enableUpDown, boolean standalone, ObjectTableModel model) { |
212 |
public ArgumentsPanel(String label, Color bkg, boolean enableUpDown, boolean standalone, ObjectTableModel model) { |
210 |
this(label, bkg, enableUpDown, standalone, model, false); |
213 |
this(label, bkg, enableUpDown, standalone, model, null); |
|
|
214 |
} |
215 |
|
216 |
/** |
217 |
* Create a new ArgumentsPanel with a border and color background |
218 |
* @param label text for label |
219 |
* @param bkg background colour |
220 |
* @param enableUpDown Add up/down buttons |
221 |
* @param standalone is standalone |
222 |
* @param model the table model to use |
223 |
* @param argCreator function to create {@link Argument}s from Strings taken from clipboard |
224 |
*/ |
225 |
public ArgumentsPanel(String label, Color bkg, boolean enableUpDown, boolean standalone, ObjectTableModel model, Function<String[], Argument> argCreator) { |
226 |
this(label, bkg, enableUpDown, standalone, model, false, argCreator); |
211 |
} |
227 |
} |
212 |
|
228 |
|
213 |
/** |
229 |
/** |
Lines 220-231
public class ArgumentsPanel extends AbstractConfigGui implements ActionListener
Link Here
|
220 |
* @param disableButtons Remove all buttons |
236 |
* @param disableButtons Remove all buttons |
221 |
*/ |
237 |
*/ |
222 |
public ArgumentsPanel(String label, Color bkg, boolean enableUpDown, boolean standalone, ObjectTableModel model, boolean disableButtons) { |
238 |
public ArgumentsPanel(String label, Color bkg, boolean enableUpDown, boolean standalone, ObjectTableModel model, boolean disableButtons) { |
|
|
239 |
this(label, bkg, enableUpDown, standalone, model, disableButtons, null); |
240 |
} |
241 |
|
242 |
/** |
243 |
* Create a new ArgumentsPanel with a border and color background |
244 |
* @param label text for label |
245 |
* @param bkg background colour |
246 |
* @param enableUpDown Add up/down buttons |
247 |
* @param standalone is standalone |
248 |
* @param model the table model to use |
249 |
* @param disableButtons Remove all buttons |
250 |
* @param argCreator function to create {@link Argument}s from Strings taken from clipboard |
251 |
*/ |
252 |
public ArgumentsPanel(String label, Color bkg, boolean enableUpDown, boolean standalone, ObjectTableModel model, boolean disableButtons, Function<String[], Argument> argCreator) { |
223 |
tableLabel = new JLabel(label); |
253 |
tableLabel = new JLabel(label); |
224 |
this.enableUpDown = enableUpDown; |
254 |
this.enableUpDown = enableUpDown; |
225 |
this.disableButtons = disableButtons; |
255 |
this.disableButtons = disableButtons; |
226 |
this.background = bkg; |
256 |
this.background = bkg; |
227 |
this.standalone = standalone; |
257 |
this.standalone = standalone; |
228 |
this.tableModel = model; |
258 |
this.tableModel = model; |
|
|
259 |
this.argCreator = argCreator; |
229 |
init(); |
260 |
init(); |
230 |
} |
261 |
} |
231 |
|
262 |
|
Lines 584-589
public class ArgumentsPanel extends AbstractConfigGui implements ActionListener
Link Here
|
584 |
} |
615 |
} |
585 |
|
616 |
|
586 |
protected Argument createArgumentFromClipboard(String[] clipboardCols) { |
617 |
protected Argument createArgumentFromClipboard(String[] clipboardCols) { |
|
|
618 |
if (argCreator != null) { |
619 |
return argCreator.apply(clipboardCols); |
620 |
} |
587 |
Argument argument = makeNewArgument(); |
621 |
Argument argument = makeNewArgument(); |
588 |
argument.setName(clipboardCols[0]); |
622 |
argument.setName(clipboardCols[0]); |
589 |
if (clipboardCols.length > 1) { |
623 |
if (clipboardCols.length > 1) { |