Package org.wicketstuff
Class QuickGridView<T>
-
- All Implemented Interfaces:
Serializable
,Iterable<Component>
,IEventSink
,IEventSource
,IFeedbackContributor
,IConverterLocator
,IMetadataContext<Serializable,Component>
,IHeaderContributor
,IPageable
,IRequestableComponent
,IHierarchical<Component>
,IClusterable
,IQuickView
public abstract class QuickGridView<T> extends QuickViewBase<T>
it renders items in rows and columns in table/grid format(same as GridView).it also lets you add and remove rows in ajax cases without the need to repaint parent(adding parent to AjaxRequestTarget causes re-rendering of whole repeater)the preferred way to use QuickGridView is with boundaries ie. two components, one placed before and one placed after quickview in markup ,together they determine start and end of quickview
- Author:
- Vineet Semwal
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
QuickGridView.CellItem<T>
a cell item represents one cell of the QuickGridViewstatic class
QuickGridView.RowItem<T>
-
Nested classes/interfaces inherited from class org.wicketstuff.QuickViewBase
QuickViewBase.ModelIterator<T>
-
-
Field Summary
Fields Modifier and Type Field Description static String
COLUMNS_REPEATER_ID
-
Fields inherited from class org.wicketstuff.QuickViewBase
SYNCHRONIZER_KEY
-
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
Constructors Constructor Description QuickGridView(String id, IDataProvider<T> dataProvider)
QuickGridView(String id, IDataProvider<T> dataProvider, Component start, Component end)
QuickGridView(String id, IDataProvider<T> dataProvider, IQuickReuseStrategy reuseStrategy)
QuickGridView(String id, IDataProvider<T> dataProvider, IQuickReuseStrategy reuseStrategy, Component start, Component end)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description List<Item<T>>
addItemsForPage(long page)
create and draw children for the provided page ,number of children created are smaller than equal to getItemsPerRequest()QuickGridView<T>
addRow(QuickGridView.RowItem<T> rowItem)
QuickGridView<T>
addRowAtStart(QuickGridView.RowItem<T> rowItem)
QuickGridView<T>
addRows(Iterator<? extends T> iterator)
adds rows and their corresponding cellsQuickGridView<T>
addRowsAtStart(Iterator<? extends T> iterator)
QuickGridView.CellItem<T>
buildCellItem(int index, IModel<T> model)
protected QuickGridView.CellItem<T>
buildCellItem(String id, int index, IModel<T> model)
QuickGridView.CellItem<T>
buildCellItem(String id, int index, T object)
build cell item means the new cellitem is created and then populated with populate(cell)protected Iterator<QuickGridView.CellItem<T>>
buildCells(int index, Iterator<? extends T> iterator)
QuickGridView.CellItem<T>
buildEmptyCellItem(int index)
builds cell item by creating new cellitem and then populating by populateEmptyItem(cell)QuickGridView.CellItem<T>
buildEmptyCellItem(String id, int index)
builds cell item by creating new cellitem and then populating by populateEmptyItem(cell)protected Iterator<Item<T>>
buildItems(int index, Iterator<? extends T> iterator)
QuickGridView.RowItem
buildRowItem()
build row itemQuickGridView.RowItem
buildRowItem(String id, int index)
protected Iterator<QuickGridView.RowItem<T>>
buildRows(int rowIndex, Iterator<QuickGridView.CellItem<T>> iterator)
Iterator<QuickGridView.RowItem<T>>
buildRows(Iterator<? extends T> iterator)
Iterator<QuickGridView.CellItem<T>>
cells()
returns iterator to iterate through cells in the order they are renderedvoid
createChildren(Iterator<Item<T>> itemIterator)
IItemFactory<T>
factory()
int
getColumns()
int
getRows()
int
gridSize()
protected QuickGridView.CellItem<T>
newCellItem(String id, int index, IModel<T> model)
QuickGridView.CellItem<T>
newEmptyCellItem(String id, int index)
protected QuickGridView.RowItem<T>
newRowItem(String id, int index)
new rowItemprotected void
populate(Item<T> item)
protected abstract void
populate(QuickGridView.CellItem<T> item)
protected abstract void
populateEmptyItem(QuickGridView.CellItem<T> item)
void
removeRow(QuickGridView.RowItem<T> rowItem)
Iterator<QuickGridView.RowItem<T>>
rows()
returns iterator to iterate through rows in the order they are renderedQuickGridView<T>
setColumns(int cols)
Sets number of columnsQuickGridView<T>
setRows(int rows)
Sets number of rows per pageMarkupContainer
simpleAddRow(Component... components)
it's a simple add,new item is not drawn just added,no js firedMarkupContainer
simpleRemoveAllRows()
MarkupContainer
simpleRemoveRow(Component c)
it's a simple remove,the item is just removed from quickview ,no js firedprotected void
updateItemsPerPage()
-
Methods inherited from class org.wicketstuff.QuickViewBase
_contributeAddAtEndScripts, _contributeAddAtStartScripts, _getCurrentPage, _getPageCount, _getParent, _getRequestMetaData, _setCurrentPage, _setRequestMetaData, add, addAtStart, addItemsForNextPage, addNewItems, addNewItemsAtStart, buildItem, buildItem, buildItem, buildItem, buildItems, buildItemsList, buildItemsList, findPartialPageRequestHandler, getAddAtStartStore, getAjaxRequestTarget, getCurrentPage, getDataProvider, getEnd, getItems, getItemsCount, getItemsPerRequest, getPageCount, getPartialRequestHandlers, getRepeaterUtil, getReuseStrategy, getRowsCount, getStart, getSynchronizer, initializeAddAtStartStoreIfRequired, isAjax, iterator, newAddAtStartStore, newChildId, newDefaultSynchronizer, newItem, newModels, nonARTSynchronizer, onDetach, onPopulate, register, remove, remove, renderHead, scrollTo, scrollToBottom, scrollToTop, setCurrentPage, setItemsPerRequest, setReuseStrategy, simpleAdd, simpleRemove, simpleRemoveAll
-
Methods inherited from class org.apache.wicket.markup.repeater.RepeatingView
renderIterator
-
Methods inherited from class org.apache.wicket.markup.repeater.AbstractRepeater
dequeue, getMarkup, onBeforeRender, onRender, renderChild
-
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSession
-
Methods inherited from class org.apache.wicket.MarkupContainer
addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeuePreamble, findChildComponent, findComponentToDequeue, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkupType, getRegionMarkup, internalAdd, internalInitialize, iterator, newDequeueContext, onComponentTagBody, onInitialize, queue, removeAll, renderAll, renderAssociatedMarkup, 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, newMarkupSourcingStrategy, onAfterRender, onComponentTag, 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.wicketstuff.IQuickView
getParent
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
COLUMNS_REPEATER_ID
public static final String COLUMNS_REPEATER_ID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
QuickGridView
public QuickGridView(String id, IDataProvider<T> dataProvider, IQuickReuseStrategy reuseStrategy)
- Parameters:
id
- component iddataProvider
- data provider
-
QuickGridView
public QuickGridView(String id, IDataProvider<T> dataProvider)
- Parameters:
id
- component iddataProvider
- data provider
-
QuickGridView
public QuickGridView(String id, IDataProvider<T> dataProvider, IQuickReuseStrategy reuseStrategy, Component start, Component end)
- Parameters:
id
- component iddataProvider
- data provider
-
QuickGridView
public QuickGridView(String id, IDataProvider<T> dataProvider, Component start, Component end)
- Parameters:
id
- component iddataProvider
- data provider
-
-
Method Detail
-
getColumns
public int getColumns()
-
setColumns
public QuickGridView<T> setColumns(int cols)
Sets number of columns- Parameters:
cols
- number of columns- Returns:
- this for chaining
-
updateItemsPerPage
protected void updateItemsPerPage()
-
getRows
public int getRows()
-
setRows
public QuickGridView<T> setRows(int rows)
Sets number of rows per page- Parameters:
rows
- number of rows- Returns:
- this for chaining
-
factory
public IItemFactory<T> factory()
- Overrides:
factory
in classQuickViewBase<T>
-
populate
protected final void populate(Item<T> item)
- Specified by:
populate
in classQuickViewBase<T>
-
populate
protected abstract void populate(QuickGridView.CellItem<T> item)
-
populateEmptyItem
protected abstract void populateEmptyItem(QuickGridView.CellItem<T> item)
-
addRowAtStart
public QuickGridView<T> addRowAtStart(QuickGridView.RowItem<T> rowItem)
-
addRow
public QuickGridView<T> addRow(QuickGridView.RowItem<T> rowItem)
-
addRows
public QuickGridView<T> addRows(Iterator<? extends T> iterator)
adds rows and their corresponding cells- Parameters:
iterator
- data for which rows and their corresponding cells will be added- Returns:
- this
-
addRowsAtStart
public QuickGridView<T> addRowsAtStart(Iterator<? extends T> iterator)
-
removeRow
public void removeRow(QuickGridView.RowItem<T> rowItem)
-
simpleAddRow
public MarkupContainer simpleAddRow(Component... components)
it's a simple add,new item is not drawn just added,no js fired- Parameters:
components
- component to be added- Returns:
- this
-
simpleRemoveRow
public MarkupContainer simpleRemoveRow(Component c)
it's a simple remove,the item is just removed from quickview ,no js fired- Parameters:
c
-- Returns:
- this
-
simpleRemoveAllRows
public MarkupContainer simpleRemoveAllRows()
-
buildItems
protected Iterator<Item<T>> buildItems(int index, Iterator<? extends T> iterator)
- Overrides:
buildItems
in classQuickViewBase<T>
- Parameters:
index
- cellindex from where new cell items should be addediterator
- data- Returns:
- iterator of RowItem which are created with their corresponding cells attached to them
-
buildRows
public Iterator<QuickGridView.RowItem<T>> buildRows(Iterator<? extends T> iterator)
- Parameters:
iterator
- data- Returns:
- iterator of RowItem which are created with their corresponding cells attached to them
-
createChildren
public void createChildren(Iterator<Item<T>> itemIterator)
- Overrides:
createChildren
in classQuickViewBase<T>
-
buildRows
protected Iterator<QuickGridView.RowItem<T>> buildRows(int rowIndex, Iterator<QuickGridView.CellItem<T>> iterator)
-
buildCells
protected Iterator<QuickGridView.CellItem<T>> buildCells(int index, Iterator<? extends T> iterator)
-
addItemsForPage
public List<Item<T>> addItemsForPage(long page)
Description copied from interface:IQuickView
create and draw children for the provided page ,number of children created are smaller than equal to getItemsPerRequest()- Specified by:
addItemsForPage
in interfaceIQuickView<T>
- Overrides:
addItemsForPage
in classQuickViewBase<T>
- Returns:
- list of components created
-
gridSize
public int gridSize()
-
newRowItem
protected QuickGridView.RowItem<T> newRowItem(String id, int index)
new rowItem- Parameters:
id
- childidindex
- index- Returns:
- RowItem
-
buildCellItem
public QuickGridView.CellItem<T> buildCellItem(String id, int index, T object)
build cell item means the new cellitem is created and then populated with populate(cell)- Parameters:
id
- cell's idindex
- cell's indexobject
- model object set to the cellitem- Returns:
- CellItem
-
buildCellItem
protected QuickGridView.CellItem<T> buildCellItem(String id, int index, IModel<T> model)
-
buildEmptyCellItem
public QuickGridView.CellItem<T> buildEmptyCellItem(int index)
builds cell item by creating new cellitem and then populating by populateEmptyItem(cell)- Returns:
- CellItem
-
buildEmptyCellItem
public QuickGridView.CellItem<T> buildEmptyCellItem(String id, int index)
builds cell item by creating new cellitem and then populating by populateEmptyItem(cell)- Returns:
- CellItem
-
buildRowItem
public QuickGridView.RowItem buildRowItem(String id, int index)
-
buildRowItem
public QuickGridView.RowItem buildRowItem()
build row item- Returns:
- new row item
-
rows
public Iterator<QuickGridView.RowItem<T>> rows()
returns iterator to iterate through rows in the order they are rendered- Returns:
- rows iterator
-
cells
public Iterator<QuickGridView.CellItem<T>> cells()
returns iterator to iterate through cells in the order they are rendered- Returns:
- cells iterator
-
newCellItem
protected QuickGridView.CellItem<T> newCellItem(String id, int index, IModel<T> model)
-
buildCellItem
public QuickGridView.CellItem<T> buildCellItem(int index, IModel<T> model)
-
newEmptyCellItem
public QuickGridView.CellItem<T> newEmptyCellItem(String id, int index)
-
-