Class OrientationAction
java.lang.Object
javax.swing.AbstractAction
org.openstreetmap.josm.gui.widgets.OrientationAction
- All Implemented Interfaces:
ActionListener,PropertyChangeListener,Serializable,Cloneable,EventListener,Action
An action that toggles text orientation.
- Since:
- 18221
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ComponentDefault forLOCALIZED_KEYSDefault forRTL_LANGUAGESprivate ImageIconprivate ImageIconprivate static final Patternstatic final ListPropertyKeys whose values are localized Regex fractions are allowed.protected static final Patternprivate static final Stringstatic final ListPropertyLanguage codes of languages that are right-to-leftFields inherited from class javax.swing.AbstractAction
changeSupport, enabledFields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprivate static Patternstatic ComponentOrientationReturns the default component orientation by the user's localestatic ComponentOrientationReturns the text orientation of the value for the given key.static KeyStrokeReturns the shortcut key to assign to this action.static ComponentOrientationReturns the text orientation of the value for the given key.voidvoidUpdates the text and the icon.Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
Field Details
-
DEFAULT_RTL_LANGUAGES
Default forRTL_LANGUAGES -
DEFAULT_LOCALIZED_KEYS
Default forLOCALIZED_KEYS -
RTL_LANGUAGES
Language codes of languages that are right-to-left- See Also:
-
LOCALIZED_KEYS
Keys whose values are localized Regex fractions are allowed. The items will be merged into a regular expression.- See Also:
-
LANG_PATTERN
-
NEW_STATE
- See Also:
-
component
-
iconRTL
-
iconLTR
-
RTLLanguages
-
localizedKeys
-
-
Constructor Details
-
OrientationAction
Constructs a newOrientationAction.- Parameters:
component- The component to toggle
-
-
Method Details
-
actionPerformed
- Specified by:
actionPerformedin interfaceActionListener
-
updateState
Updates the text and the icon. -
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener
-
getShortcutKey
Returns the shortcut key to assign to this action.- Returns:
- the shortcut key
-
getDefaultComponentOrientation
Returns the default component orientation by the user's locale- Returns:
- the default component orientation
-
getValueOrientation
Returns the text orientation of the value for the given key. This is intended for Preset Dialog comboboxes. The choices in the dropdown list are typically translated. Ideally the user needs not see the English value. The algorithm is as follows:- If the key has an explicit language suffix, return the text orientation for that language.
- Else return the text orientation of the user's locale.
rtl-languages.- Parameters:
key- the key- Returns:
- the text orientation of the value
-
getNamelikeOrientation
Returns the text orientation of the value for the given key. This expansion ofgetValueOrientation(java.lang.String)is intended for Preset Dialog textfields and for the Add Tag and Edit Tag dialog comboboxes. The algorithm is as follows:- If the key has an explicit language suffix, return the text orientation for that language.
- If the key is usually localized, return the text orientation of the user's locale.
- Else return left to right.
localized-keys. You can configure which languages are RTL with the list property:rtl-languages.- Parameters:
key- the key- Returns:
- the text orientation of the value
-
compileLocalizedKeys
-