org.jminor.common.ui.control
Class TextBeanValueLink

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by org.jminor.common.ui.control.Control
          extended by org.jminor.common.ui.control.AbstractValueLink<Object,Object>
              extended by org.jminor.common.ui.control.AbstractBeanValueLink
                  extended by org.jminor.common.ui.control.TextBeanValueLink
All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action, DocumentListener
Direct Known Subclasses:
DoubleBeanValueLink, FormattedTextBeanValueLink, IntBeanValueLink

public class TextBeanValueLink
extends AbstractBeanValueLink
implements DocumentListener

Binds a JTextComponent to a text based bean property.

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
TextBeanValueLink(JTextComponent textComponent, Object owner, String propertyName, Class<?> valueClass, EventObserver valueChangeEvent)
          Instantiates a new TextBeanValueLink.
TextBeanValueLink(JTextComponent textComponent, Object owner, String propertyName, Class<?> valueClass, EventObserver valueChangeEvent, LinkType linkType)
          Instantiates a new TextBeanValueLink.
 
Method Summary
 void changedUpdate(DocumentEvent e)
          
protected  String getText()
           
protected  Object getUIValue()
           
protected  String getValueAsString(Object value)
           
protected  void handleSetUIValue(Object value)
          Called after the values has been set in the UI
 void insertUpdate(DocumentEvent e)
          
 void removeUpdate(DocumentEvent e)
          
protected  void setUIValue(Object value)
          Sets the value in the UI
 
Methods inherited from class org.jminor.common.ui.control.AbstractBeanValueLink
getModelValue, getPropertyName, setModelValue
 
Methods inherited from class org.jminor.common.ui.control.AbstractValueLink
actionPerformed, getLinkType, getValueOwner, 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

TextBeanValueLink

public TextBeanValueLink(JTextComponent textComponent,
                         Object owner,
                         String propertyName,
                         Class<?> valueClass,
                         EventObserver valueChangeEvent)
Instantiates a new TextBeanValueLink.

Parameters:
textComponent - the text component to link with the value
owner - the value owner
propertyName - the property name
valueClass - the value class
valueChangeEvent - an EventObserver notified each time the value changes

TextBeanValueLink

public TextBeanValueLink(JTextComponent textComponent,
                         Object owner,
                         String propertyName,
                         Class<?> valueClass,
                         EventObserver valueChangeEvent,
                         LinkType linkType)
Instantiates a new TextBeanValueLink.

Parameters:
textComponent - the text component to link with the value
owner - the value owner
propertyName - the property name
valueClass - the value class
valueChangeEvent - an EventObserver notified each time the value changes
linkType - the link type
Method Detail

insertUpdate

public final void insertUpdate(DocumentEvent e)

Specified by:
insertUpdate in interface DocumentListener

removeUpdate

public final void removeUpdate(DocumentEvent e)

Specified by:
removeUpdate in interface DocumentListener

changedUpdate

public final void changedUpdate(DocumentEvent e)

Specified by:
changedUpdate in interface DocumentListener

getUIValue

protected Object getUIValue()
Specified by:
getUIValue in class AbstractValueLink<Object,Object>
Returns:
the value from the UI component

getValueAsString

protected String getValueAsString(Object value)
Parameters:
value - the value
Returns:
the value as a string

setUIValue

protected final void setUIValue(Object value)
Sets the value in the UI

Specified by:
setUIValue in class AbstractValueLink<Object,Object>
Parameters:
value - the value to represent in the UI

getText

protected final String getText()
Returns:
the from the input component

handleSetUIValue

protected void handleSetUIValue(Object value)
Called after the values has been set in the UI

Parameters:
value - the value