com.guiseframework.platform
Class AbstractComponentDepictor<C extends Component>

java.lang.Object
  extended by com.guiseframework.platform.AbstractDepictor<C>
      extended by com.guiseframework.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 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

Nested Class Summary
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 com.guiseframework.platform.AbstractDepictor
AbstractDepictor.DepictedPropertyChangeListener
 
Field Summary
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 com.guiseframework.platform.Depictor
GENERAL_PROPERTY
 
Constructor Summary
AbstractComponentDepictor()
          Default constructor.
 
Method Summary
 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 component.
 void processEvent(PlatformEvent event)
          Processes an event from the platform.
 void uninstalled(C component)
          Called when the depictor is uninstalled from a component.
 
Methods inherited from class com.guiseframework.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 com.guiseframework.platform.Depictor
getDepictContext, getDepictedObject, getPlatform, getSession, isDepicted, setDepicted
 

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 component. 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 component into which this depictor is being installed.
Throws:
java.lang.NullPointerException - if the given component is null.
java.lang.IllegalStateException - if this depictor is already installed in a component.
See Also:
AbstractDepictor.depictedPropertyChangeListener

uninstalled

public void uninstalled(C component)
Called when the depictor is uninstalled from a component. 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 component from which this depictor is being uninstalled.
Throws:
java.lang.NullPointerException - if the given component is null.
java.lang.IllegalStateException - if this depictor is not installed in a component.
See Also:
AbstractDepictor.depictedPropertyChangeListener

processEvent

public void processEvent(PlatformEvent event)
Processes an event from the platform. This implementation handles PlatformFocusEvent.

Specified by:
processEvent in interface Depictor<C extends Component>
Overrides:
processEvent in class AbstractDepictor<C extends Component>
Parameters:
event - The event to be processed.
Throws:
java.lang.IllegalArgumentException - if the given event is a relevant DepictEvent with a source of a different depicted object.

depict

public void depict()
            throws java.io.IOException
Updates the depiction of the object. 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.

depictChildren

protected void depictChildren()
                       throws java.io.IOException
Depicts any child components.

Parameters:
component - The depicted component.
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.

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)


Copyright © 2005-2010 GlobalMentor, Inc. All Rights Reserved.