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 java.lang.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AbstractDepictor.DepictedPropertyChangeListener
A listener that marks this depiction as dirty if changes occur.
-
Field Summary
-
Fields inherited from interface io.guise.framework.platform.Depictor
GENERAL_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description AbstractDepictor()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
depict()
Updates the depiction of the object.protected void
depictedObjectPropertyChange(java.beans.PropertyChangeEvent propertyChangeEvent)
Called when a depicted object bound property is changed.DepictContext
getDepictContext()
Retrieves information and functionality related to the current depiction on the platform.O
getDepictedObject()
protected AbstractDepictor.DepictedPropertyChangeListener
getDepictedPropertyChangeListener()
protected java.util.Set<java.lang.String>
getIgnoredProperties()
protected java.util.Set<java.lang.String>
getModifiedProperties()
Platform
getPlatform()
GuiseSession
getSession()
void
installed(O depictedObject)
Called when the depictor is installed in a depicted object.boolean
isDepicted()
void
processEvent(PlatformEvent event)
Processes an event from the platform.void
setDepicted(boolean newDepicted)
Changes the depictor's updated status.protected void
setPropertyModified(java.lang.String property, boolean modified)
Calls when a property has been modified to sets whether a property has been modified.void
uninstalled(O depictedObject)
Called when the depictor is uninstalled from a depicted object.
-
-
-
Method Detail
-
getSession
public GuiseSession getSession()
- Specified by:
getSession
in interfaceDepictor<O extends DepictedObject>
- Returns:
- The Guise session that owns this object.
-
getPlatform
public Platform getPlatform()
- Specified by:
getPlatform
in interfaceDepictor<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 toPlatform.getDepictContext()
.This method delegates to
Platform.getDepictContext()
.- Specified by:
getDepictContext
in interfaceDepictor<O extends DepictedObject>
- Returns:
- A context for the current depiction.
-
getIgnoredProperties
protected java.util.Set<java.lang.String> getIgnoredProperties()
- Returns:
- The depicted object properties that are to be ignored.
-
getModifiedProperties
protected java.util.Set<java.lang.String> getModifiedProperties()
- Returns:
- The depicted object properties that have been modified.
-
setPropertyModified
protected void setPropertyModified(java.lang.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 totrue
, the depictor'sisDepicted()
status is changed tofalse
. If the property's modified status is set tofalse
and there are no other modified properties, the depictor'sisDepicted()
status is set totrue
.- Parameters:
property
- The property that has been modified.modified
- Whether the property has been modified.- See Also:
setDepicted(boolean)
-
getDepictedPropertyChangeListener
protected AbstractDepictor.DepictedPropertyChangeListener getDepictedPropertyChangeListener()
- Returns:
- The listener that marks this depiction as dirty if a change occurs.
-
getDepictedObject
public O getDepictedObject()
- Specified by:
getDepictedObject
in interfaceDepictor<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 interfaceDepictor<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 istrue
, all modified properties are removed. If the new depicted status isfalse
, theDepictor.GENERAL_PROPERTY
property is set as modified.- Specified by:
setDepicted
in interfaceDepictor<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 interfaceDepictor<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 interfaceDepictor<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 interfaceDepictor<O extends DepictedObject>
- Parameters:
event
- The event to be processed.
-
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.
- Specified by:
depict
in interfaceDepictor<O extends DepictedObject>
- Throws:
java.io.IOException
- if there is an error updating the depiction.
-
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.
- Parameters:
propertyChangeEvent
- An event object describing the event source and the property that has changed.- See Also:
getIgnoredProperties()
,setPropertyModified(String, boolean)
-
-