com.guiseframework.platform.web
Class WebTreeControlDepictor<C extends TreeControl>

java.lang.Object
  extended by com.guiseframework.platform.AbstractDepictor<C>
      extended by com.guiseframework.platform.AbstractComponentDepictor<C>
          extended by com.guiseframework.platform.web.AbstractWebComponentDepictor<C>
              extended by com.guiseframework.platform.web.AbstractDecoratedWebComponentDepictor<C>
                  extended by com.guiseframework.platform.web.WebTreeControlDepictor<C>
Type Parameters:
C - The type of component being depicted.
All Implemented Interfaces:
ComponentDepictor<C>, Depictor<C>, WebComponentDepictor<C>, WebDepictor<C>

public class WebTreeControlDepictor<C extends TreeControl>
extends AbstractDecoratedWebComponentDepictor<C>

Strategy for rendering a tree component as an XHTML <div> element.

Author:
Garret Wilson

Nested Class Summary
 
Nested classes/interfaces inherited from class com.guiseframework.platform.AbstractComponentDepictor
AbstractComponentDepictor.DepictedCompositeComponentListener
 
Nested classes/interfaces inherited from class com.guiseframework.platform.AbstractDepictor
AbstractDepictor.DepictedPropertyChangeListener
 
Field Summary
static java.lang.String TREE_NODE_COLLAPSED_IMAGE_RESOURCE_KEY
          The resource bundle key for the tree node expanded image URI.
static java.lang.String TREE_NODE_EXPANDED_IMAGE_RESOURCE_KEY
          The resource bundle key for the tree node collapsed image URI.
static java.lang.String TREE_NODE_LEAF_IMAGE_RESOURCE_KEY
          The resource bundle key for the tree node leaf image URI.
 
Fields inherited from class com.guiseframework.platform.web.AbstractWebComponentDepictor
BODY_END_PATTERN, BODY_START_PATTERN
 
Fields inherited from class com.guiseframework.platform.AbstractComponentDepictor
childPropertyChangeListener
 
Fields inherited from interface com.guiseframework.platform.Depictor
GENERAL_PROPERTY
 
Constructor Summary
WebTreeControlDepictor()
          Default constructor using the XHTML <div> element.
 
Method Summary
protected  void depictChildren()
          Updates the views of any children.
 TreeNodeModel<?> getTreeNode(long treeNodeID)
          Determines the tree node associated with the given ID.
 long getTreeNodeID(TreeNodeModel<?> treeNode)
          Determines the ID of the given tree node in this view.
protected
<T> java.util.Set<java.lang.String>
getTreeNodeStyleIDs(TreeModel treeModel, TreeNodeModel<T> treeNode, java.lang.String prefix, java.lang.String suffix)
          Retrieves the style IDs for a tree node.
 void processEvent(PlatformEvent event)
          Processes an event from the platform.
protected
<T> void
updateTreeNodeChildViews(TreeModel treeModel, TreeNodeModel<T> treeNode)
          Updates the views of a tree node's children, if any.
protected
<T> void
updateTreeNodeView(TreeModel treeModel, TreeNodeModel<T> treeNode)
          Updates the view of a tree node.
 
Methods inherited from class com.guiseframework.platform.web.AbstractDecoratedWebComponentDepictor
depictBegin, depictEnd, getBodyLocalName, getBodyNamespaceURI, isEmptyBodyElementAllowed, writeDecoratorBegin, writeDecoratorEnd
 
Methods inherited from class com.guiseframework.platform.web.AbstractWebComponentDepictor
addFlowStyleIDs, decorateID, depict, depictBody, getBackgroundColor, getBaseStyleIDs, getBodyStyleIDs, getBodyStyles, getColor, getDepictContext, getDepictName, getLabelStyles, getLabelStyles, getLabelStyles, getLocalName, getNamespaceURI, getOuterStyles, getPlatform, hasLabelContent, hasLabelContent, hasLabelContent, hasLabelContent, isEmptyElementAllowed, isMouseListener, writeBodyIDClassAttributes, writeClassAttribute, writeDirectionAttribute, writeDirectionAttribute, writeErrorMessage, writeFloatClear, writeIDAttribute, writeIDClassAttributes, writeLabel, writeLabelContent, writeLabelContent, writeLabelContent, writeLabelContent, writeLabelContent, writeLabelContent, writeParameterInputs, writeStyleAttribute, writeText
 
Methods inherited from class com.guiseframework.platform.AbstractComponentDepictor
depictChild, depictedObjectPropertyChange, getDepictedCompositeComponentListener, getErrorMessage, installed, uninstalled
 
Methods inherited from class com.guiseframework.platform.AbstractDepictor
getDepictedObject, getDepictedPropertyChangeListener, getIgnoredProperties, getModifiedProperties, 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
getDepictedObject, getSession, installed, isDepicted, setDepicted, uninstalled
 

Field Detail

TREE_NODE_COLLAPSED_IMAGE_RESOURCE_KEY

public static final java.lang.String TREE_NODE_COLLAPSED_IMAGE_RESOURCE_KEY
The resource bundle key for the tree node expanded image URI.

See Also:
Constant Field Values

TREE_NODE_EXPANDED_IMAGE_RESOURCE_KEY

public static final java.lang.String TREE_NODE_EXPANDED_IMAGE_RESOURCE_KEY
The resource bundle key for the tree node collapsed image URI.

See Also:
Constant Field Values

TREE_NODE_LEAF_IMAGE_RESOURCE_KEY

public static final java.lang.String TREE_NODE_LEAF_IMAGE_RESOURCE_KEY
The resource bundle key for the tree node leaf image URI.

See Also:
Constant Field Values
Constructor Detail

WebTreeControlDepictor

public WebTreeControlDepictor()
Default constructor using the XHTML <div> element.

Method Detail

getTreeNodeID

public long getTreeNodeID(TreeNodeModel<?> treeNode)
Determines the ID of the given tree node in this view. If the tree node has no ID assigned, one will be generated.

Parameters:
treeNode - The tree node for which an ID should be returned.
Returns:
The unique ID of the given tree node.

getTreeNode

public TreeNodeModel<?> getTreeNode(long treeNodeID)
Determines the tree node associated with the given ID.

Parameters:
treeNodeID - An ID assigned to a tree node.
Returns:
The tree node associated with the given ID, or null if there is no tree node associated with the ID.

processEvent

public void processEvent(PlatformEvent event)
Processes an event from the platform.

Specified by:
processEvent in interface Depictor<C extends TreeControl>
Overrides:
processEvent in class AbstractComponentDepictor<C extends TreeControl>
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.

getTreeNodeStyleIDs

protected <T> java.util.Set<java.lang.String> getTreeNodeStyleIDs(TreeModel treeModel,
                                                                  TreeNodeModel<T> treeNode,
                                                                  java.lang.String prefix,
                                                                  java.lang.String suffix)
Retrieves the style IDs for a tree node.

Type Parameters:
T - The type of value contained in the tree node. This version returns the base tree node style ID #TREE_NODE_CLASS with the given prefix/suffix, if any, along with styles representing the expandeded or collapseed state and whether the node is a leaf.
Parameters:
treeModel - The component model.
treeNode - The tree node.
prefix - The prefix that needs to be added to the base style, or null if there is no prefix to add.
suffix - The suffix that needs to be added to the base style, or null if there is no suffix to add.
Returns:
The style IDs for the tree node.

depictChildren

protected void depictChildren()
                       throws java.io.IOException
Updates the views of any children.

Overrides:
depictChildren in class AbstractComponentDepictor<C extends TreeControl>
Throws:
java.io.IOException - if there is an error updating the child views.
See Also:
DepictContext.State#UPDATE_VIEW

updateTreeNodeView

protected <T> void updateTreeNodeView(TreeModel treeModel,
                                      TreeNodeModel<T> treeNode)
                           throws java.io.IOException
Updates the view of a tree node.

Type Parameters:
T - The type of value contained in the tree node.
Parameters:
treeModel - The component model.
treeNode - The tree node.
Throws:
java.io.IOException - if there is an error updating the tree node view.

updateTreeNodeChildViews

protected <T> void updateTreeNodeChildViews(TreeModel treeModel,
                                            TreeNodeModel<T> treeNode)
                                 throws java.io.IOException
Updates the views of a tree node's children, if any.

Type Parameters:
T - The type of value contained in the tree node.
Parameters:
treeModel - The component model.
treeNode - The tree node the views of the children of which should be updated.
Throws:
java.io.IOException - if there is an error updating the child tree node views.


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