Class AbstractComponentDepictor<C extends Component>

  • Type Parameters:
    C - The type of component being depicted.
    All Implemented Interfaces:
    ComponentDepictor<C>, Depictor<C>
    Direct Known Subclasses:
    AbstractWebComponentDepictor

    public abstract class AbstractComponentDepictor<C extends Component>
    extends AbstractDepictor<C>
    implements ComponentDepictor<C>
    An abstract implementation of a component depictor.

    If the component has a model, this implementation will automatically register to listen to its properties being changed.

    This implementation does not recognize that it needs to be updated if the associated component changes its registered listeners.

    A view keeps track of component modified properties between updates.

    This implementation ignores a change in Component.VALID_PROPERTY and Component.INPUT_STRATEGY_PROPERTY.

    This implementation only dirties the depictors of containers, not composite components in general, when child components are added or removed.

    Author:
    Garret Wilson
    • Field Detail

      • childPropertyChangeListener

        protected final java.beans.PropertyChangeListener childPropertyChangeListener
        The listener that listens for the change of a child's property, such as a value model's value, and marks the view as dirty.
    • Constructor Detail

      • AbstractComponentDepictor

        public AbstractComponentDepictor()
        Default constructor.
    • Method Detail

      • getDepictedCompositeComponentListener

        protected AbstractComponentDepictor.DepictedCompositeComponentListener getDepictedCompositeComponentListener()
        Returns:
        The listener that marks this depiction as dirty if direct children are added or removed, or null if the depicted component is not a container or is not installed.
      • installed

        public void installed​(C component)
        Called when the depictor is installed in a depicted object.

        This version listens for property changes of a PropertyBindable object.

        This version listens for list changes of a ListListenable object.

        If the component is a container, this version listens for container events and marks the view as needing updated.

        Specified by:
        installed in interface Depictor<C extends Component>
        Overrides:
        installed in class AbstractDepictor<C extends Component>
        Parameters:
        component - The depictedObject into which this depictor is being installed.
        See Also:
        AbstractDepictor.depictedPropertyChangeListener
      • uninstalled

        public void uninstalled​(C component)
        Called when the depictor is uninstalled from a depicted object.

        This version stop listening for property changes of a PropertyBindable object.

        This version stops listening for list changes of a ListListenable object.

        If the component is a container, this version stops listening for container events.

        Specified by:
        uninstalled in interface Depictor<C extends Component>
        Overrides:
        uninstalled in class AbstractDepictor<C extends Component>
        Parameters:
        component - The depicted object from which this depictor is being uninstalled.
        See Also:
        AbstractDepictor.depictedPropertyChangeListener
      • depict

        public void depict()
                    throws java.io.IOException
        Updates the depiction of the object. The depiction will be marked as updated.

        This implementation marks the depiction as depicted.

        This implementation updates child components, if any.

        Specified by:
        depict in interface Depictor<C extends Component>
        Overrides:
        depict in class AbstractDepictor<C extends Component>
        Throws:
        java.io.IOException - if there is an error updating the depiction.
        See Also:
        depictChildren()
      • depictChildren

        protected void depictChildren()
                               throws java.io.IOException
        Depicts any child components.
        Throws:
        java.io.IOException - if there is an error updating the child depictions.
      • depictChild

        protected void depictChild​(Component childComponent)
                            throws java.io.IOException
        Depicts a single child. The child's depiction will be marked as updated if successful.
        Parameters:
        childComponent - The child component to depict.
        Throws:
        java.io.IOException - if there is an error updating the child depiction.
        See Also:
        Depictor.setDepicted(boolean), DepictedObject.depict()
      • getErrorMessage

        protected java.lang.String getErrorMessage()
        Constructs an error message for all component errors.
        Returns:
        An error message constructed from all component errors, which may include resource references, or null if there are no errors.
      • depictedObjectPropertyChange

        protected void depictedObjectPropertyChange​(java.beans.PropertyChangeEvent propertyChangeEvent)
        Called when a depicted object bound property is changed.

        This method may also be called for objects related to the depicted object, so if specific properties are checked the event source should be verified to be the depicted object.

        This implementation marks the property as being modified if the property is not an ignored property.

        This implementation marks the property as being modified if the property is not an ignored property.

        Overrides:
        depictedObjectPropertyChange in class AbstractDepictor<C extends Component>
        Parameters:
        propertyChangeEvent - An event object describing the event source and the property that has changed.
        See Also:
        AbstractDepictor.getIgnoredProperties(), AbstractDepictor.setPropertyModified(String, boolean)