|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.richclient.command.config.CommandButtonLabelInfo
public final class CommandButtonLabelInfo
An immutable parameter object consisting of the text, mnemonic character, mnemonic character index and keystroke accelerator that may be associated with a labeled command button.
This class also acts as a factory for creating instances of itself based on a string descriptor.
The syntax used for this descriptor is described in the javadoc for the valueOf(String)
method.
LabelInfo
,
KeyStroke
Field Summary | |
---|---|
static CommandButtonLabelInfo |
BLANK_BUTTON_LABEL
A default instance to be used for command buttons with no label information. |
Constructor Summary | |
---|---|
CommandButtonLabelInfo(LabelInfo labelInfo,
KeyStroke accelerator)
Creates a new CommandButtonLabelInfo with the given label information and keystroke
accelerator. |
|
CommandButtonLabelInfo(String text)
Creates a new CommandButtonLabelInfo that will display the given text on its label. |
Method Summary | |
---|---|
AbstractButton |
configure(AbstractButton button)
Configures an existing button appropriately based on this label info's properties. |
protected void |
configureAccelerator(AbstractButton button,
KeyStroke keystrokeAccelerator)
Sets the given keystroke accelerator on the given button. |
boolean |
equals(Object obj)
|
KeyStroke |
getAccelerator()
Returns the keystroke accelerator for the label. |
int |
getMnemonic()
Returns the mnemonic for the label. |
int |
getMnemonicIndex()
Returns the zero-based index for the mnemonic character within the label text. |
String |
getText()
Returns the displayable text. |
int |
hashCode()
|
String |
toString()
|
static CommandButtonLabelInfo |
valueOf(String labelDescriptor)
Return an instance of this class, created by parsing the information in the given label descriptor string. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final CommandButtonLabelInfo BLANK_BUTTON_LABEL
Constructor Detail |
---|
public CommandButtonLabelInfo(String text)
CommandButtonLabelInfo
that will display the given text on its label.
There will be no associated mnemonic character and no keystroke accelerator.
text
- The label text to be displayed. Must not be null.
IllegalArgumentException
- if text
is null.public CommandButtonLabelInfo(LabelInfo labelInfo, KeyStroke accelerator)
CommandButtonLabelInfo
with the given label information and keystroke
accelerator.
labelInfo
- The label information. Must not be null.accelerator
- The keystroke accelerator. May be null.
IllegalArgumentException
- if labelInfo
is null.Method Detail |
---|
public static CommandButtonLabelInfo valueOf(String labelDescriptor)
LabelInfo
class, with the following additions:
KeyStroke.getKeyStroke(String)
method.
labelDescriptor
- The label descriptor. May be null or empty, in which case, a default
blank label info will be returned.
IllegalArgumentException
- if labelDescriptor
contains invalid syntax.LabelInfo
,
KeyStroke
public String getText()
public int getMnemonic()
public int getMnemonicIndex()
public KeyStroke getAccelerator()
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
public AbstractButton configure(AbstractButton button)
configure
in interface ButtonConfigurer
button
-
protected void configureAccelerator(AbstractButton button, KeyStroke keystrokeAccelerator)
button
- The button. May be null.keystrokeAccelerator
- The accelerator. May be null.public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |