Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.0-beta-4
-
Fix Version/s: 1.0-beta-6
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
Currently in SwingBuilder it is not possible to create an action object in SwingBuilder without assigning it to a parent. This make it more difficult to create an action and assign it to multiple widgets. Currently, it can somewhat awkwardly like this:
builder.frame() {
actions = [:]
menuBar() {
menu( text: "File" ) {
actions.exit = menuItem( action(name: "Exit",
closure:
)
)
}
}
button( action: actions.exit )
}
The problem is the form is less clear and requires you to create this map object. It might be nicer to have a section in the builder where actions are declared seperately and stored referred to by variable names:
builder.frame() {
// Action Section
exit = action( name:"Exit", closure:
)
// Menu Section
menuBar() {
menu( text:"File" )
}
// Content
button( action: exit )
}
Patch for groovy.swing.SwingBuilder