wicket.markup.html.tree
Class AbstractTree

java.lang.Object
  extended bywicket.Component
      extended bywicket.MarkupContainer
          extended bywicket.markup.html.WebMarkupContainer
              extended bywicket.markup.html.panel.Panel
                  extended bywicket.markup.html.tree.AbstractTree
All Implemented Interfaces:
IAjaxListener, IHeaderContributor, IRequestListener, 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 inherited from class wicket.Component
Component.ComponentModelChange, Component.IVisitor, Component.VisibilityChange
 
Field Summary
 
Fields inherited from class wicket.Component
FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4
 
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
 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.
 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
onRender
 
Methods inherited from class wicket.markup.html.WebMarkupContainer
getMarkupType, renderHead
 
Methods inherited from class wicket.MarkupContainer
add, autoAdd, contains, findMarkupStream, get, getAssociatedMarkupStream, getMarkupStream, internalAdd, internalBeginRequest, internalEndRequest, iterator, iterator, onComponentTagBody, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, replace, setMarkupStream, setModel, size, toString, visitChildren, visitChildren
 
Methods inherited from class wicket.Component
add, add, addStateChange, checkComponentTag, checkComponentTagAttribute, debug, detachModel, error, exceptionMessage, fatal, findPage, findParent, findParentWithAssociatedMarkup, getAjaxHandlers, getApplication, getApplicationPages, getApplicationSettings, getClassRelativePath, getComparator, getConverter, getEscapeModelStrings, getFeedbackMessage, getFlag, getId, getLocale, getLocalizer, getModel, getModelObject, getModelObjectAsString, getPage, getPageFactory, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResource, getResponse, getSession, getString, getString, getString, getStyle, getVariation, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnBeginRequest, internalOnEndRequest, internalOnModelChanged, internalOnModelChanging, isAncestorOf, isVersioned, isVisible, isVisibleInHierarchy, modelChanged, modelChanging, newPage, newPage, onBeginRequest, onComponentTag, onEndRequest, onModelChanged, onModelChanging, onRequest, onSessionAttach, redirectTo, remove, render, renderComponent, renderComponentTag, rendered, replaceComponentTagBody, sameRootModel, sameRootModel, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setModelObject, setRedirect, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisible, 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

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

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 final 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 final 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 final void setRootVisible(boolean rootVisible)
Sets whether the tree root node should be displayed.

Parameters:
rootVisible - whether the tree node should be displayed

setSelected

public final 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

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

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

toString

public final 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-2006 Wicket developers. All Rights Reserved.