Skip to content

Commit c6f0c8d

Browse files
committed
scala: continue swing to scala swing conversion
1 parent b7bd469 commit c6f0c8d

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

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

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ object RubyScriptNodeDialog {
6060
class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
6161
extends NodeDialogPane() {
6262

63-
private var scriptPanel: JPanel = _
63+
private var scriptPanel: BorderPanel = _
6464

6565
private var scriptTextArea: RSyntaxTextArea = _
6666

@@ -72,7 +72,7 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
7272

7373
private var columnCounter: Int = 1
7474

75-
private var doAppendInputColumns: JCheckBox = _
75+
private var doAppendInputColumns: CheckBox = _
7676

7777
private var columnTables: Array[JTable] = _
7878

@@ -99,8 +99,8 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
9999
val outputButtonPanel = new JPanel()
100100
val outputMainPanel = new JPanel(new BorderLayout())
101101
val newtableCBPanel = new JPanel()
102-
doAppendInputColumns = new JCheckBox("Append columns to input table spec")
103-
newtableCBPanel.add(doAppendInputColumns, BorderLayout.WEST)
102+
doAppendInputColumns = new CheckBox("Append columns to input table spec")
103+
newtableCBPanel.add(doAppendInputColumns.peer, BorderLayout.WEST)
104104
val addButton = new JButton("Add Output Column")
105105
addButton.addActionListener((_: ActionEvent) => {
106106
var name: String = null
@@ -196,8 +196,8 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
196196
errorMessage.font = font
197197
errorMessage.foreground = Color.RED
198198
errorMessage.editable = false
199-
scriptPanel = new JPanel(new BorderLayout())
200-
val scriptButtonPanel = new JPanel()
199+
scriptPanel = new BorderPanel()
200+
val scriptButtonPanel = new BorderPanel()
201201
val scriptButton = new JButton("Load Script from File")
202202
scriptButton.addActionListener((e: ActionEvent) => {
203203
val returnVal = fileChooser.showOpenDialog(
@@ -214,12 +214,12 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
214214
scriptTextArea.setText(file_content)
215215
clearErrorHighlight()
216216
})
217-
scriptButtonPanel.add(scriptButton)
218-
val scriptMainPanel = new JPanel(new BorderLayout())
219-
scriptMainPanel.add(new JLabel("Script: "), BorderLayout.NORTH)
217+
scriptButtonPanel.peer.add(scriptButton)
218+
val scriptMainPanel = new BorderPanel()
219+
scriptMainPanel.peer.add(new Label("Script: ").peer, BorderLayout.NORTH)
220220
var splitPane = new SplitPane(Orientation.Horizontal,
221221
swing.Component.wrap(spScript), spErrorMessage)
222-
scriptMainPanel.add(splitPane.peer, BorderLayout.CENTER)
222+
scriptMainPanel.peer.add(splitPane.peer, BorderLayout.CENTER)
223223
val num = factory.getModel.getInputPortRoles.length
224224
columnTables = Array.ofDim[JTable](num)
225225
val inputColumnsPanel = new BorderPanel()
@@ -236,10 +236,9 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
236236
- splitPane.peer.getInsets().bottom
237237
- splitPane.dividerSize - 50
238238

239-
scriptPanel.add(scriptButtonPanel, BorderLayout.PAGE_START)
240-
scriptPanel.add(scriptMainPanel, BorderLayout.CENTER)
241-
val config_and_sript = new SplitPane(Orientation.Vertical, splitPane,
242-
swing.Component.wrap(scriptPanel))
239+
scriptPanel.peer.add(scriptButtonPanel.peer, BorderLayout.PAGE_START)
240+
scriptPanel.peer.add(scriptMainPanel.peer, BorderLayout.CENTER)
241+
val config_and_sript = new SplitPane(Orientation.Vertical, splitPane, scriptPanel)
243242
config_and_sript.dividerLocation = 200
244243
addTab("Script", config_and_sript.peer, false)
245244
}
@@ -375,7 +374,7 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
375374
setSelected("Script")
376375
}
377376
val appendCols = settings.getBoolean(RubyScriptNodeModel.APPEND_COLS, true)
378-
doAppendInputColumns.setSelected(appendCols)
377+
doAppendInputColumns.selected = appendCols
379378
val dataTableColumnNames =
380379
settings.getStringArray(RubyScriptNodeModel.COLUMN_NAMES,
381380
Array[String]():_*)
@@ -407,8 +406,7 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
407406
throw new InvalidSettingsException("Please specify a script to be run.")
408407
}
409408
settings.addString(RubyScriptNodeModel.SCRIPT, scriptTextArea.getText)
410-
settings.addBoolean(RubyScriptNodeModel.APPEND_COLS,
411-
doAppendInputColumns.isSelected)
409+
settings.addBoolean(RubyScriptNodeModel.APPEND_COLS, doAppendInputColumns.selected)
412410
val columnNames = table.getDataTableColumnNames
413411
settings.addStringArray(RubyScriptNodeModel.COLUMN_NAMES, columnNames: _*)
414412
val columnTypes = table.getDataTableColumnTypes

0 commit comments

Comments
 (0)