groovy

Automatic conversion of acceleratorKey in SwingBuilder

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Trivial Trivial
  • Resolution: Fixed
  • Affects Version/s: 1.0-beta-4
  • Fix Version/s: 1.0-beta-6
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    0

Description

In order to create an action with an accelerator key, it is necessary to pass it an javax.swing.KeyStroke. It would be more convinient if the action could receive a string and convert it to a KeyStroke automatically.

Currently:

action( name: "Exit",
keyStroke: new javax.swing.KeyStroke( "control X" ),
closure: { System.exit(0) }
)


After improvement:

action( name: "Exit",
keyStroke: "control X",
closure: { System.exit(0) }
)

Activity

Hide
Danno Ferrin added a comment -

Patch is in GROOVY-333.

Use "accelerator:" to add. If the object is a javax.swing.KeyStroke then it will be used literally. If it anything else, it will be toString()ed and passed through KeyStroke.getKeyStroke(string). Badly formatted values will result in no accelerator set, i.e. using non-lowe case for a modifier or lower case for the key.

Show
Danno Ferrin added a comment - Patch is in GROOVY-333. Use "accelerator:" to add. If the object is a javax.swing.KeyStroke then it will be used literally. If it anything else, it will be toString()ed and passed through KeyStroke.getKeyStroke(string). Badly formatted values will result in no accelerator set, i.e. using non-lowe case for a modifier or lower case for the key.
Hide
Guillaume Laforge added a comment -

Fixed by GROOVY-501

Show
Guillaume Laforge added a comment - Fixed by GROOVY-501

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
1m
Original Estimate - 1 minute
Remaining:
1m
Remaining Estimate - 1 minute
Logged:
Not Specified
Time Spent - Not Specified