com.guiseframework.component
Class Table.DefaultCellValueModel<C>

java.lang.Object
  extended by com.globalmentor.beans.BoundPropertyObject
      extended by com.guiseframework.model.AbstractModel
          extended by com.guiseframework.model.AbstractValueModel<V>
              extended by com.guiseframework.model.DefaultValueModel<C>
                  extended by com.guiseframework.component.Table.DefaultCellValueModel<C>
Type Parameters:
C - The type of value in the cell.
All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, Model, Valued<C>, ValueModel<C>
Enclosing class:
Table

public static class Table.DefaultCellValueModel<C>
extends DefaultValueModel<C>

A value model that returns and updates a the value of the cell.

Author:
Garret Wilson

Field Summary
 
Fields inherited from class com.globalmentor.beans.BoundPropertyObject
NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS
 
Fields inherited from interface com.guiseframework.model.ValueModel
VALIDATOR_PROPERTY, VALUE_PROPERTY
 
Fields inherited from interface com.guiseframework.model.Model
PLAIN_TEXT_CONTENT_TYPE, XHTML_CONTENT_TYPE, XHTML_FRAGMENT_CONTENT_TYPE
 
Constructor Summary
Table.DefaultCellValueModel(TableModel model, TableModel.Cell<C> cell)
          Constructs a default value model for a cell.
 
Method Summary
protected  TableModel.Cell<C> getCell()
           
protected  TableModel getModel()
           
 Validator<C> getValidator()
           
 C getValue()
           
 void resetValue()
          Resets the value to a default value, which may be invalid according to any installed validators.
 void setValidator(Validator<C> newValidator)
          Sets the validator.
 void setValue(C newValue)
          Sets the value in the cell.
 
Methods inherited from class com.guiseframework.model.DefaultValueModel
clearValue, getDefaultValue
 
Methods inherited from class com.guiseframework.model.AbstractValueModel
createPropertyVetoException, getValueClass, isValidValue, validateValue
 
Methods inherited from class com.guiseframework.model.AbstractModel
getEventListenerManager, getPlainText
 
Methods inherited from class com.globalmentor.beans.BoundPropertyObject
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPostponedPropertyChangeEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getForwardPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getRepeatPropertyChangeListener, getRepeatVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, getVetoableChangeSupport, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.globalmentor.beans.PropertyBindable
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from interface com.globalmentor.beans.PropertyConstrainable
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, hasVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
 

Constructor Detail

Table.DefaultCellValueModel

public Table.DefaultCellValueModel(TableModel model,
                                   TableModel.Cell<C> cell)
Constructs a default value model for a cell.

Parameters:
model - The table model of the cell.
cell - The cell being represented.
Throws:
java.lang.NullPointerException - if the given table model and/or cell is null.
Method Detail

getModel

protected TableModel getModel()
Returns:
The table model of the cell.

getCell

protected TableModel.Cell<C> getCell()
Returns:
The cell being represented

getValidator

public Validator<C> getValidator()
Specified by:
getValidator in interface ValueModel<C>
Overrides:
getValidator in class AbstractValueModel<C>
Returns:
The validator for this model, or null if no validator is installed.

setValidator

public void setValidator(Validator<C> newValidator)
Sets the validator.

Specified by:
setValidator in interface ValueModel<C>
Overrides:
setValidator in class AbstractValueModel<C>
Parameters:
newValidator - The validator for this model, or null if no validator should be used.
See Also:
ValueModel.VALIDATOR_PROPERTY

getValue

public C getValue()
Specified by:
getValue in interface Valued<C>
Specified by:
getValue in interface ValueModel<C>
Overrides:
getValue in class DefaultValueModel<C>
Returns:
The value from the table model cell, or null if there is no value in the cell.

setValue

public void setValue(C newValue)
              throws java.beans.PropertyVetoException
Sets the value in the cell. If the value change is vetoed by the installed validator, the validation exception will be accessible via Throwable.getCause().

Specified by:
setValue in interface Valued<C>
Specified by:
setValue in interface ValueModel<C>
Overrides:
setValue in class DefaultValueModel<C>
Parameters:
newValue - The new value of the cell.
Throws:
java.beans.PropertyVetoException - if the provided value is not valid or the change has otherwise been vetoed.
See Also:
getValidator(), ValueModel.VALUE_PROPERTY

resetValue

public void resetValue()
Resets the value to a default value, which may be invalid according to any installed validators. No validation occurs.

Specified by:
resetValue in interface ValueModel<C>
Overrides:
resetValue in class DefaultValueModel<C>
See Also:
ValueModel.VALUE_PROPERTY


Copyright © 2005-2010 GlobalMentor, Inc. All Rights Reserved.