org.jminor.common.ui.valuemap
Class AbstractValueMapLink<K,V>

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by org.jminor.common.ui.control.Control
          extended by org.jminor.common.ui.control.AbstractValueLink<ValueChangeMapEditModel<K,V>,V>
              extended by org.jminor.common.ui.valuemap.AbstractValueMapLink<K,V>
Type Parameters:
K - the type of the map keys
V - 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

Field Summary
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
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
 
Constructor Summary
AbstractValueMapLink(ValueChangeMapEditModel<K,V> editModel, K key, LinkType linkType)
           
 
Method Summary
protected  ValueChangeMapEditModel<K,V> getEditModel()
           
protected  K getKey()
           
 V getModelValue()
          
protected  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
protected  boolean isModelValueNull()
           
protected  boolean isNullable()
           
 void setModelValue(V value)
          Sets the value in the model
 
Methods inherited from class org.jminor.common.ui.control.AbstractValueLink
actionPerformed, getLinkType, getUIValue, getValueOwner, setUIValue, updateModel, updateUI
 
Methods inherited from class org.jminor.common.ui.control.Control
getDescription, getEnabledState, getIcon, getMnemonic, getName, isEnabled, setDescription, setEnabled, setIcon, setKeyStroke, setMnemonic, setName
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, putValue, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractValueMapLink

public AbstractValueMapLink(ValueChangeMapEditModel<K,V> editModel,
                            K key,
                            LinkType linkType)
Parameters:
editModel - the ValueChangeMapEditModel instance
key - the key of the value to link
linkType - the link type
Method Detail

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