public interface MnemonicTrait<O extends OutputManager<?>>
The idea is to have the common logic implemented in the interface as default methods and
free up the widgets from having to duplicate code. The widgets only have to implement two
methods getMnemonic()
and setMnemonic(MnemonicInfo)
to handle state.
Modifier and Type | Method and Description |
---|---|
default MnemonicInfo |
createMnemonic()
Creates new
MnemonicInfo instance. |
default MnemonicInfo |
getColumnMnemonic()
Column
MnemonicInfo instance getter. |
MnemonicInfo |
getMnemonic()
MnemonicInfo instance getter. |
default java.util.Optional<java.lang.Character> |
getMnemonicCharacter(boolean columnMnemonic)
Returns the mnemonic character from the processed widget label.
|
default java.util.Optional<java.lang.Integer> |
getMnemonicKeyCode(boolean columnMnemonic,
boolean alt)
Returns the associated key code for this mnemonic character.
|
default java.util.Optional<java.lang.String> |
getMnemonicLabel(boolean columnMnemonic)
Returns the preprocessed mnemonic label, i.e.
|
default boolean |
isMnemonicSupported()
Check whether this instance supports mnemonics.
|
default void |
setColumnMnemonic(MnemonicInfo mnemonic)
Column
MnemonicInfo instance setter. |
void |
setMnemonic(MnemonicInfo mnemonic)
MnemonicInfo instance setter. |
default void |
updateMnemonic(java.lang.String oldLabel,
java.lang.String newLabel,
boolean columnMnemonic)
Updates the mnemonic label.
|
default boolean isMnemonicSupported()
true
if this widget supports mnemonic.default MnemonicInfo createMnemonic()
MnemonicInfo
instance.default void updateMnemonic(java.lang.String oldLabel, java.lang.String newLabel, boolean columnMnemonic)
oldLabel
differs from newLabel
. To force the label to be updated pass
null
in oldLabel
.oldLabel
- The widget label being changed.newLabel
- The new label widget.columnMnemonic
- Indicates whether the regular or column mnemonic should be updated.default java.util.Optional<java.lang.String> getMnemonicLabel(boolean columnMnemonic)
columnMnemonic
- Indicates whether the label for regular or column mnemonic should be returned.default java.util.Optional<java.lang.Character> getMnemonicCharacter(boolean columnMnemonic)
columnMnemonic
- Indicates whether the character for regular or column mnemonic should be returned.default java.util.Optional<java.lang.Integer> getMnemonicKeyCode(boolean columnMnemonic, boolean alt)
columnMnemonic
- Indicates whether the character for regular or column mnemonic should be returned.alt
- Indicates if the key combination includes ALT+character or the character alone.MnemonicInfo getMnemonic()
MnemonicInfo
instance getter.
The implementors should simply return the value of the mnemonic class field. No additional processing logic in the implemented method is advised.
void setMnemonic(MnemonicInfo mnemonic)
MnemonicInfo
instance setter.
The implementors should simply assign the parameter value to the mnemonic class field. No additional processing logic in the implemented method is advised.
default MnemonicInfo getColumnMnemonic()
MnemonicInfo
instance getter.
The implementors should simply return the value of the mnemonic class field. No additional processing logic in the implemented method is advised.
The method will return a valid value when the implementing widget supports column label.
default void setColumnMnemonic(MnemonicInfo mnemonic)
MnemonicInfo
instance setter.
The implementors should simply assign the parameter value to the mnemonic class field. No additional processing logic in the implemented method is advised.