@@ -39,6 +39,7 @@ import RubyScriptNodeDialog._
3939// remove if not needed
4040import scala .collection .JavaConversions ._
4141import scala .collection .convert .WrapAsScala .enumerationAsScalaIterator
42+ import scala .swing ._
4243
4344/**
4445 * <code>NodeDialog</code> for the "JRuby Script" Node.
@@ -63,9 +64,9 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
6364
6465 private var scriptTextArea : RSyntaxTextArea = _
6566
66- private var errorMessage : JTextArea = _
67+ private var errorMessage : TextArea = _
6768
68- private var spErrorMessage : JScrollPane = _
69+ private var spErrorMessage : ScrollPane = _
6970
7071 private var table : JTable = _
7172
@@ -183,18 +184,18 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
183184 * Ruby script etc.
184185 */
185186 private def createScriptTab () {
186- errorMessage = new JTextArea ()
187- spErrorMessage = new JScrollPane (errorMessage)
187+ errorMessage = new TextArea ()
188+ spErrorMessage = new ScrollPane (errorMessage)
188189 scriptTextArea = new RSyntaxTextArea ()
189190 scriptTextArea.setSyntaxEditingStyle(SyntaxConstants .SYNTAX_STYLE_RUBY )
190191 scriptTextArea.setCodeFoldingEnabled(true )
191192 scriptTextArea.setAntiAliasingEnabled(true )
192193 val spScript = new RTextScrollPane (scriptTextArea)
193194 spScript.setFoldIndicatorEnabled(true )
194195 val font = new Font (Font .MONOSPACED , Font .PLAIN , 12 )
195- errorMessage.setFont( font)
196- errorMessage.setForeground( Color .RED )
197- errorMessage.setEditable( false )
196+ errorMessage.font = font
197+ errorMessage.foreground = Color .RED
198+ errorMessage.editable = false
198199 scriptPanel = new JPanel (new BorderLayout ())
199200 val scriptButtonPanel = new JPanel ()
200201 val scriptButton = new JButton (" Load Script from File" )
@@ -216,29 +217,31 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
216217 scriptButtonPanel.add(scriptButton)
217218 val scriptMainPanel = new JPanel (new BorderLayout ())
218219 scriptMainPanel.add(new JLabel (" Script: " ), BorderLayout .NORTH )
219- var splitPane =
220- new JSplitPane ( JSplitPane . VERTICAL_SPLIT , spScript, spErrorMessage)
221- scriptMainPanel.add(splitPane, BorderLayout .CENTER )
220+ var splitPane = new SplitPane ( Orientation . Horizontal ,
221+ swing. Component .wrap( spScript) , spErrorMessage)
222+ scriptMainPanel.add(splitPane.peer , BorderLayout .CENTER )
222223 val num = factory.getModel.getInputPortRoles.length
223224 columnTables = Array .ofDim[JTable ](num)
224- val inputColumnsPanel = new JPanel ()
225- inputColumnsPanel.setLayout(
226- new BoxLayout (inputColumnsPanel, BoxLayout .PAGE_AXIS ))
227- if (num > 0 ) inputColumnsPanel.setMinimumSize( new Dimension (20 , 150 ) )
225+ val inputColumnsPanel = new BorderPanel ()
226+ inputColumnsPanel.peer. setLayout(
227+ new BoxLayout (inputColumnsPanel.peer , BoxLayout .PAGE_AXIS ))
228+ if (num > 0 ) inputColumnsPanel.minimumSize = new Dimension (20 , 150 )
228229 for (i <- 0 until num) {
229- inputColumnsPanel.add(addColumnPane(" Input[%d] columns: " .format(i), i))
230+ inputColumnsPanel.peer. add(addColumnPane(" Input[%d] columns: " .format(i), i).peer )
230231 }
231232 val flowVariablesPanel = addFlowVariablesPane(" Flow variables: " )
232- splitPane = new JSplitPane ( JSplitPane . VERTICAL_SPLIT ,
233+ splitPane = new SplitPane ( Orientation . Horizontal ,
233234 inputColumnsPanel, flowVariablesPanel)
234- splitPane.setDividerLocation(splitPane.getSize().height -
235- splitPane.getInsets().bottom - splitPane.getDividerSize - 50 )
235+ splitPane.dividerLocation = splitPane.size.height
236+ - splitPane.peer.getInsets().bottom
237+ - splitPane.dividerSize - 50
238+
236239 scriptPanel.add(scriptButtonPanel, BorderLayout .PAGE_START )
237240 scriptPanel.add(scriptMainPanel, BorderLayout .CENTER )
238- val config_and_sript = new JSplitPane ( JSplitPane . HORIZONTAL_SPLIT ,
239- splitPane, scriptPanel)
240- config_and_sript.setDividerLocation( 200 )
241- addTab(" Script" , config_and_sript, false )
241+ val config_and_sript = new SplitPane ( Orientation . Vertical , splitPane ,
242+ swing. Component .wrap( scriptPanel) )
243+ config_and_sript.dividerLocation = 200
244+ addTab(" Script" , config_and_sript.peer , false )
242245 }
243246
244247 /**
@@ -247,8 +250,8 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
247250 * @param list of columns
248251 * @return JPanel
249252 */
250- private def addColumnPane (label : String , index : Int ): JPanel = {
251- val panel = new JPanel ( new BorderLayout () )
253+ private def addColumnPane (label : String , index : Int ): Panel = {
254+ val panel = new BorderPanel ( )
252255 val table = new JTable ()
253256 table.putClientProperty(" terminateEditOnFocusLost" , true )
254257 table.setAutoscrolls(true )
@@ -288,8 +291,8 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
288291 }.init(index))
289292 val scrollPane = new JScrollPane (table)
290293 table.setFillsViewportHeight(true )
291- panel.add(new JLabel (label), BorderLayout .NORTH )
292- panel.add(scrollPane, BorderLayout .CENTER )
294+ panel.peer. add(new JLabel (label), BorderLayout .NORTH )
295+ panel.peer. add(scrollPane, BorderLayout .CENTER )
293296 columnTables(index) = table
294297 panel
295298 }
@@ -311,8 +314,8 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
311314 * @param label
312315 * @return JPanel
313316 */
314- private def addFlowVariablesPane (label : String ): JPanel = {
315- val flowVariablesPanel = new JPanel ( new BorderLayout () )
317+ private def addFlowVariablesPane (label : String ): Panel = {
318+ val flowVariablesPanel = new BorderPanel ( )
316319 val table = new JTable ()
317320 table.putClientProperty(" terminateEditOnFocusLost" , true )
318321 table.setAutoscrolls(true )
@@ -342,8 +345,8 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
342345 )
343346 val scrollPane = new JScrollPane (table)
344347 table.setFillsViewportHeight(true )
345- flowVariablesPanel.add(new JLabel (label), BorderLayout .NORTH )
346- flowVariablesPanel.add(scrollPane, BorderLayout .CENTER )
348+ flowVariablesPanel.peer. add(new JLabel (label), BorderLayout .NORTH )
349+ flowVariablesPanel.peer. add(scrollPane, BorderLayout .CENTER )
347350 flowVariablesPanel
348351 }
349352
@@ -367,8 +370,8 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
367370 outstr ++= error.text
368371 outstr ++= " \n line:\t class ( method )\t file\n "
369372 outstr ++= error.trace
370- errorMessage.setText( outstr.toString)
371- spErrorMessage.setVisible( true )
373+ errorMessage.text = outstr.toString
374+ spErrorMessage.visible = true
372375 setSelected(" Script" )
373376 }
374377 val appendCols = settings.getBoolean(RubyScriptNodeModel .APPEND_COLS , true )
@@ -417,8 +420,8 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
417420 */
418421 protected def clearErrorHighlight () {
419422 scriptTextArea.removeAllLineHighlights()
420- spErrorMessage.setVisible( false )
421- errorMessage.setText( " " )
423+ spErrorMessage.visible = false
424+ errorMessage.text = " "
422425 scriptPanel.revalidate()
423426 scriptPanel.repaint()
424427 }
0 commit comments