Class AbstractDepictor<O extends DepictedObject>

java.lang.Object
io.guise.framework.platform.AbstractDepictor<O>
Type Parameters:
O - The type of object being depicted.
All Implemented Interfaces:
Depictor<O>
Direct Known Subclasses:
AbstractComponentDepictor, AbstractWebDepictor

public abstract class AbstractDepictor<O extends DepictedObject> extends Object implements Depictor<O>
An abstract strategy for depicting objects on some platform.

The Depictor.GENERAL_PROPERTY is used to indicate that some general property has changed.

Author:
Garret Wilson
  • Constructor Details

    • AbstractDepictor

      public AbstractDepictor()
      Default constructor.
  • Method Details

    • getSession

      public GuiseSession getSession()
      Specified by:
      getSession in interface Depictor<O extends DepictedObject>
      Returns:
      The Guise session that owns this object.
    • getPlatform

      public Platform getPlatform()
      Specified by:
      getPlatform in interface Depictor<O extends DepictedObject>
      Returns:
      The platform on which this depictor is depicting objects.
    • getDepictContext

      public DepictContext getDepictContext()
      Retrieves information and functionality related to the current depiction on the platform. This method delegates to Platform.getDepictContext().

      This method delegates to Platform.getDepictContext().

      Specified by:
      getDepictContext in interface Depictor<O extends DepictedObject>
      Returns:
      A context for the current depiction.
    • getIgnoredProperties

      protected Set<String> getIgnoredProperties()
      Returns:
      The depicted object properties that are to be ignored.
    • getModifiedProperties

      protected Set<String> getModifiedProperties()
      Returns:
      The depicted object properties that have been modified.
    • setPropertyModified

      protected void setPropertyModified(String property, boolean modified)
      Calls when a property has been modified to sets whether a property has been modified. If the property's modified status is set to true, the depictor's isDepicted() status is changed to false. If the property's modified status is set to false and there are no other modified properties, the depictor's isDepicted() status is set to true.
      Parameters:
      property - The property that has been modified.
      modified - Whether the property has been modified.
      See Also:
    • getDepictedPropertyChangeListener

      protected AbstractDepictor<O>.DepictedPropertyChangeListener getDepictedPropertyChangeListener()
      Returns:
      The listener that marks this depiction as dirty if a change occurs.
    • getDepictedObject

      public O getDepictedObject()
      Specified by:
      getDepictedObject in interface Depictor<O extends DepictedObject>
      Returns:
      The object being depicted, or null if this depictor is not installed in a depicted object.
    • isDepicted

      public boolean isDepicted()
      Specified by:
      isDepicted in interface Depictor<O extends DepictedObject>
      Returns:
      Whether this depictor's representation of the depicted object is up to date.
    • setDepicted

      public void setDepicted(boolean newDepicted)
      Description copied from interface: Depictor
      Changes the depictor's updated status. If the new depicted status is true, all modified properties are removed. If the new depicted status is false, the Depictor.GENERAL_PROPERTY property is set as modified.
      Specified by:
      setDepicted in interface Depictor<O extends DepictedObject>
      Parameters:
      newDepicted - Whether this depictor's representation of the depicted object is up to date.
    • installed

      public void installed(O depictedObject)
      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.

      Specified by:
      installed in interface Depictor<O extends DepictedObject>
      Parameters:
      depictedObject - The depictedObject into which this depictor is being installed.
      See Also:
      • depictedPropertyChangeListener
    • uninstalled

      public void uninstalled(O depictedObject)
      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.

      Specified by:
      uninstalled in interface Depictor<O extends DepictedObject>
      Parameters:
      depictedObject - The depicted object from which this depictor is being uninstalled.
      See Also:
      • depictedPropertyChangeListener
    • processEvent

      public void processEvent(PlatformEvent event)
      Description copied from interface: Depictor
      Processes an event from the platform.
      Specified by:
      processEvent in interface Depictor<O extends DepictedObject>
      Parameters:
      event - The event to be processed.
    • depict

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

      This implementation marks the depiction as depicted.

      Specified by:
      depict in interface Depictor<O extends DepictedObject>
      Throws:
      IOException - if there is an error updating the depiction.
    • depictedObjectPropertyChange

      protected void depictedObjectPropertyChange(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.

      Parameters:
      propertyChangeEvent - An event object describing the event source and the property that has changed.
      See Also: