Button
A org.uqbar.arena.widgets.Button allows the user to trigger an action.
Bindings
Property onClick is mandatory, and you should define also a caption or image property.
Another properties
- It inherits the following properties from Control:
- enabled, visible & background (bindables)
- height / width (manually configured)
- And also inherits from Skinnable Control this properties:
- fontSize, foreground, background
- onClick(Action): Action can be defined by an inline block closure, or instantiating it
- image(Image)
- setAsDefault: sets the button as the default action of the view (by pressing the Enter key)
- disableOnError: when the view gets an exception the button disables itself until the next event
Examples
If we have an edition window with an "Ok" button, it is a good practice to set as a default action and disable it if view has an error.
// Xtend
new Button(actionsPanel) => [
caption = "Ok"
setAsDefault
onClick[ | convert ]
enabled <=> "canConvert"
disableOnError
]
// Java
new Button(actions)
.setCaption("Ok")
.onClick(this::convert)
.setAsDefault()
.disableOnError();
TO DO: Add a setImage() example for a button.
Link
A org.uqbar.arena.widgets.Link allows the user to define a link to an action.
Bindings
Property onClick and caption are mandatory. You can define a caption
- static (hard-coded)
- or dynamic using bindCaptionToProperty message
Properties
- enabled, visible & background (bindables)
- height, width, fontSize, foreground, background (manually configured)
Example
// Xtend
new Link(mainPanel) => [
caption = "Search"
onClick [ | modelObject.search ]
]
// Java
new Link(mainPanel)
.setCaption("Search")
.onClick( () -> this.modelObject.search() );
File Selector
A org.uqbar.arena.widgets.FileSelector allows the user to select a file using a Dialog Window.
Bindings
Property value is mandatory. When user clicks the button, a dialog is shown
![](../../images/fileSelectorOpen.png)
Properties
- title: title of the dialog window
- caption: the button label
- path: folder to browse when the dialog is opened
- extensions: file extensions (optional)
Example
/ Xtend
new FileSelector(actions) => [
caption = "Open"
value <=> "documentationFile"
extensions("*.example")
]
// Java
new FileSelector(actions)
.setCaption("Open")
.bindValueToProperty("documentationFile")
.extensions("*.example");
Then you'll bind a path (String) to the documentationFile property of your view model.