org.jminor.common.ui.valuemap
Class AbstractValueMapLink<K,V>
java.lang.Object
javax.swing.AbstractAction
org.jminor.common.ui.control.Control
org.jminor.common.ui.control.AbstractValueLink<ValueChangeMapEditModel<K,V>,V>
org.jminor.common.ui.valuemap.AbstractValueMapLink<K,V>
- Type Parameters:
K
- the type of the map keysV
- the type of the map values
- All Implemented Interfaces:
- ActionListener, Serializable, Cloneable, EventListener, Action
- Direct Known Subclasses:
- BooleanValueLink, ComboBoxValueLink, EntityUiUtil.LookupValueLink, TextValueLink, TristateValueLink
public abstract class AbstractValueMapLink<K,V>
- extends AbstractValueLink<ValueChangeMapEditModel<K,V>,V>
An abstract class for linking a UI component to a ValueChangeMapEditModel key value.
- See Also:
- Serialized Form
Fields 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 |
Methods inherited from class org.jminor.common.ui.control.Control |
getDescription, getEnabledState, getIcon, getMnemonic, getName, isEnabled, setDescription, setEnabled, setIcon, setKeyStroke, setMnemonic, setName |
AbstractValueMapLink
public AbstractValueMapLink(ValueChangeMapEditModel<K,V> editModel,
K key,
LinkType linkType)
- Parameters:
editModel
- the ValueChangeMapEditModel instancekey
- the key of the value to linklinkType
- the link type
getModelValue
public final V getModelValue()
-
- Specified by:
getModelValue
in class AbstractValueLink<ValueChangeMapEditModel<K,V>,V>
- Returns:
- the model value of the linked property
setModelValue
public final void setModelValue(V value)
- Sets the value in the model
- Specified by:
setModelValue
in class AbstractValueLink<ValueChangeMapEditModel<K,V>,V>
- Parameters:
value
- the value to set for property
isModelValueNull
protected final boolean isModelValueNull()
- Returns:
- true if the underlying model value associated with this key is null
isNullable
protected final boolean isNullable()
- Returns:
- true if this value is allowed to be null
getKey
protected final K getKey()
- Returns:
- the linked key
getValidationMessage
protected final String getValidationMessage(ValueChangeMapEditModel<K,V> editModel)
- If the current value is invalid this method should return a string describing the nature of
the invalidity, if the value is valid this method should return null
- Parameters:
editModel
- the underlying ValueChangeMapEditModel
- Returns:
- a validation string if the value is invalid, null otherwise
getEditModel
protected final ValueChangeMapEditModel<K,V> getEditModel()
- Returns:
- the value owner, in this case a ValueChangeMapEditor