Package com.inmethod.grid.treegrid
Class TreeGrid<T extends TreeModel & Serializable,I extends TreeNode & Serializable,S>
java.lang.Object
org.apache.wicket.Component
org.apache.wicket.MarkupContainer
org.apache.wicket.markup.html.WebMarkupContainer
org.apache.wicket.markup.html.panel.Panel
com.inmethod.grid.common.AbstractGrid<T,I,S>
com.inmethod.grid.treegrid.TreeGrid<T,I,S>
- Type Parameters:
T
- tree model object typeI
- node model object type
- All Implemented Interfaces:
Serializable
,Iterable<Component>
,IEventSink
,IEventSource
,IFeedbackContributor
,IConverterLocator
,IMetadataContext<Serializable,
,Component> IQueueRegion
,IHeaderContributor
,IRequestableComponent
,IHierarchical<Component>
,IClusterable
public class TreeGrid<T extends TreeModel & Serializable,I extends TreeNode & Serializable,S>
extends AbstractGrid<T,I,S>
Advanced grid with a tree. Supports resizable and reorderable columns.
- Author:
- Matej Knopp
- See Also:
-
Field Summary
Fields inherited from class com.inmethod.grid.common.AbstractGrid
CSS, INTERNAL_TOOLBAR_ITEM_ID, JS_DOM, JS_EVENT, JS_SCRIPT, JS_SCRIPT_JQ, JS_YAHOO, THEME_VISTA
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_INITIALIZED, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER, RFLAG_CONTAINER_DEQUEING, RFLAG_CONTAINER_HAS_REMOVALS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfindParentRow
(Component child) Returns the row in DataTable that contains the child componentprotected WebMarkupContainer
findRowComponent
(IModel<I> rowModel) Returns the row component for specified item.Returns the collection of models of all currently selected items.org.apache.wicket.extensions.markup.html.tree.AbstractTree
getTree()
Returns the inner tree of theTreeGrid
.org.apache.wicket.extensions.markup.html.tree.ITreeState
Returns the tree stateboolean
Returns whether user will be able to select more than one item at a time.boolean
Returns whether children of selected nodes should be automatically treated as selected node.boolean
isItemSelected
(IModel<I> itemModel) Queries whether the item specified by itemModel is currently selected.void
markItemDirty
(IModel<I> model) Marks the item from the given model as dirty.protected void
onJunctionLinkClicked
(AjaxRequestTarget target, Object node) Callback function called after user clicked on an junction link.void
Deselects all items.void
Marks all currently displayed items as selected.void
selectItem
(IModel<I> itemModel, boolean selected) Alters the selection state of item specified by the item model.void
setAllowSelectMultiple
(boolean value) Sets whether user will be able to select more than one item.void
setAutoSelectChildren
(boolean autoSelectChildren) Sets whether children of selected node should automatically be treated as selected nodes (defaulttrue
).final void
update()
During Ajax request updates the changed parts of tree.Methods inherited from class com.inmethod.grid.common.AbstractGrid
addBottomToolbar, addHeaderToolbar, addTopToolbar, cleanLastClickedColumn, columnSanityCheck, disableRowClickNotifications, getActiveColumns, getAllColumns, getColumnState, getContentHeight, getContentHeightSizeUnit, getForm, getLastClickedColumn, getSortState, getTheme, isClickRowToDeselect, isClickRowToSelect, isItemEdited, isSelectToEdit, isUseYui, onAfterRender, onBeforeRender, onCellClicked, onColumnStateChanged, onComponentTag, onInitialize, onItemSelectionChanged, onRowClicked, onRowPopulated, onSortStateChanged, renderHead, setClickRowToDeselect, setClickRowToSelect, setColumnState, setContentHeight, setItemEdit, setSelectToEdit, setTheme, setUseYui
Methods inherited from class org.apache.wicket.markup.html.panel.Panel
getRegionMarkup, newMarkupSourcingStrategy
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSession
Methods inherited from class org.apache.wicket.MarkupContainer
add, addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeue, dequeuePreamble, findChildComponent, findComponentToDequeue, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onComponentTagBody, onDetach, onRender, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, stream, streamChildren, toString, toString, visitChildren, visitChildren
Methods inherited from class org.apache.wicket.Component
add, addStateChange, beforeRender, canCallListener, canCallListenerAfterExpiry, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, createConverter, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMarkupTag, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnModelChanged, internalRenderComponent, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isInitialized, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, onConfigure, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderPart, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlForListener, urlForListener, visitParents, visitParents, warn, wrap
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.wicket.IQueueRegion
dequeue, newDequeueContext
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
TreeGrid
Creates a newTreeGrid
instance.- Parameters:
id
- component idmodel
- model used to access theTreeModel
columns
- list ofIGridColumn
s.
-
TreeGrid
Creates a newTreeGrid
instance.- Parameters:
id
- component idmodel
- tree modelcolumns
- list ofIGridColumn
s.
-
-
Method Details
-
getTree
public org.apache.wicket.extensions.markup.html.tree.AbstractTree getTree()Returns the inner tree of theTreeGrid
.- Returns:
- inner tree
-
getTreeState
public org.apache.wicket.extensions.markup.html.tree.ITreeState getTreeState()Returns the tree state- Returns:
- tree state
-
update
public final void update()During Ajax request updates the changed parts of tree.- Specified by:
update
in classAbstractGrid<T extends TreeModel & Serializable,
I extends TreeNode & Serializable, S>
-
onJunctionLinkClicked
Callback function called after user clicked on an junction link. The node has already been expanded/collapsed (depending on previous status).- Parameters:
target
- Request target - may be null on non-ajax callnode
- Node for which this callback is relevant
-
getSelectedItems
Returns the collection of models of all currently selected items.- Specified by:
getSelectedItems
in classAbstractGrid<T extends TreeModel & Serializable,
I extends TreeNode & Serializable, S> - Returns:
- collection of models of currently selected items
-
isAllowSelectMultiple
public boolean isAllowSelectMultiple()Returns whether user will be able to select more than one item at a time.- Specified by:
isAllowSelectMultiple
in classAbstractGrid<T extends TreeModel & Serializable,
I extends TreeNode & Serializable, S> - Returns:
true
if multiple items can be selected at a time,false
otherwise.
-
setAllowSelectMultiple
public void setAllowSelectMultiple(boolean value) Sets whether user will be able to select more than one item.- Specified by:
setAllowSelectMultiple
in classAbstractGrid<T extends TreeModel & Serializable,
I extends TreeNode & Serializable, S> - Parameters:
value
-true
if the user will be able to select more than one item at a time,false
otherwise (single selection mode).
-
isItemSelected
Queries whether the item specified by itemModel is currently selected.- Specified by:
isItemSelected
in classAbstractGrid<T extends TreeModel & Serializable,
I extends TreeNode & Serializable, S> - Parameters:
itemModel
- item model- Returns:
true
if the item is selected,false
otherwise
-
resetSelectedItems
public void resetSelectedItems()Deselects all items. This method marks all items (not just visible items) as no selected.- Specified by:
resetSelectedItems
in classAbstractGrid<T extends TreeModel & Serializable,
I extends TreeNode & Serializable, S>
-
selectAllVisibleItems
public void selectAllVisibleItems()Marks all currently displayed items as selected. ForDataGrid
this selects all items on current page, forTreeGrid
this selects all currently visible nodes.- Specified by:
selectAllVisibleItems
in classAbstractGrid<T extends TreeModel & Serializable,
I extends TreeNode & Serializable, S>
-
findRowComponent
Description copied from class:AbstractGrid
Returns the row component for specified item.- Specified by:
findRowComponent
in classAbstractGrid<T extends TreeModel & Serializable,
I extends TreeNode & Serializable, S> - Returns:
-
markItemDirty
Description copied from class:AbstractGrid
Marks the item from the given model as dirty. Dirty items are updated during Ajax requests whenAbstractGrid.update()
method is called.- Specified by:
markItemDirty
in classAbstractGrid<T extends TreeModel & Serializable,
I extends TreeNode & Serializable, S> - Parameters:
model
- model used to access the item
-
selectItem
Alters the selection state of item specified by the item model.- Specified by:
selectItem
in classAbstractGrid<T extends TreeModel & Serializable,
I extends TreeNode & Serializable, S> - Parameters:
itemModel
- item modelselected
-true
if the item should be selected,false
otherwise.
-
findParentRow
Description copied from class:AbstractGrid
Returns the row in DataTable that contains the child component- Specified by:
findParentRow
in classAbstractGrid<T extends TreeModel & Serializable,
I extends TreeNode & Serializable, S> - Returns:
-
setAutoSelectChildren
public void setAutoSelectChildren(boolean autoSelectChildren) Sets whether children of selected node should automatically be treated as selected nodes (defaulttrue
). Such children can not be deselected individually. AlsoITreeState.isNodeSelected(Object)
returnstrue
if any of node parent is selected. On the contrary,ITreeState.getSelectedNodes()
only returns "top level" selected nodes.- Parameters:
autoSelectChildren
-
-
isAutoSelectChildren
public boolean isAutoSelectChildren()Returns whether children of selected nodes should be automatically treated as selected node.- Returns:
-