M
- grid model object typeI
- row/item model object typepublic abstract class AbstractGrid<M,I,S>
extends org.apache.wicket.markup.html.panel.Panel
Modifier and Type | Field and Description |
---|---|
static org.apache.wicket.request.resource.PackageResourceReference |
CSS |
static String |
INTERNAL_TOOLBAR_ITEM_ID
INTERNAL
|
static org.apache.wicket.request.resource.JavaScriptResourceReference |
JS_DOM |
static org.apache.wicket.request.resource.JavaScriptResourceReference |
JS_EVENT |
static org.apache.wicket.request.resource.JavaScriptResourceReference |
JS_SCRIPT |
static org.apache.wicket.request.resource.JavaScriptResourceReference |
JS_SCRIPT_JQ |
static org.apache.wicket.request.resource.JavaScriptResourceReference |
JS_YAHOO |
static String |
THEME_VISTA
Constant for the Vista theme (default).
|
Constructor and Description |
---|
AbstractGrid(String id,
org.apache.wicket.model.IModel<M> model,
List<IGridColumn<M,I,S>> columns)
Creates new
AbstractGrid instance |
Modifier and Type | Method and Description |
---|---|
void |
addBottomToolbar(AbstractToolbar<M,I,S> toolbar)
Adds a toolbar to the bottom section (below the actual data).
|
void |
addHeaderToolbar(AbstractHeaderToolbar<M,I,S> toolbar)
Ads a toolbar to the header section (below the grid header, above the actual data).
|
void |
addTopToolbar(AbstractToolbar<M,I,S> toolbar)
Adds a toolbar to the top section (above the grid header).
|
void |
cleanLastClickedColumn() |
protected void |
columnSanityCheck(IGridColumn<M,I,S> column)
Checks whether the column is a valid grid column
|
protected boolean |
disableRowClickNotifications() |
abstract org.apache.wicket.markup.html.WebMarkupContainer |
findParentRow(org.apache.wicket.Component child)
Returns the row in DataTable that contains the child component
|
protected abstract org.apache.wicket.markup.html.WebMarkupContainer |
findRowComponent(org.apache.wicket.model.IModel<I> rowModel)
Returns the row component for specified item.
|
Collection<IGridColumn<M,I,S>> |
getActiveColumns()
Returns collection of currently visible columns.
|
List<IGridColumn<M,I,S>> |
getAllColumns()
Returns the list of all columns in this grid.
|
ColumnsState |
getColumnState()
Returns the column state.
|
int |
getContentHeight()
Returns the content height.
|
SizeUnit |
getContentHeightSizeUnit()
Returns the size unit for content height.
|
org.apache.wicket.markup.html.form.Form<Void> |
getForm() |
IGridColumn<M,I,S> |
getLastClickedColumn() |
abstract Collection<org.apache.wicket.model.IModel<I>> |
getSelectedItems()
Returns the collection of models of all currently selected items.
|
GridSortState<S> |
getSortState()
Returns the sort state of this grid.
|
String |
getTheme()
Returns the theme identifier
|
abstract boolean |
isAllowSelectMultiple()
Returns whether user will be able to select more than one item at a time.
|
boolean |
isClickRowToDeselect()
Returns whether clicking a selected row deselects it.
|
boolean |
isClickRowToSelect()
Returns whether a click on grid row should select/deselect the row.
|
boolean |
isItemEdited(org.apache.wicket.model.IModel<I> rowModel)
Returns whether the row is in editable mode.
|
abstract boolean |
isItemSelected(org.apache.wicket.model.IModel<I> itemModel)
Queries whether the item specified by itemModel is currently selected.
|
boolean |
isSelectToEdit()
Returns whether selected rows are also editable.
|
boolean |
isUseYui() |
abstract void |
markItemDirty(org.apache.wicket.model.IModel<I> model)
Marks the item from the given model as dirty.
|
protected void |
onAfterRender() |
protected void |
onBeforeRender() |
protected boolean |
onCellClicked(org.apache.wicket.ajax.AjaxRequestTarget target,
org.apache.wicket.model.IModel<I> rowModel,
IGridColumn<M,I,S> column) |
void |
onColumnStateChanged()
Invoked when client change the column state (e.g.
|
protected void |
onComponentTag(org.apache.wicket.markup.ComponentTag tag) |
protected void |
onInitialize() |
protected void |
onItemSelectionChanged(org.apache.wicket.model.IModel<I> item,
boolean newValue)
Invoked when an item selection state has been changed.
|
protected void |
onRowClicked(org.apache.wicket.ajax.AjaxRequestTarget target,
org.apache.wicket.model.IModel<I> rowModel) |
protected void |
onRowPopulated(org.apache.wicket.markup.html.WebMarkupContainer rowComponent)
Called after a grid row has been populated.
|
protected void |
onSortStateChanged(org.apache.wicket.ajax.AjaxRequestTarget target)
Invoked when sort state of this grid has changed (e.g.
|
void |
renderHead(org.apache.wicket.markup.head.IHeaderResponse response) |
abstract void |
resetSelectedItems()
Deselects all items.
|
abstract void |
selectAllVisibleItems()
Marks all currently displayed items as selected.
|
abstract void |
selectItem(org.apache.wicket.model.IModel<I> itemModel,
boolean selected)
Alters the selection state of item specified by the item model.
|
abstract void |
setAllowSelectMultiple(boolean value)
Sets whether user will be able to select more than one item.
|
void |
setClickRowToDeselect(boolean clickRowToDeselect)
Sets whether a click on selected grid row should deselect it.
|
AbstractGrid<M,I,S> |
setClickRowToSelect(boolean clickRowToSelect)
Sets whether a click on grid row should select/deselect the row.
|
void |
setColumnState(ColumnsState columnState)
Sets a new column state.
|
void |
setContentHeight(Integer contentHeight,
SizeUnit contentSizeUnit)
Sets the height of grid content.
|
void |
setItemEdit(org.apache.wicket.model.IModel<I> rowModel,
boolean edit)
Sets the edit mode of the row.
|
void |
setSelectToEdit(boolean selectToEdit)
Determines whether selected items should also be editable.
|
void |
setTheme(String theme)
Sets the grid theme.
|
void |
setUseYui(boolean useYui) |
abstract void |
update()
During an Ajax request this method updates the changed grid rows.
|
getWebPage, getWebRequest, getWebResponse, getWebSession
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onComponentTagBody, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, 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, 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, internalPrepareForRender, internalRenderComponent, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, onConfigure, onDetach, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, visitParents, warn, wrap
public static final String INTERNAL_TOOLBAR_ITEM_ID
Id of toolbar item (inside toolbar repeaters).
public static final String THEME_VISTA
public static final org.apache.wicket.request.resource.JavaScriptResourceReference JS_YAHOO
public static final org.apache.wicket.request.resource.JavaScriptResourceReference JS_EVENT
public static final org.apache.wicket.request.resource.JavaScriptResourceReference JS_DOM
public static final org.apache.wicket.request.resource.JavaScriptResourceReference JS_SCRIPT
public static final org.apache.wicket.request.resource.JavaScriptResourceReference JS_SCRIPT_JQ
public static final org.apache.wicket.request.resource.PackageResourceReference CSS
public AbstractGrid(String id, org.apache.wicket.model.IModel<M> model, List<IGridColumn<M,I,S>> columns)
AbstractGrid
instanceid
- model
- columns
- public org.apache.wicket.markup.html.form.Form<Void> getForm()
protected void columnSanityCheck(IGridColumn<M,I,S> column)
column
- public void onColumnStateChanged()
getColumnState()
public ColumnsState getColumnState()
ColumnsState
public void setColumnState(ColumnsState columnState)
columnState
- new column stateColumnsState
protected void onInitialize()
onInitialize
in class org.apache.wicket.Component
protected void onBeforeRender()
onBeforeRender
in class org.apache.wicket.Component
protected void onAfterRender()
onAfterRender
in class org.apache.wicket.Component
public void addTopToolbar(AbstractToolbar<M,I,S> toolbar)
toolbar
- toolbar instanceAbstractToolbar
public void addBottomToolbar(AbstractToolbar<M,I,S> toolbar)
toolbar
- toolbar instanceAbstractToolbar
public void addHeaderToolbar(AbstractHeaderToolbar<M,I,S> toolbar)
toolbar
- toolbar instanceAbstractToolbar
protected void onSortStateChanged(org.apache.wicket.ajax.AjaxRequestTarget target)
target
- public Collection<IGridColumn<M,I,S>> getActiveColumns()
public List<IGridColumn<M,I,S>> getAllColumns()
public GridSortState<S> getSortState()
IGridSortState
,
GridSortState
public void setTheme(String theme)
theme
- theme identifierpublic String getTheme()
setTheme(String)
protected void onComponentTag(org.apache.wicket.markup.ComponentTag tag)
onComponentTag
in class org.apache.wicket.Component
public void renderHead(org.apache.wicket.markup.head.IHeaderResponse response)
renderHead
in interface org.apache.wicket.markup.html.IHeaderContributor
renderHead
in class org.apache.wicket.Component
public abstract void selectItem(org.apache.wicket.model.IModel<I> itemModel, boolean selected)
itemModel
- item modelselected
- true
if the item should be selected, false
otherwise.public abstract void selectAllVisibleItems()
public abstract void resetSelectedItems()
public abstract boolean isItemSelected(org.apache.wicket.model.IModel<I> itemModel)
itemModel
- item modeltrue
if the item is selected, false
otherwisepublic abstract Collection<org.apache.wicket.model.IModel<I>> getSelectedItems()
public abstract void setAllowSelectMultiple(boolean value)
value
- true
if the user will be able to select more than one item at a time,
false
otherwise (single selection mode).public abstract boolean isAllowSelectMultiple()
true
if multiple items can be selected at a time, false
otherwise.public abstract void update()
The definition of "changed" varies in DataGrid
and TreeGrid
.
TreeGrid
the changes to TreeModel
itself are being tracked (assuming
the proper listeners are fired) and all rows that need to be updated are also considered
changed.
DataGrid
the items that need to be updated can be marked by
DataGrid.markItemDirty(IModel)
or DataGrid.markAllItemsDirty()
. The grid
itself doesn't track changes to specific items (apart from the selection state).
protected void onItemSelectionChanged(org.apache.wicket.model.IModel<I> item, boolean newValue)
item
- item modelnewValue
- true
if the item became selected, false
otherwise.public IGridColumn<M,I,S> getLastClickedColumn()
public void cleanLastClickedColumn()
protected boolean disableRowClickNotifications()
protected void onRowPopulated(org.apache.wicket.markup.html.WebMarkupContainer rowComponent)
rowComponent
- protected boolean onCellClicked(org.apache.wicket.ajax.AjaxRequestTarget target, org.apache.wicket.model.IModel<I> rowModel, IGridColumn<M,I,S> column)
protected void onRowClicked(org.apache.wicket.ajax.AjaxRequestTarget target, org.apache.wicket.model.IModel<I> rowModel)
public AbstractGrid<M,I,S> setClickRowToSelect(boolean clickRowToSelect)
clickRowToSelect
- true
if the row selection state should be changed upon a mouse click,
false
otherwise.this
(useful for method chaining)setClickRowToDeselect(boolean)
public boolean isClickRowToSelect()
true
if the row click should alter the row selection state,
false
otherwise.public void setClickRowToDeselect(boolean clickRowToDeselect)
setClickRowToSelect(boolean)
is set to true
.clickRowToDeselect
- whether clicking a selected row should deselect itpublic boolean isClickRowToDeselect()
true
if clicking a selected row deselects it, false
otherwise.public void setContentHeight(Integer contentHeight, SizeUnit contentSizeUnit)
contentHeight
- desired height of the content or null
is the height should be
determined by the actual height (no scrollbar displayed, defalt value)contentSizeUnit
- size unit for the contentHeight
public int getContentHeight()
setContentHeight(Integer, SizeUnit)
public SizeUnit getContentHeightSizeUnit()
public abstract org.apache.wicket.markup.html.WebMarkupContainer findParentRow(org.apache.wicket.Component child)
child
- protected abstract org.apache.wicket.markup.html.WebMarkupContainer findRowComponent(org.apache.wicket.model.IModel<I> rowModel)
rowModel
- public abstract void markItemDirty(org.apache.wicket.model.IModel<I> model)
update()
method is called.model
- model used to access the itempublic void setSelectToEdit(boolean selectToEdit)
false
when the grid is both selectable and editable (independently).selectToEdit
- whether selected rows should be editablepublic boolean isSelectToEdit()
public void setItemEdit(org.apache.wicket.model.IModel<I> rowModel, boolean edit)
selectItem(IModel, boolean)
.rowModel
- row modeledit
- true
if the row should be in editable mode, false
otherwise.setSelectToEdit(boolean)
public boolean isItemEdited(org.apache.wicket.model.IModel<I> rowModel)
rowModel
- true
if the row is in editable mode, false
otherwise.public boolean isUseYui()
public void setUseYui(boolean useYui)
Copyright © 2015. All rights reserved.