Class AbstractComponentDepictor<C extends Component>
- java.lang.Object
-
- io.guise.framework.platform.AbstractDepictor<C>
-
- io.guise.framework.platform.AbstractComponentDepictor<C>
-
- 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
andComponent.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AbstractComponentDepictor.DepictedCompositeComponentListener
A listener that marks this depiction as dirty if direct children are added or deleted.-
Nested classes/interfaces inherited from class io.guise.framework.platform.AbstractDepictor
AbstractDepictor.DepictedPropertyChangeListener
-
-
Field Summary
Fields Modifier and Type Field Description protected 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.-
Fields inherited from interface io.guise.framework.platform.Depictor
GENERAL_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description AbstractComponentDepictor()
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
depictChild(Component childComponent)
Depicts a single child.protected void
depictChildren()
Depicts any child components.protected void
depictedObjectPropertyChange(java.beans.PropertyChangeEvent propertyChangeEvent)
Called when a depicted object bound property is changed.protected AbstractComponentDepictor.DepictedCompositeComponentListener
getDepictedCompositeComponentListener()
protected java.lang.String
getErrorMessage()
Constructs an error message for all component errors.void
installed(C component)
Called when the depictor is installed in a depicted object.void
processEvent(PlatformEvent event)
Processes an event from the platform.void
uninstalled(C component)
Called when the depictor is uninstalled from a depicted object.-
Methods inherited from class io.guise.framework.platform.AbstractDepictor
getDepictContext, getDepictedObject, getDepictedPropertyChangeListener, getIgnoredProperties, getModifiedProperties, getPlatform, getSession, isDepicted, setDepicted, setPropertyModified
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.guise.framework.platform.Depictor
getDepictContext, getDepictedObject, getPlatform, getSession, isDepicted, setDepicted
-
-
-
-
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 interfaceDepictor<C extends Component>
- Overrides:
installed
in classAbstractDepictor<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 interfaceDepictor<C extends Component>
- Overrides:
uninstalled
in classAbstractDepictor<C extends Component>
- Parameters:
component
- The depicted object from which this depictor is being uninstalled.- See Also:
AbstractDepictor.depictedPropertyChangeListener
-
processEvent
public void processEvent(PlatformEvent event)
Processes an event from the platform.This implementation handles
PlatformFocusEvent
.- Specified by:
processEvent
in interfaceDepictor<C extends Component>
- Overrides:
processEvent
in classAbstractDepictor<C extends Component>
- 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.
This implementation updates child components, if any.
- Specified by:
depict
in interfaceDepictor<C extends Component>
- Overrides:
depict
in classAbstractDepictor<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 classAbstractDepictor<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)
-
-