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_VISTAFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindParentRow(Component child) Returns the row in DataTable that contains the child componentprotected WebMarkupContainerfindRowComponent(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.AbstractTreegetTree()Returns the inner tree of theTreeGrid.org.apache.wicket.extensions.markup.html.tree.ITreeStateReturns the tree statebooleanReturns whether user will be able to select more than one item at a time.booleanReturns whether children of selected nodes should be automatically treated as selected node.booleanisItemSelected(IModel<I> itemModel) Queries whether the item specified by itemModel is currently selected.voidmarkItemDirty(IModel<I> model) Marks the item from the given model as dirty.protected voidonJunctionLinkClicked(AjaxRequestTarget target, Object node) Callback function called after user clicked on an junction link.voidDeselects all items.voidMarks all currently displayed items as selected.voidselectItem(IModel<I> itemModel, boolean selected) Alters the selection state of item specified by the item model.voidsetAllowSelectMultiple(boolean value) Sets whether user will be able to select more than one item.voidsetAutoSelectChildren(boolean autoSelectChildren) Sets whether children of selected node should automatically be treated as selected nodes (defaulttrue).final voidupdate()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, setUseYuiMethods inherited from class org.apache.wicket.markup.html.panel.Panel
getRegionMarkup, newMarkupSourcingStrategyMethods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSessionMethods 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, visitChildrenMethods 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, wrapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.wicket.IQueueRegion
dequeue, newDequeueContextMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
TreeGrid
Creates a newTreeGridinstance.- Parameters:
id- component idmodel- model used to access theTreeModelcolumns- list ofIGridColumns.
-
TreeGrid
Creates a newTreeGridinstance.- Parameters:
id- component idmodel- tree modelcolumns- list ofIGridColumns.
-
-
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:
updatein 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:
getSelectedItemsin 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:
isAllowSelectMultiplein classAbstractGrid<T extends TreeModel & Serializable,I extends TreeNode & Serializable, S> - Returns:
trueif multiple items can be selected at a time,falseotherwise.
-
setAllowSelectMultiple
public void setAllowSelectMultiple(boolean value) Sets whether user will be able to select more than one item.- Specified by:
setAllowSelectMultiplein classAbstractGrid<T extends TreeModel & Serializable,I extends TreeNode & Serializable, S> - Parameters:
value-trueif the user will be able to select more than one item at a time,falseotherwise (single selection mode).
-
isItemSelected
Queries whether the item specified by itemModel is currently selected.- Specified by:
isItemSelectedin classAbstractGrid<T extends TreeModel & Serializable,I extends TreeNode & Serializable, S> - Parameters:
itemModel- item model- Returns:
trueif the item is selected,falseotherwise
-
resetSelectedItems
public void resetSelectedItems()Deselects all items. This method marks all items (not just visible items) as no selected.- Specified by:
resetSelectedItemsin classAbstractGrid<T extends TreeModel & Serializable,I extends TreeNode & Serializable, S>
-
selectAllVisibleItems
public void selectAllVisibleItems()Marks all currently displayed items as selected. ForDataGridthis selects all items on current page, forTreeGridthis selects all currently visible nodes.- Specified by:
selectAllVisibleItemsin classAbstractGrid<T extends TreeModel & Serializable,I extends TreeNode & Serializable, S>
-
findRowComponent
Description copied from class:AbstractGridReturns the row component for specified item.- Specified by:
findRowComponentin classAbstractGrid<T extends TreeModel & Serializable,I extends TreeNode & Serializable, S> - Returns:
-
markItemDirty
Description copied from class:AbstractGridMarks the item from the given model as dirty. Dirty items are updated during Ajax requests whenAbstractGrid.update()method is called.- Specified by:
markItemDirtyin 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:
selectItemin classAbstractGrid<T extends TreeModel & Serializable,I extends TreeNode & Serializable, S> - Parameters:
itemModel- item modelselected-trueif the item should be selected,falseotherwise.
-
findParentRow
Description copied from class:AbstractGridReturns the row in DataTable that contains the child component- Specified by:
findParentRowin 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)returnstrueif 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:
-