Class 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
    • 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 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

      • 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 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
      • getValue

        public C getValue()
        Specified by:
        getValue in interface com.globalmentor.model.Valued<C>
        Specified by:
        getValue in interface ValueModel<C>
        Overrides:
        getValue in class DefaultValueModel<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 the equals() 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 via Throwable.getCause().
        Specified by:
        setValue in interface com.globalmentor.model.MutableValued<C>
        Specified by:
        setValue in interface ValueModel<C>
        Overrides:
        setValue in class DefaultValueModel<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