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 void
disableMenuActions()
Disables all relevant menu actions.default void
focusGained(java.awt.event.FocusEvent e)
default void
focusLost(java.awt.event.FocusEvent e)
java.util.Set<JosmAction>
getDisabledMenuActions()
Get the disabled menu action list This should not be used outside theDisableShortcutsOnFocusGainedComponent
interface.java.util.List<Pair<javax.swing.Action,Shortcut>>
getUnregisteredActionShortcuts()
Get the unregistered action shortcuts.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.static boolean
isOnlyShift(int modifiers)
Check if the modifiers is only shift Note: This was privatedefault void
restoreActionShortcuts()
Restore all action shortcuts previously unregistered Note: This was protecteddefault void
restoreMenuActions()
Restore all actions previously disabled Note: This was protecteddefault void
unregisterActionShortcuts()
Unregisters all relevant action shortcuts.
-
-
-
Method Detail
-
focusGained
default void focusGained(java.awt.event.FocusEvent e)
- Specified by:
focusGained
in interfacejava.awt.event.FocusListener
-
focusLost
default void focusLost(java.awt.event.FocusEvent e)
- Specified by:
focusLost
in 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 theDisableShortcutsOnFocusGainedComponent
interface.- 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 theDisableShortcutsOnFocusGainedComponent
interface.- 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:
true
if 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:
true
if 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
-
-