wicket.markup.html.tree
Class AbstractTree

java.lang.Object
  extended by wicket.Component
      extended by wicket.MarkupContainer
          extended by wicket.markup.html.WebMarkupContainer
              extended by wicket.markup.html.WebMarkupContainerWithAssociatedMarkup
                  extended by wicket.markup.html.panel.Panel
                      extended by wicket.markup.html.tree.AbstractTree
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Tree

public abstract class AbstractTree
extends Panel

Base component for trees. The trees from this package work with the Swing tree models and DefaultMutableTreeNodes. Hence, users can re-use their Swing tree models.

Author:
Eelco Hillenius
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class wicket.markup.html.WebMarkupContainerWithAssociatedMarkup
WebMarkupContainerWithAssociatedMarkup.HeaderPartContainer
 
Nested classes/interfaces inherited from class wicket.Component
Component.ComponentModelChange, Component.EnabledChange, Component.IVisitor, Component.VisibilityChange
 
Field Summary
 
Fields inherited from class wicket.Component
ENABLE, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PATH_SEPARATOR, RENDER
 
Constructor Summary
AbstractTree(java.lang.String id, javax.swing.tree.TreeModel model)
          Construct using the given model as the tree model to use.
AbstractTree(java.lang.String id, TreeState treeState)
          Construct using the given tree state that holds the model to be used as the tree model.
 
Method Summary
 void collapsePath(javax.swing.tree.TreePath path)
          Ensures that the node identified by the specified path is collapsed and viewable.
 void collapseSiblings(javax.swing.tree.DefaultMutableTreeNode node)
          Collapses all the siblings of a given node.
 void expandAll(boolean expand)
          Expand or collapse all nodes.
 void expandPath(javax.swing.tree.TreePath path)
          Ensures that the node identified by the specified path is expanded and viewable.
 TreeState getTreeState()
          Gets the current tree state.
 boolean isExpanded(javax.swing.tree.DefaultMutableTreeNode node)
          Convenience method that determines whether the path of the given tree node is expanded in this tree's state.
 boolean isExpanded(javax.swing.tree.TreePath path)
          Convenience method that determines whether the given path is expanded in this tree's state.
 boolean isRootVisible()
          Gets whether the tree root node should be displayed.
 boolean isVisible(javax.swing.tree.TreePath path)
          Returns true if the value identified by path is currently viewable, which means it is either the root or all of its parents are expanded.
 TreeState newTreeState(javax.swing.tree.TreeModel model)
          Creates a new tree state by creating a new TreeStateobject, which is then set as the current tree state, creating a new TreeSelectionModeland then calling setTreeModel with this
protected  TreeState newTreeState(javax.swing.tree.TreeModel treeModel, boolean rootVisible)
          Creates a new tree state by creating a new TreeStateobject, which is then set as the current tree state, creating a new TreeSelectionModeland then calling setTreeModel with this
 void setExpandedState(javax.swing.tree.DefaultMutableTreeNode node)
          Sets the new expanded state, based on the given node
 void setExpandedState(javax.swing.tree.TreePath selection, boolean expanded)
          Sets the expanded property in the stree state for selection.
 void setRootVisible(boolean rootVisible)
          Sets whether the tree root node should be displayed.
 void setSelected(javax.swing.tree.DefaultMutableTreeNode node)
          Sets the new expanded state (to true), based on the given user node and set the tree path to the currently selected.
 void setTreeModel(javax.swing.tree.TreeModel treeModel)
          Sets the current tree model.
 void setTreeState(TreeState treeState)
          Sets the current tree state to the given tree state.
 java.lang.String toString()
          Gives the current tree model as a string.
 
Methods inherited from class wicket.markup.html.panel.Panel
onComponentTag, onComponentTagBody, renderHead
 
Methods inherited from class wicket.markup.html.WebMarkupContainerWithAssociatedMarkup
newHeaderPartContainer, renderHeadFromAssociatedMarkupFile
 
Methods inherited from class wicket.markup.html.WebMarkupContainer
getMarkupType, getWebPage
 
Methods inherited from class wicket.MarkupContainer
add, autoAdd, contains, findMarkupStream, get, getAssociatedMarkupStream, getMarkupStream, internalAdd, internalAttach, internalDetach, isTransparentResolver, iterator, iterator, newMarkupResourceStream, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, replace, setMarkupStream, setModel, size, toString, visitChildren, visitChildren
 
Methods inherited from class wicket.Component
add, addStateChange, checkComponentTag, checkComponentTagAttribute, continueToOriginalDestination, debug, detachBehaviors, detachModel, detachModels, error, exceptionMessage, fatal, findPage, findParent, findParentWithAssociatedMarkup, getApplication, getApplicationPages, getApplicationSettings, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getEscapeModelStrings, getFeedbackMessage, getFlag, getFlag, getId, getLocale, getLocalizer, getMarkupAttributes, getMarkupId, getMetaData, getModel, getModelComparator, getModelObject, getModelObjectAsString, getOutputMarkupId, getPage, getPageFactory, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResponse, getSession, getSizeInBytes, getString, getString, getString, getStyle, getVariation, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnAttach, internalOnDetach, internalOnModelChanged, isActionAuthorized, isAncestorOf, isBehaviorAccepted, isEnableAllowed, isEnabled, isHeadRendered, isIgnoreAttributeModifier, isRenderAllowed, isVersioned, isVisible, isVisibleInHierarchy, modelChanged, modelChanging, newPage, newPage, onAfterRender, onAttach, onBeforeRender, onBeginRequest, onDetach, onEndRequest, onModelChanged, onModelChanging, onRender, redirectToInterceptPage, remove, render, render, renderComponent, renderComponent, renderComponentTag, rendered, renderedBehaviors, replaceComponentTagBody, replaceWith, resetHeadRendered, sameRootModel, sameRootModel, setAuto, setEnabled, setEscapeModelStrings, setFlag, setFlag, setIgnoreAttributeModifier, setMetaData, setModelObject, setOutputMarkupId, setRedirect, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisible, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractTree

public AbstractTree(java.lang.String id,
                    javax.swing.tree.TreeModel model)
Construct using the given model as the tree model to use. A new tree state will be constructed by calling newTreeState.

Parameters:
id - The id of this component
model - the underlying tree model

AbstractTree

public AbstractTree(java.lang.String id,
                    TreeState treeState)
Construct using the given tree state that holds the model to be used as the tree model.

Parameters:
id - The id of this component
treeState - treeState that holds the underlying tree model
Method Detail

collapsePath

public void collapsePath(javax.swing.tree.TreePath path)
Ensures that the node identified by the specified path is collapsed and viewable.

Parameters:
path - the TreePath identifying a node

collapseSiblings

public void collapseSiblings(javax.swing.tree.DefaultMutableTreeNode node)
Collapses all the siblings of a given node.

Parameters:
node - The node of which to collapse the siblings.

expandAll

public void expandAll(boolean expand)
Expand or collapse all nodes.

Parameters:
expand - If true, expand all nodes in the tree. Else collapse all nodes in the tree.

expandPath

public void expandPath(javax.swing.tree.TreePath path)
Ensures that the node identified by the specified path is expanded and viewable. If the last item in the path is a leaf, this will have no effect.

Parameters:
path - the TreePath identifying a node

getTreeState

public final TreeState getTreeState()
Gets the current tree state.

Returns:
the tree current tree state

isExpanded

public final boolean isExpanded(javax.swing.tree.DefaultMutableTreeNode node)
Convenience method that determines whether the path of the given tree node is expanded in this tree's state.

Parameters:
node - the tree node
Returns:
whether the path of the given tree node is expanded

isExpanded

public final boolean isExpanded(javax.swing.tree.TreePath path)
Convenience method that determines whether the given path is expanded in this tree's state.

Parameters:
path - the tree path
Returns:
whether the given path is expanded

isRootVisible

public final boolean isRootVisible()
Gets whether the tree root node should be displayed.

Returns:
whether the tree root node should be displayed

isVisible

public final boolean isVisible(javax.swing.tree.TreePath path)
Returns true if the value identified by path is currently viewable, which means it is either the root or all of its parents are expanded. Otherwise, this method returns false.

Parameters:
path - The path
Returns:
true if the node is viewable, otherwise false

newTreeState

public TreeState newTreeState(javax.swing.tree.TreeModel model)
Creates a new tree state by creating a new TreeStateobject, which is then set as the current tree state, creating a new TreeSelectionModeland then calling setTreeModel with this

Parameters:
model - the model that the new tree state applies to
Returns:
the tree state

setExpandedState

public void setExpandedState(javax.swing.tree.DefaultMutableTreeNode node)
Sets the new expanded state, based on the given node

Parameters:
node - the tree node model

setExpandedState

public void setExpandedState(javax.swing.tree.TreePath selection,
                             boolean expanded)
Sets the expanded property in the stree state for selection.

Parameters:
selection - the selection to set the expanded property for
expanded - true if the selection is expanded, false otherwise

setRootVisible

public void setRootVisible(boolean rootVisible)
Sets whether the tree root node should be displayed.

Parameters:
rootVisible - whether the tree node should be displayed

setSelected

public void setSelected(javax.swing.tree.DefaultMutableTreeNode node)
Sets the new expanded state (to true), based on the given user node and set the tree path to the currently selected.

Parameters:
node - the tree node model

setTreeModel

public void setTreeModel(javax.swing.tree.TreeModel treeModel)
Sets the current tree model.

Parameters:
treeModel - the tree model to set as the current one

setTreeState

public void setTreeState(TreeState treeState)
Sets the current tree state to the given tree state.

Parameters:
treeState - the tree state to set as the current one

toString

public java.lang.String toString()
Gives the current tree model as a string.

Overrides:
toString in class MarkupContainer
Returns:
the current tree model as a string
See Also:
Component.toString()

newTreeState

protected final TreeState newTreeState(javax.swing.tree.TreeModel treeModel,
                                       boolean rootVisible)
Creates a new tree state by creating a new TreeStateobject, which is then set as the current tree state, creating a new TreeSelectionModeland then calling setTreeModel with this

Parameters:
treeModel - the model that the new tree state applies to
rootVisible - whether the tree node should be displayed
Returns:
the tree state


Copyright © 2004-2007 Wicket developers. All Rights Reserved.