1111import java .awt .BorderLayout ;
1212import java .awt .Color ;
1313import java .awt .Component ;
14+ import java .awt .Dimension ;
1415import java .awt .Point ;
1516import java .awt .event .*;
1617import java .io .BufferedReader ;
@@ -69,7 +70,7 @@ public class RubyScriptNodeDialog extends NodeDialogPane {
6970 private JCheckBox m_appendColsCB ;
7071 private RubyScriptNodeFactory m_factory ;
7172
72- private JTable m_columnTable ;
73+ private JTable [] m_columnTables ;
7374
7475 /**
7576 * New pane for configuring ScriptedNode node dialog.
@@ -265,7 +266,17 @@ public void actionPerformed(final ActionEvent e) {
265266 scriptMainPanel .add (splitPane , BorderLayout .CENTER );
266267
267268 // add output column list
268- JPanel inputColumnsPanel = addColumnPane ("Input[0] columns: " );
269+ int num = m_factory .getModel ().getInputPortRoles ().length ;
270+ m_columnTables = new JTable [num ];
271+
272+ JPanel inputColumnsPanel = new JPanel ();
273+ inputColumnsPanel .setLayout (new BoxLayout (inputColumnsPanel , BoxLayout .PAGE_AXIS ));
274+ inputColumnsPanel .setMinimumSize (new Dimension (20 , 150 ));
275+
276+ for (int i = 0 ; i < num ; i ++) {
277+ inputColumnsPanel .add (addColumnPane (
278+ String .format ("Input[%d] columns: " , i ), i ));
279+ }
269280
270281 // add flow variables
271282 JPanel flowVariablesPanel = addFlowVariablesPane ("Flow variables: " );
@@ -298,7 +309,7 @@ public void actionPerformed(final ActionEvent e) {
298309 * @param list of columns
299310 * @return JPanel
300311 */
301- private final JPanel addColumnPane (String label ) {
312+ private final JPanel addColumnPane (String label , int index ) {
302313 JPanel panel = new JPanel (new BorderLayout ());
303314 JTable table = new JTable ();
304315 table .putClientProperty ("terminateEditOnFocusLost" , Boolean .TRUE );
@@ -320,19 +331,21 @@ private final JPanel addColumnPane(String label) {
320331 // inputColumnsPanel.add(m_inpputColumnsTable.getTableHeader(),
321332 // BorderLayout.PAGE_START);
322333 panel .add (scrollPane , BorderLayout .CENTER );
323- m_columnTable = table ;
334+ m_columnTables [ index ] = table ;
324335 return panel ;
325336 }
326337
327338 private final void updateColumnTable (final DataTableSpec [] specs ) {
328- if (specs != null && specs .length > 0 ) {
329- ScriptNodeOutputColumnsTableModel model =
330- (ScriptNodeOutputColumnsTableModel ) (m_columnTable .getModel ());
331- model .clearRows ();
332- for (Iterator <DataColumnSpec > item = specs [0 ].iterator (); item
333- .hasNext ();) {
334- DataColumnSpec spec = item .next ();
335- model .addRow (spec .getName (), spec .getType ().toString ());
339+ if (specs != null ) {
340+ for (int i = 0 ; i < specs .length ; i ++) {
341+ ScriptNodeOutputColumnsTableModel model =
342+ (ScriptNodeOutputColumnsTableModel ) (m_columnTables [i ].getModel ());
343+ model .clearRows ();
344+ for (Iterator <DataColumnSpec > item = specs [i ].iterator (); item
345+ .hasNext ();) {
346+ DataColumnSpec spec = item .next ();
347+ model .addRow (spec .getName (), spec .getType ().toString ());
348+ }
336349 }
337350 }
338351 }
0 commit comments