WingsBuilder is a Groovy builder for the wingS Framework

Contribution Overview

You can use WingSBuilder in the same fashion as Swing Builder. Most of the constructs provided by the original SwingBuilder are supported in WingSBuilder, thanks to the efforts of the wingS team in following the Swing model very closely. WingSBuilder also supports wingS specific components and the ability to attach your own components through widget() and container().

The following is an example of WingSBuilder in action

class GuessingGame {
   GuessingGame(){
      def randomNr = (new Random().nextInt(10) + 1) as String
      def builder = new WingSBuilder()

      /* STitledBorder was removed in wings-3.1
      def border = SBorderFactory.createSTitledBorder(
                    SBorderFactory.createSLineBorder([0,0,255] as Color, 2),
                    "Guessing Game")
      */
      def border = SBorderFactory.createSLineBorder([0,0,255] as Color, 2)
      def font = new SFont( null, SFont.BOLD, 14 )

      def frame = builder.frame( title: "Guessing Game" ) {
         panel( border: border){
            gridLayout( columns: 1, rows: 5, vgap: 10)
            label("Hello World - this is wingS (+WingSBuilder&Groovy)!",
                  font: font)
            label("We want fun, so let's play a game!" +
                  "Try to guess a number between 1 and 10.")
            textField( id: "answer" )
            button( text: "Guess!", actionPerformed: { event ->
               def value = builder.answer.text
               if( value == randomNr ){
                  builder.message.text = "Congratulations! You guessed my number!"
               }else{
                  builder.message.text = "No - '${value}' is not the right number. Try again!"
               }
            })
            label( id: "message" )
         }
      }

      frame.visible = true
   }
}

Which is rendered in FireFox as


Team Members

Andres Almiray [aalmiray at users dot sourceforge dot net]

Download

wingsbuilder-1.0

Installing

Just drop the wingsbuilder jar file along with its dependencies into your weabpp's lib directory.

Pre-requisites

WingS 3.1 and Groovy 1.5 are required to run WingSBuilder.

Documentation

Alphabetical list of SwingBuilder compatible components

Element

Class

Notes

action

javax.swing.Action

same as SwingBuilder.action()

actions

Collection

same as SwingBuilder.actions()

bean

Object

same as SwingBuilder.bean()

borderLayout

SBorderLayout

 

boundedRangeModel

SDefaultBoundedRangeModel

 

boxLayout

SBoxLayout

 

button

SButton

 

buttonGroup

SButtonGroup

 

cardLayout

SCardLayout

 

checkbox

SCheckbox

 

closureColumn

DefaultTableColumn

same as SwingBuilder.closureColumn()

container

SComponent

placeholder for any SComponent

comboBox

SCombox

Obeys 'items' to populate model

dashedLineBorder

SBorder

 

desktopPane

SDesktopPane

 

dialog

SDialog

 

dottedLineBorder

SBorder

 

emptyBorder

SBorder

 

etchedBorder

SBorder

 

flowLayout

SFlowLayout

 

formattedTextField

SSormattedTextField

 

frame

SFrame

 

gbc

GridBagConstraints

same as SwingBuilder.gbc()

gridBagConstraints

GridBagConstraints

same as SwingBuilder.gridBagConstraints()

gridBagLayout

SGridBagLayout

 

gridLayout

SGridLayout

 

internalFrame

SInternalFrame

 

label

SLabel

 

lineBorder

SBorder

 

list

SList

 

loweredBeveldBorder

SBorder

 

loweredEtchedBorder

SBorder

 

menu

SMenu

 

menuBar

SMenuBar

 

menuItem

SMenuItem

 

map

java.util.Map

same as SwingBuilder.map()

optionPane

SOptionPane

 

panel

SPanel

 

passwordField

SPasswordField

 

popupMenu

SPopupMenu

 

progressBar

SProgressBar

 

propertyColumn

DefaultTableColumn

same as SwingBuilder.propertyColumn()

radioButton

SRadioButton

 

raisedBevelBorder

SBorder

 

raisedEtchedBorder

SBorder

 

scrollBar

SScrollBar

 

scrollPane

SScrollPane

 

separator

SSeparator

 

spinnerDateModel

SSpinnerDateModel

 

spinnerListModel

SSpinnerListModel

 

spinnerNumberModel

SSpinnerNumberModel

 

tabbedPane

STabbedPane

 

table

STable

 

tableModel

DefaultTableModel

same as SwingBuilder.tableModel()

tableColumn

STableColumn

 

textArea

STextArea

 

textField

STextField

 

toggleButton

SToggleButton

 

toolBar

SToolBar

 

tree

STree

 

widget

SComponent

placeholder for any SComponent

Alphabetical list of WingS specific components

Element

Class

Notes

anchor

SAnchor

 

byteArrayIcon

SByteArrayIcon

 

downloadButton

SDownloadButton

Must define 'resource' property at least<br/>
other construction properties are 'text' & 'icon'

fileChooser

SFileChooser

 

fileIcon

SFileIcon

Must define 'file' or 'filename' property at least<br/>
other construction properties are 'mimetype' & 'extension'

flowDownLayout

SFlowDownLayout

 

form

SForm

 

imageIcon

SImageIcon

 

nullLayout

SNullLayout

 

pageScroller

SPageScroller

 

pagingBoundedRangeModel

SPagingBoundedRangeModel

 

popup

SPopup

 

rawText

SRawTextComponent

 

resourceIcon

SResourceIcon

 

rootLayout

SRootLayout

 

spacer

SSpacer

Must define 'width' & 'height' properties

templateLayout

STemplateLayout

 

Alphabetical list of WingX specific components

Element

Class

Notes

calendar

XCalendar

 

division

XDivision

 

scrollablePanel

XScrollablePanel

 

suggest

XSuggest

 

treeTable

XTreeTable

 

xpageScroller

XPageScroller

 

xscrollPane

XScrollPane

 

xtable

XTable

 

Developers

Andres Almiray

Source Control

http://svn.codehaus.org/groovy-contrib/wingsbuilder

Building

WingSBuilder uses Maven2 as its build tool, which means that if you want to
build your own version of WingSBuilder from source you'll need to have it
installed.  Follow the instructions at http://maven.apache.org
Once Maven2 is installed you will also need to install 2 files from the wingS
distribution (but it wouldn't hurt to check at http://mvnrepository.org
if they are already there). The files are:

   wings-3.1.jar
   wingx-3.1.jar

If the files are not found in any Maven2 repository the you'll need to
download the source from http://wingsframework.org, follow the compile &
install instructions, the jars should be at build/web/WEB-INF/lib
Install them on your local Maven2 repo with the following command

 mvn install:installFile -DgroupId=org.wings -Dversion=3.1 -Dpackaging=jar \
     -DartifactId=<depname> -Dfile=<jarfile>

where 'depname' is any of [wings, wingx] with its corresponding jarfile

Contributing

Please contact the team members by e-mail.

Community

Mailing List(s)

http://groovy.codehaus.org/Mailing+Lists

Issue tracker

http://jira.codehaus.org/secure/BrowseProject.jspa?id=10242