|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.wicket.Component
org.apache.wicket.MarkupContainer
org.apache.wicket.markup.html.WebMarkupContainer
org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup
org.apache.wicket.markup.html.panel.Panel
org.apache.wicket.markup.html.tree.AbstractTree
public abstract class AbstractTree
This class encapsulates the logic for displaying and (partial) updating the tree. Actual
presentation is out of scope of this class. User should derive they own tree (if needed) from
BaseTree
(recommended).
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.wicket.Component |
---|
Component.ComponentModelChange, Component.EnabledChange, Component.IVisitor<T extends Component>, Component.VisibilityChange |
Field Summary |
---|
Fields inherited from class org.apache.wicket.Component |
---|
ENABLE, FLAG_CONFIGURED, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER |
Constructor Summary | |
---|---|
AbstractTree(String id)
Tree constructor |
|
AbstractTree(String id,
IModel<TreeModel> model)
Tree constructor |
Method Summary | |
---|---|
protected void |
addComponent(AjaxRequestTarget target,
Component component)
Allows to intercept adding dirty components to AjaxRequestTarget. |
void |
allNodesCollapsed()
called when all nodes are collapsed. |
void |
allNodesExpanded()
called when all nodes are expanded. |
Object |
getChildAt(Object parent,
int index)
|
int |
getChildCount(Object parent)
|
IModel<TreeModel> |
getModel()
|
TreeModel |
getModelObject()
|
Component |
getNodeComponent(Object node)
Returns the component associated with given node, or null, if node is not visible. |
Object |
getParentNode(Object node)
Returns parent node of given node. |
ITreeState |
getTreeState()
Returns the TreeState of this tree. |
void |
invalidateAll()
Call to refresh the whole tree. |
protected boolean |
isForceRebuildOnSelectionChange()
Determines whether the TreeNode needs to be rebuilt if it is selected or deselected |
boolean |
isLeaf(Object node)
|
protected boolean |
isNodeExpanded(Object node)
Returns whether the given node is expanded. |
boolean |
isRootLess()
|
void |
markNodeChildrenDirty(Object node)
INTERNAL |
void |
markNodeDirty(Object node)
INTERNAL |
protected ITreeState |
newTreeState()
Creates the TreeState, which is an object where the current state of tree (which nodes are expanded / collapsed, selected, ...) is stored. |
Iterator<Object> |
nodeChildren(Object node)
Return the representation of node children as Iterator interface. |
void |
nodeCollapsed(Object node)
Fired when given node is collapsed. |
void |
nodeExpanded(Object node)
Fired when given node is expanded. |
void |
nodeSelected(Object node)
Fired when given node gets selected. |
void |
nodeUnselected(Object node)
Fired when given node gets unselected. |
protected void |
onAfterRender()
Called after the rendering of tree is complete. |
protected void |
onBeforeAttach()
This method is called before the onAttach is called. |
void |
onBeforeRender()
Called at the beginning of the request (not ajax request, unless we are rendering the entire component) |
void |
onDetach()
Called to allow a component to detach resources after use. |
void |
onTargetRespond(AjaxRequestTarget target)
Invoked when AjaxRequestTarget is about the respond. |
protected abstract void |
populateTreeItem(WebMarkupContainer item,
int level)
This method is called after creating every TreeItem. |
MarkupContainer |
setModel(IModel<TreeModel> model)
|
MarkupContainer |
setModelObject(TreeModel model)
|
void |
setRootLess(boolean rootLess)
Sets whether the root of the tree should be visible. |
void |
treeNodesChanged(TreeModelEvent e)
|
void |
treeNodesInserted(TreeModelEvent e)
|
void |
treeNodesRemoved(TreeModelEvent removalEvent)
|
void |
treeStructureChanged(TreeModelEvent e)
|
void |
updateTree()
Convenience method that updates changed portions on tree. |
void |
updateTree(AjaxRequestTarget target)
Updates the changed portions of the tree using given AjaxRequestTarget. |
Methods inherited from class org.apache.wicket.markup.html.panel.Panel |
---|
onComponentTag, onComponentTagBody, renderHead |
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup |
---|
newHeaderPartContainer, renderHeadFromAssociatedMarkupFile |
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer |
---|
getMarkupType, getWebPage, getWebRequest |
Methods inherited from class org.apache.wicket.MarkupContainer |
---|
add, addOrReplace, autoAdd, autoAdd, contains, findMarkupStream, get, get, getAssociatedMarkupStream, getMarkupStream, hasAssociatedMarkup, internalAdd, isTransparentResolver, iterator, iterator, newMarkupResourceStream, onAfterRenderChildren, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, renderNext, replace, setDefaultModel, setMarkupStream, size, swap, toString, toString, visitChildren, visitChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AbstractTree(String id)
id
- The component idpublic AbstractTree(String id, IModel<TreeModel> model)
id
- The component idmodel
- The tree modelMethod Detail |
---|
public final void allNodesCollapsed()
allNodesCollapsed
in interface ITreeStateListener
public final void allNodesExpanded()
allNodesExpanded
in interface ITreeStateListener
public IModel<TreeModel> getModel()
public TreeModel getModelObject()
public MarkupContainer setModel(IModel<TreeModel> model)
model
- model
public MarkupContainer setModelObject(TreeModel model)
model
- model
public ITreeState getTreeState()
protected void onBeforeAttach()
public void onBeforeRender()
onBeforeRender
in class Component
Component.callOnBeforeRenderIfNotVisible()
public void onDetach()
Component
onDetach
in class Component
Component.onDetach()
public final void invalidateAll()
public final boolean isRootLess()
public final void nodeCollapsed(Object node)
ITreeStateListener
nodeCollapsed
in interface ITreeStateListener
node
- The node that was collapsedITreeStateListener.nodeCollapsed(Object)
public final void nodeExpanded(Object node)
ITreeStateListener
nodeExpanded
in interface ITreeStateListener
ITreeStateListener.nodeExpanded(Object)
public final void nodeSelected(Object node)
ITreeStateListener
nodeSelected
in interface ITreeStateListener
node
- The node that was selected)
public final void nodeUnselected(Object node)
ITreeStateListener
nodeUnselected
in interface ITreeStateListener
node
- The node that was unselectedITreeStateListener.nodeUnselected(Object)
protected boolean isForceRebuildOnSelectionChange()
public void setRootLess(boolean rootLess)
rootLess
- whether the root should be visiblepublic final void treeNodesChanged(TreeModelEvent e)
treeNodesChanged
in interface TreeModelListener
TreeModelListener.treeNodesChanged(javax.swing.event.TreeModelEvent)
public final void treeNodesInserted(TreeModelEvent e)
treeNodesInserted
in interface TreeModelListener
TreeModelListener.treeNodesInserted(javax.swing.event.TreeModelEvent)
public final void treeNodesRemoved(TreeModelEvent removalEvent)
treeNodesRemoved
in interface TreeModelListener
TreeModelListener.treeNodesRemoved(javax.swing.event.TreeModelEvent)
public final void treeStructureChanged(TreeModelEvent e)
treeStructureChanged
in interface TreeModelListener
TreeModelListener.treeStructureChanged(javax.swing.event.TreeModelEvent)
public final void updateTree()
updateTree(AjaxRequestTarget)
would be appropriate, but
you don't have the AjaxRequestTarget instance. However, it is also safe to call this method
outside Ajax response.
protected void addComponent(AjaxRequestTarget target, Component component)
target
- ajax request targetcomponent
- componentpublic void onTargetRespond(AjaxRequestTarget target)
AjaxRequestTarget.ITargetRespondListener
onTargetRespond
in interface AjaxRequestTarget.ITargetRespondListener
public final void updateTree(AjaxRequestTarget target)
You can only call this method once in a request.
target
- Ajax request target used to send the update to the pageprotected final boolean isNodeExpanded(Object node)
node
- The node to inspect
protected ITreeState newTreeState()
protected void onAfterRender()
onAfterRender
in class Component
protected abstract void populateTreeItem(WebMarkupContainer item, int level)
item
- newly created tree item. The node can be obtained as item.getModelObject()level
- how deep the component is in tree hierarchy (0 for root item)public final void markNodeDirty(Object node)
node
- nodepublic final void markNodeChildrenDirty(Object node)
node
- nodepublic Object getParentNode(Object node)
node
- node
public final Iterator<Object> nodeChildren(Object node)
node
- The tree node
public final Object getChildAt(Object parent, int index)
parent
- parent nodeindex
- index
public final boolean isLeaf(Object node)
node
- node
public final int getChildCount(Object parent)
parent
- parent node
public Component getNodeComponent(Object node)
node
- Tree node
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |