Skip to content

Commit 1b16f2d

Browse files
committed
scala: fixed combobox editor in a column configuration table
1 parent c0b256f commit 1b16f2d

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

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

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,22 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
8989
addRow("script output " + columnCounter, "String")
9090
}
9191
columnCounter += 1
92+
93+
val typeSelector =
94+
new ComboBox[String](Seq(
95+
"String",
96+
"Integer",
97+
"Double" )) {
98+
makeEditable
99+
}
100+
101+
override def editor(row: Int, column: Int) = {
102+
column match {
103+
case 1 => new DefaultCellEditor(
104+
typeSelector.peer.asInstanceOf[JComboBox[String]])
105+
case _ => null
106+
}
107+
}
92108
}
93109

94110
val outputPanel = new BoxPanel(Orientation.Vertical) {
@@ -134,13 +150,6 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
134150
layout(table) = BorderPanel.Position.Center
135151
}
136152
}
137-
val typeColumn = table.peer.getColumnModel.getColumn(1)
138-
val typeSelector: ComboBox[String] =
139-
new ComboBox[String](Seq("String", "Integer","Double")) {
140-
makeEditable
141-
}
142-
typeColumn.setCellEditor(new DefaultCellEditor(
143-
typeSelector.peer.asInstanceOf[JComboBox[String]]))
144153
addTab("Script Output", outputPanel.peer)
145154
}
146155

0 commit comments

Comments
 (0)