Skip to content

Commit 4ac6caf

Browse files
committed
added checking of duplicates at automatic column's names generation
1 parent 3cf1bb5 commit 4ac6caf

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

RubyScript/src/org/knime/ext/jruby/RubyScriptNodeDialog.java

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,25 @@ protected RubyScriptNodeDialog(RubyScriptNodeFactory factory) {
9999
private static final long serialVersionUID = -743704737927962277L;
100100

101101
public void actionPerformed(final ActionEvent e) {
102-
((ScriptNodeOutputColumnsTableModel) m_table.getModel()).addRow(
103-
"script output " + m_counter, "String");
104-
m_counter++;
102+
String name;
103+
ScriptNodeOutputColumnsTableModel model =
104+
((ScriptNodeOutputColumnsTableModel) m_table.getModel());
105+
String[] columns = model.getDataTableColumnNames();
106+
boolean found;
107+
108+
do {
109+
found = false;
110+
name = "script output " + m_counter;
111+
m_counter++;
112+
for(String s : columns){
113+
if (name.equals(s)) {
114+
found = true;
115+
break;
116+
}
117+
}
118+
} while (found);
119+
120+
model.addRow(name, "String");
105121
}
106122
});
107123
addButton.setText("Add Output Column");
@@ -217,10 +233,10 @@ public void actionPerformed(final ActionEvent e) {
217233
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
218234
spScript, m_sp_errorMessage);
219235
scriptMainPanel.add(splitPane, BorderLayout.CENTER);
220-
236+
221237
m_scriptPanel.add(scriptButtonPanel, BorderLayout.PAGE_START);
222238
m_scriptPanel.add(scriptMainPanel, BorderLayout.CENTER);
223-
239+
224240
addTab("Script Output", outputPanel);
225241
addTab("Script", m_scriptPanel, false);
226242
}

0 commit comments

Comments
 (0)