MacWidgetsBuilder is a Groovy builder for the open source MacWidgets Swing component suite

Description

Mac Widgets for Java are a collection of widgets seen in OS X applications, offered in a Java API. These widgets help Java developers create more Mac-like applications. There usage is not restricted to Mac though, as they will render across platforms. This builder follows the same principles as SwingBuilder and can be combined with other SwingBuilder based builders or used in a standalone fashion.

Download

macwidgetsbuilder-0.5

Installing

Drop macwidgetsbuilder-0.5 into $GROOVY_HOME/lib along with its dependencies

Maven

    <repository>
      <id>codehaus-release</id>
      <name>Codehaus</name>
      <url>http://repository.codehaus.org</url>
    </repository>
    <repository>
      <id>sonatype-release</id>
      <name>Sonatype</name>
      <url>http://repository.sonatype.org/content/groups/public</url>
    </repository>

  <dependency>
    <groupId>org.codehaus.griffon</groupId>
    <artifactId>macwidgetsbuilder</artifactId>
    <version>0.5</version>
  </dependency>

Gradle

repositories {
    mavenRepo name: 'Codehaus', urls: 'http://repository.codehaus.org'
    mavenRepo name: 'Sonatype', urls: 'http://repository.sonatype.org/content/groups/public'
}

dependencies {
    compile 'org.codehaus.griffon:macwidgetsbuilder:0.5'
}

All these dependencies can be downloaded from this directory too.

MacWidgets and MacWidgetsBuilder require Jdk5 to be installed.

Pre-requisites

Groovy 1.8.6 is the required minimum version to run MacWidgetsBuilder 0.5
It is recommended that you upgrade to the 1.8.x series in order to take advantage of

Documentation

These are the nodes currently supported by MacWidgetsBuilder 0.5, they are listed in alphabetic order according the group that contains them. Component groups are a good way to organize nodes, they also serve another purpose when used with Griffon's CompositeBuilder.

The following table summarizes the properties required by the node factories, there are other properties that can be set on the built nodes, for example all buttons inherit properties from javax.swing.AbstractButton.

MacWidgets

 

 

 

 

 

 

Node

Property

Type

Default

Required

Bindable

Notes

bottomBar
[TriAreaComponent]

size

BottomBarSize

BottomBarSize.SMALL

(error)

(error)

 

 

locationOnBar

int

 

(tick)

(error)

one of SwingConstants.[LEFT,CENTER,RIGHT] or its literal equivalent. Must be specified on children elements.

 

spacer

int

 

(error)

(error)

Add a spacer to the right. Must be specified on children elements.

componentStatusBar
[ComponentBottomBar]

locationOnBar

int

 

(tick)

(error)

one of SwingConstants.[LEFT,CENTER,RIGHT] or its literal equivalent. Must be specified on children elements.

componentTopBar
[ComponentTopBar]

locationOnBar

int

 

(tick)

(error)

one of SwingConstants.[LEFT,CENTER,RIGHT] or its literal equivalent. Must be specified on children elements.

 

spacer

int

 

(error)

(error)

Add a spacer to the right. Must be specified on children elements.

emphasizedLabel
[JLabel]

text

String

 

(tick)

(error)

may also specify a JLabel or a String as value.

 

focusedColor

Color

 

(error)

(error)

must set two other color properties.

 

unfocusedColor

Color

 

(error)

(error)

must set two other color properties.

 

emphasisColor

Color

 

(error)

(error)

must set two other color properties.

hudWindow
[HudWindow]

 

 

 

 

 

proxies all properties that can be set on a JFrame.

hudLabel
[JLabel]

 

 

 

 

 

nest it inside hudWindow.
must specify a String as value

hudButton
[JButton]

 

 

 

 

 

nest it inside hudWindow.
must specify a String as value

hudTextField
[JTextField]

 

 

 

 

 

nest it inside hudWindow.
must specify a String as value

hudCheckBox
[JcheckBox]

 

 

 

 

 

nest it inside hudWindow.
must specify a String as value

hudComboBox
[JComboBox]

 

 

 

 

 

nest it inside hudWindow.
must specify a List or a ComboBoxModel as value

iappScrollPane
[JSplitPane]

 

 

 

 

 

same as a SwingBuilder.splitPane but with a custom UI.

imageButton
[ImageButton]

url

URL

 

(tick)

(error)

 

 

file

File

 

(tick)

(error)

can also be a String

 

inputStream

InputStream

 

(tick)

(error)

 

 

resource

String

 

(tick)

(error)

 

 

class

Class

 

(tick)

(error)

only required if resource is specified.

 

mask

Icon

 

(error)

(error)

 

 

 

 

 

 

 

specify one of url, file, inputStream, resource or use a String as node value.

itunesTable
[JTable]

 

 

 

 

 

same as SwingBuilder.table but with a custom UI.

labeledComponentGroup
[LabeledComponentGroup]

text

String

 

(tick)

(tick)

alternatively specify a String as value.

 

label

String

 

(tick)

(tick)

alias for text

macGradientButton
[JComponent]

url

URL

 

(tick)

(error)

 

 

file

File

 

(tick)

(error)

can also be a String

 

inputStream

InputStream

 

(tick)

(error)

 

 

resource

String

 

(tick)

(error)

 

 

class

Class

 

(tick)

(error)

only required if resource is specified.

 

icon

Icon

 

(tick)

(error)

 

 

actionListener

ActionListener

 

(error)

(error)

 

 

actionPerformed

Closure

 

(error)

(error)

alternative to actionListener

 

 

 

 

 

 

specify one of url, file, inputStream, resource, icon or use a String as node value.

macGradientPopdownButton
[JComponent]

url

URL

 

(tick)

(error)

 

 

file

File

 

(tick)

(error)

can also be a String

 

inputStream

InputStream

 

(tick)

(error)

 

 

resource

String

 

(tick)

(error)

 

 

class

Class

 

(tick)

(error)

only required if resource is specified.

 

icon

Icon

 

(tick)

(error)

 

 

popupMenuCustomizer

PopupMenuCustomizer

 

(error)

(error)

 

 

customizePopup

Closure

 

(error)

(error)

alternative to popupMenuCustomizer

 

 

 

 

 

 

specify one of url, file, inputStream, resource, icon or use a String as node value.

macButtonAddItem16
[JButton]

segmentedPosition

String

 

(error)

(error)

 

macButtonAddItem18
[JButton]

segmentedPosition

String

 

(error)

(error)

 

macButtonRemoveItem16
[JButton]

segmentedPosition

String

 

(error)

(error)

 

macButtonRemoveItem18
[JButton]

segmentedPosition

String

 

(error)

(error)

 

macButtonLock
[JButton]

segmentedPosition

String

 

(error)

(error)

 

macButtonSourceViewNormal
[JToggleButton]

segmentedPosition

String

 

(error)

(error)

 

preferencesTab
[]

url

URL

 

(tick)

(error)

 

 

file

File

 

(tick)

(error)

can also be a String

 

inputStream

InputStream

 

(tick)

(error)

 

 

resource

String

 

(tick)

(error)

 

 

class

Class

 

(tick)

(error)

only required if resource is specified.

 

icon

Icon

 

(tick)

(error)

 

 

text

String

 

(tick)

(error)

 

 

actionListener

ActionListener

 

(error)

(error)

 

 

actionPerformed

Closure

 

(error)

(error)

alternative to actionListener

 

 

 

 

 

 

specify one of url, file, inputStream, resource, icon or use a String as node value.

preferencesTabBar
[PreferencesTabBar]

unified

boolean

false

(error)

(error)

 

sourceList
[SourceList]

sourceListCategoryClicked

Closure

 

(error)

(error)

will promote it to a SourceListClickListener.

 

sourceListItemClicked

Closure

 

(error)

(error)

will promote it to a SourceListClickListener.

 

sourceListItemSelected

Closure

 

(error)

(error)

will promote it to a SourceListClickSelected.

sourceListCategory
[SourceListCategory]

 

 

 

 

 

value must be a String.

sourceListItem
[SourceListItem]

url

URL

 

(tick)

(error)

 

 

file

File

 

(tick)

(error)

can also be a String

 

inputStream

InputStream

 

(tick)

(error)

 

 

resource

String

 

(tick)

(error)

 

 

class

Class

 

(tick)

(error)

only required if resource is specified.

 

icon

Icon

 

(tick)

(error)

 

 

text

String

 

(tick)

(error)

 

 

 

 

 

 

 

specify one of url, file, inputStream, resource, icon or use a String as node value.

sourceListControlBar
[SourceListControlBar]

 

 

 

 

 

 

sourceListSplitPane
[splitPane]

 

 

 

 

 

requires a sourceList and another component as children.

sourceListContextMenuProvider
[SourceListContextMenuProvider]

listContextMenu

Closure

 

(error)

(error)

must specify as a child closure. Accepts a popup as arg.

 

categoryContextMenu

Closure

 

(error)

(error)

must specify as a child closure. Accepts popup, category as args.

 

itemContextMenu

Closure

 

(error)

(error)

must specify as a child closure. Accepts popup, item as args.

controlBarButton
[SourceListControlBarButton]

url

URL

 

(tick)

(error)

 

 

file

File

 

(tick)

(error)

can also be a String

 

inputStream

InputStream

 

(tick)

(error)

 

 

resource

String

 

(tick)

(error)

 

 

class

Class

 

(tick)

(error)

only required if resource is specified.

 

icon

Icon

 

(tick)

(error)

 

 

actionListener

ActionListener

 

(error)

(error)

 

 

actionPerformed

Closure

 

(error)

(error)

alternative to actionListener

 

 

 

 

 

 

specify one of url, file, inputStream, resource, icon or use a String as node value.

controlBarPopdownButton
[SourceListControlBarPopdownButton]

url

URL

 

(tick)

(error)

 

 

file

File

 

(tick)

(error)

can also be a String

 

inputStream

InputStream

 

(tick)

(error)

 

 

resource

String

 

(tick)

(error)

 

 

class

Class

 

(tick)

(error)

only required if resource is specified.

 

icon

Icon

 

(tick)

(error)

 

 

popupMenuCustomizer

PopupMenuCustomizer

 

(error)

(error)

 

 

customizePopup

Closure

 

(error)

(error)

alternative to popupMenuCustomizer

 

 

 

 

 

 

specify one of url, file, inputStream, resource, icon or use a String as node value.

spacer
[JLabel]

width

int

0

(error)

(tick)

 

 

height

int

0

(error)

(tick)

 

unifiedToolBar
[TriAreaComponent]

locationOnBar

int

 

(tick)

(error)

one of SwingConstants.[LEFT,CENTER,RIGHT] or its literal equivalent. Must be specified on children elements.

 

spacer

int

 

(error)

(error)

Add a spacer to the right. Must be specified on children elements.

preferencesBarButton
[AbstractButton]

url

URL

 

(tick)

(error)

 

 

file

File

 

(tick)

(error)

can also be a String

 

inputStream

InputStream

 

(tick)

(error)

 

 

resource

String

 

(tick)

(error)

 

 

class

Class

 

(tick)

(error)

only required if resource is specified.

 

icon

Icon

 

(tick)

(error)

 

 

button

AbstractButton

 

(tick)

(error)

 

 

actionListener

ActionListener

 

(error)

(error)

 

 

actionPerformed

Closure

 

(error)

(error)

alternative to actionListener

 

 

 

 

 

 

specify one of url, file, inputStream, resource, icon, button or use a String as node value.

unifiedToolBarButton
[AbstractButton]

url

URL

 

(tick)

(error)

 

 

file

File

 

(tick)

(error)

can also be a String

 

inputStream

InputStream

 

(tick)

(error)

 

 

resource

String

 

(tick)

(error)

 

 

class

Class

 

(tick)

(error)

only required if resource is specified.

 

icon

Icon

 

(tick)

(error)

 

 

button

AbstractButton

 

(tick)

(error)

 

 

actionListener

ActionListener

 

(error)

(error)

 

 

actionPerformed

Closure

 

(error)

(error)

alternative to actionListener

 

 

 

 

 

 

specify one of url, file, inputStream, resource, icon, button or use a String as node value.

The following properties are now enabled to every Window/JFrame

installRepaintListener

boolean

useful for SourceLists and ITunesTable to properly update their visible state.

makeLeopardStyle

boolean

make your JFrame look native.

Developers

Andres Almiray

Source Control

https://github.com/griffon/macwidgetsbuilder

Building

MAcwidgetsBuilder uses Gradle as its build tool.

Contributing

Please contact the Griffon team members by e-mail.

Mailing List(s)

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

Issue tracker

http://jira.codehaus.org/browse/GRIFFON