Interface DisableShortcutsOnFocusGainedComponent
-
- All Superinterfaces:
java.util.EventListener,java.awt.event.FocusListener
- All Known Implementing Classes:
DisableShortcutsOnFocusGainedTextField,FilterField
public interface DisableShortcutsOnFocusGainedComponent extends java.awt.event.FocusListener
An interface for components with code that can be used for disabling shortcuts while they hold focus.- Since:
- 18285 (code extracted for
DisableShortcutsOnFocusGainedTextField
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voiddisableMenuActions()Disables all relevant menu actions.default voidfocusGained(java.awt.event.FocusEvent e)default voidfocusLost(java.awt.event.FocusEvent e)java.util.Set<JosmAction>getDisabledMenuActions()Get the disabled menu action list This should not be used outside theDisableShortcutsOnFocusGainedComponentinterface.java.util.List<Pair<javax.swing.Action,Shortcut>>getUnregisteredActionShortcuts()Get the unregistered action shortcuts.default booleanhasToBeDisabled(javax.swing.KeyStroke ks)Returns true if the given shortcut has Shift modifier or no modifier and is not an actions key.static booleanisOnlyShift(int modifiers)Check if the modifiers is only shift Note: This was privatedefault voidrestoreActionShortcuts()Restore all action shortcuts previously unregistered Note: This was protecteddefault voidrestoreMenuActions()Restore all actions previously disabled Note: This was protecteddefault voidunregisterActionShortcuts()Unregisters all relevant action shortcuts.
-
-
-
Method Detail
-
focusGained
default void focusGained(java.awt.event.FocusEvent e)
- Specified by:
focusGainedin interfacejava.awt.event.FocusListener
-
focusLost
default void focusLost(java.awt.event.FocusEvent e)
- Specified by:
focusLostin interfacejava.awt.event.FocusListener
-
getUnregisteredActionShortcuts
java.util.List<Pair<javax.swing.Action,Shortcut>> getUnregisteredActionShortcuts()
Get the unregistered action shortcuts. This should not be used outside theDisableShortcutsOnFocusGainedComponentinterface.- Returns:
- The list of unregistered action shortcuts (modifiable)
-
getDisabledMenuActions
java.util.Set<JosmAction> getDisabledMenuActions()
Get the disabled menu action list This should not be used outside theDisableShortcutsOnFocusGainedComponentinterface.- Returns:
- The list of disabled menu actions (modifiable)
-
disableMenuActions
default void disableMenuActions()
Disables all relevant menu actions. Note: This was protected- See Also:
hasToBeDisabled(javax.swing.KeyStroke)
-
unregisterActionShortcuts
default void unregisterActionShortcuts()
Unregisters all relevant action shortcuts. Note: This was protected- See Also:
hasToBeDisabled(javax.swing.KeyStroke)
-
hasToBeDisabled
default boolean hasToBeDisabled(javax.swing.KeyStroke ks)
Returns true if the given shortcut has Shift modifier or no modifier and is not an actions key. Note: This was protected- Parameters:
ks- key stroke- Returns:
trueif the given shortcut has to be disabled- See Also:
KeyEvent.isActionKey()
-
isOnlyShift
static boolean isOnlyShift(int modifiers)
Check if the modifiers is only shift Note: This was private- Parameters:
modifiers- The modifiers to check- Returns:
trueif the only modifier isInputEvent.SHIFT_DOWN_MASK
-
restoreMenuActions
default void restoreMenuActions()
Restore all actions previously disabled Note: This was protected
-
restoreActionShortcuts
default void restoreActionShortcuts()
Restore all action shortcuts previously unregistered Note: This was protected
-
-