Package io.guise.framework.component
Class Table.DefaultCellValueModel<C>
- java.lang.Object
-
- com.globalmentor.beans.BoundPropertyObject
-
- io.guise.framework.model.AbstractModel
-
- io.guise.framework.model.AbstractValueModel<V>
-
- io.guise.framework.model.DefaultValueModel<C>
-
- io.guise.framework.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
,com.globalmentor.model.MutableValued<C>
,com.globalmentor.model.Valued<C>
,Model
,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 io.guise.framework.model.ValueModel
VALIDATOR_PROPERTY, VALUE_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description DefaultCellValueModel(TableModel model, TableModel.Cell<C> cell)
Constructs a default value model for a cell.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 new value.-
Methods inherited from class io.guise.framework.model.DefaultValueModel
clearValue, getDefaultValue
-
Methods inherited from class io.guise.framework.model.AbstractValueModel
createPropertyVetoException, getValueClass, isValidValue, validateValue
-
Methods inherited from class io.guise.framework.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
-
-
-
-
Constructor Detail
-
DefaultCellValueModel
public 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 isnull
.
-
-
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 interfaceValueModel<C>
- Overrides:
getValidator
in classAbstractValueModel<C>
- Returns:
- The validator for this model, or
null
if no validator is installed.
-
setValidator
public void setValidator(Validator<C> newValidator)
Description copied from interface:ValueModel
Sets the validator. This is a bound property- Specified by:
setValidator
in interfaceValueModel<C>
- Overrides:
setValidator
in classAbstractValueModel<C>
- Parameters:
newValidator
- The validator for this model, ornull
if no validator should be used.- See Also:
ValueModel.VALIDATOR_PROPERTY
-
getValue
public C getValue()
- Specified by:
getValue
in interfacecom.globalmentor.model.Valued<C>
- Specified by:
getValue
in interfaceValueModel<C>
- Overrides:
getValue
in classDefaultValueModel<C>
- Returns:
- The input value, or
null
if there is no input value.
-
setValue
public void setValue(C newValue) throws java.beans.PropertyVetoException
Description copied from interface:ValueModel
Sets the new value. This is a bound property that only fires a change event when the new value is different via theequals()
method. If a validator is installed, the value will first be validated before the current value is changed. Validation always occurs if a validator is installed, even if the value is not changing. If the value change is vetoed by the installed validator, the validation exception will be accessible viaThrowable.getCause()
.- Specified by:
setValue
in interfacecom.globalmentor.model.MutableValued<C>
- Specified by:
setValue
in interfaceValueModel<C>
- Overrides:
setValue
in classDefaultValueModel<C>
- Parameters:
newValue
- The new value.- Throws:
java.beans.PropertyVetoException
- if the provided value is not valid or the change has otherwise been vetoed.- See Also:
ValueModel.getValidator()
,ValueModel.VALUE_PROPERTY
-
resetValue
public void resetValue()
Description copied from interface:ValueModel
Resets the value to a default value, which may be invalid according to any installed validators. No validation occurs.- Specified by:
resetValue
in interfaceValueModel<C>
- Overrides:
resetValue
in classDefaultValueModel<C>
- See Also:
ValueModel.VALUE_PROPERTY
-
-