2013-01-31 60 views
0

我需要添加一個splitPane textArea到我的Griffon應用程序。 我似乎無法找到適當的語法和方法來做到這一點的例子。griffon:添加一個splitPane到我的應用程序

任何人都可以幫我嗎?

這裏是我的觀點至今:

=================================== ==============================================

package test1 

import griffon.util.GriffonNameUtils as GNU 
import java.beans.PropertyChangeListener 

application(title: 'Test1', 
    //preferredSize: [600, 300], 
    pack: true, 
    locationByPlatform: true, 
    iconImage: imageIcon('/griffon-icon-48x48.png').image, 
    iconImages: [imageIcon('/griffon-icon-48x48.png').image, 
       imageIcon('/griffon-icon-32x32.png').image, 
       imageIcon('/griffon-icon-16x16.png').image]) {     

    borderLayout() 
    panel(constraints: WEST, 
      border: titledBorder(title: 'Platform')) { 
     migLayout() 
     buttonGroup(id: 'platform') 
     def radioButtonConverter = { String title, v -> v ? title : model.deviceType } 
     for (data in model.deviceTypes) { 
      radioButton(data.title, buttonGroup: platform, constraints: 'wrap', 
       selected: bind('deviceType', target: model, 
          converter: radioButtonConverter.curry(data.title), value: data.selected)) 
     } 
    } 

    panel(constraints: EAST, 
      border: titledBorder(title: 'Path Browser')) { 
     migLayout() 
     controller.griffonClass.actionNames.each { name -> 
      button(getVariable(name + 'Action'), 
       constraints: 'growx, wrap') 
     } 
    } 

    panel(constraints: CENTER, id: 'devicePanel', 
      border: titledBorder(id: 'devicePanelBorder', title: 'No Devices')) { 
     noparent { 
      model.addPropertyChangeListener('deviceType', { e -> 
       model.deviceTypes.each{ d-> d.selected = false } 
       model.deviceTypes.find{ d -> d.title == e.newValue }.selected = true 
       devicePanelBorder.title = e.newValue 
       devicePanel.layout.show(devicePanel, e.newValue) 
       devicePanel.repaint() // force redraw 
      } as PropertyChangeListener) 
     } 
     cardLayout() 
     for(data in model.deviceTypes) { 
      // we set the title as the page's constraints -> simplifies bookkeeping 
      // in the PropertyChangeListener registered above 
      panel(constraints: data.title) { 
       gridLayout(cols: 2, rows: (data.devices.size()/2)) 
       data.devices.each { device -> 
        checkBox(device.name, selected: bind(value: device.selected, target: device, 'selected')) 
       } 
      } 
     } 
    } 

    panel(constraints: SOUTH) { 
     riverLayout() 
     buttonGroup(id: 'execute', constraints: 'center') 
     button('Build XML', buttonGroup: execute) 
     button('Run', buttonGroup: execute) 
     button('Exit', buttonGroup: execute) 
    } 

    panel(constraints: NORTH) { 
     riverLayout() 
     label('TWC Companion Device Test Tool', constraints: 'center') 
    } 
} 

=============================================== =============================================

謝謝!

ironmantis7x

回答

1

由於使用splitPane由SwingPad(https://github.com/griffon/griffon/blob/master/src/dist/samples/SwingPad/griffon-app/views/griffon/samples/swingpad/SwingPadContent.groovy)所示很簡單,只要

splitPane(resizeWeight: 0.5f) { 
    label('Left component') 
    label('Right component') 
} 

看一看格里芬指南的視圖部分,詳細瞭解節點

http://griffon.codehaus.org/guide/latest/guide/views.html#specialNodes

以下鏈接指向可以與SwingBuilder一起使用的所有節點

http://groovy.codehaus.org/Swing+Builder

最後,您可以啓動SwingPad($ GRIFFON_HOME /樣品/ SwingPad),並與現場的節點發揮。此應用程序包括所有節點的列表(幫助 - >節點列表)以及非常基本的節點名稱完成功能。

相關問題