M
- the model typepublic class GroupingView<M> extends GridView<M> implements CollapseItemEvent.HasCollapseItemHandlers<List<M>>, ExpandItemEvent.HasExpandItemHandlers<List<M>>
GridView
that groups data based on a given grouping column.Modifier and Type | Class and Description |
---|---|
static class |
GroupingView.GroupingData<M>
Wrapper describing a given group, with the items in the group, and the value they hold in common.
|
static interface |
GroupingView.GroupingViewAppearance |
static interface |
GroupingView.GroupingViewStyle |
static interface |
GroupingView.GroupSummaryTemplate<M> |
GridView.GridAppearance, GridView.GridStateStyles, GridView.GridStyles, GridView.GridTemplates
Modifier and Type | Field and Description |
---|---|
protected boolean |
enableGrouping |
protected ColumnConfig<M,?> |
groupingColumn |
protected ColumnConfig<M,?> |
lastGroupField |
protected Map<Object,Boolean> |
state |
autoFill, body, borderWidth, cm, columnListener, dataTable, dataTableBody, dataTableSizingHead, deferUpdateDelay, deferUpdates, ds, emptyText, enableRowBody, footer, forceFit, grid, header, headerColumnIndex, headerDisabled, headerElem, lastViewWidth, listener, overRow, preventScrollToTopOnRefresh, scroller, scrollOffset, selectable, sortState, splitterWidth, states, storeSortInfo, styles, tpls, unselectable, vbar, viewConfig
Constructor and Description |
---|
GroupingView()
Creates a new grouping view instance.
|
GroupingView(GridView.GridAppearance appearance,
GroupingView.GroupingViewAppearance groupingAppearance)
Creates a new grouping view instance.
|
GroupingView(GroupingView.GroupingViewAppearance groupAppearance)
Creates a new grouping view instance.
|
Modifier and Type | Method and Description |
---|---|
HandlerRegistration |
addCollapseHandler(CollapseItemEvent.CollapseItemHandler<List<M>> handler)
Adds a
CollapseItemEvent.CollapseItemHandler handler for CollapseItemEvent
events. |
HandlerRegistration |
addExpandHandler(ExpandItemEvent.ExpandItemHandler<List<M>> handler)
Adds a
ExpandItemEvent.ExpandItemHandler handler for ExpandItemEvent events. |
protected void |
afterRender()
Invoked after the view element is first attached, performs steps that require that the view element is attached.
|
void |
collapseAllGroups()
Collapses all groups.
|
protected Menu |
createContextMenu(int colIndex)
Creates a context menu for the given column, including sort menu items and column visibility sub-menu.
|
protected List<GroupingView.GroupingData<M>> |
createGroupingData() |
protected List<GroupingView.GroupingData<M>> |
createGroupingData(List<M> rows,
int startGroupIndex) |
protected void |
doLastSort() |
protected SafeHtml |
doRender(List<ColumnData> cs,
List<M> rows,
int startRow)
Renders the grid view into safe HTML.
|
protected void |
doSort(int colIndex,
SortDir sortDir)
Defaults to assume one sort at a time.
|
void |
expandAllGroups()
Expands all groups.
|
protected int |
getGroupIndex(XElement group) |
GroupingView.GroupingViewAppearance |
getGroupingAppearance()
Returns the grouping view appearance.
|
protected <any> |
getGroups() |
protected <any> |
getRows()
Returns the HTML elements representing the body of the table.
|
Store.StoreSortInfo<M> |
getSortState()
Returns the grid's sort information.
|
void |
groupBy(ColumnConfig<M,?> column) |
boolean |
isEnabledNoGroups()
Returns true if the user can turn off grouping.
|
boolean |
isEnableGroupingMenu()
Returns true if the grouping menu is enabled.
|
boolean |
isExpanded(Element group)
Returns true if the group is expanded.
|
boolean |
isShowGroupedColumn()
Returns true if the grouped column is visible.
|
boolean |
isStartCollapsed()
Returns true if start collapsed is enabled.
|
protected GroupingView.GroupingData<M> |
makeGroupForRow(int groupIndex,
M firstModel,
Object value) |
protected void |
onAdd(List<M> models,
int index)
Handles adding new data models to the store.
|
protected void |
onMouseDown(Event ge)
Invoked when a mouse down event occurs, the default implementation for
GridView does nothing. |
protected void |
onRemove(M m,
int index,
boolean isUpdate)
Handles removing a data model from the store.
|
protected void |
refreshRow(int row)
Refreshes the displayed content for the given row.
|
protected void |
renderGroup(SafeHtmlBuilder buf,
GroupingView.GroupingData<M> g,
SafeHtml renderedRows) |
protected SafeHtml |
renderGroupHeader(GroupingView.GroupingData<M> groupInfo) |
protected SafeHtml |
renderRows(int startRow,
int endRow)
Renders the grid's rows.
|
void |
setEnableGroupingMenu(boolean enableGroupingMenu)
True to enable the the grouping menu items in the header context menu (defaults to true).
|
void |
setEnableNoGroups(boolean enableNoGroups)
True to enable the no groups menu item in the header context menu (defaults to true).
|
void |
setShowGroupedColumn(boolean showGroupedColumn)
Sets whether the grouped column is visible (defaults to true).
|
void |
setStartCollapsed(boolean startCollapsed)
Sets whether the groups should start collapsed (defaults to false).
|
void |
toggleAllGroups(boolean expanded)
Toggles all groups.
|
protected void |
toggleGroup(Element group,
boolean expanded)
Toggles the visibility of the group elements, but does not handle the internal state details or events.
|
protected void |
toggleGroup(int i,
boolean expanded)
Toggles the given group index, dealing with all logical and view details.
|
protected boolean |
valueBelongsInGroup(GroupingView.GroupingData<M> group,
Object value) |
protected void |
verifyNewGroup(List<GroupingView.GroupingData<M>> groups,
GroupingView.GroupingData<M> nextGroup)
Ensures that items which belong in the same group are not fragmented across multiple groups.
|
addHandler, adjustColumnWidths, applyEmptyText, autoExpand, calculateVBar, createStoreSortInfo, doAttach, doDetach, ensureVisible, ensureVisible, findCell, findCellIndex, findRow, findRowIndex, fireEvent, fitColumns, focus, focusCell, focusRow, getAppearance, getAutoExpandColumn, getAutoExpandMax, getAutoExpandMin, getBody, getCell, getColumnData, getColumnStyle, getColumnWidth, getColumnWidths, getEditorParent, getEmptyText, getHeader, getOffsetWidth, getRenderedValue, getRow, getRow, getRowBody, getRowBodyRowSpan, getScrollAdjust, getScroller, getScrollState, getStateStyles, getTotalWidth, getViewConfig, handleComponentEvent, hasRows, init, initData, initElements, initHeader, initListeners, initUI, insertRows, isAdjustForHScroll, isAutoFill, isColumnLines, isDeferUpdates, isEnableRowBody, isForceFit, isRemoteSort, isSelectableTarget, isShowDirtyCells, isSortingEnabled, isStripeRows, isTrackMouseOver, layout, layout, notifyHide, notifyShow, onCellDeselect, onCellSelect, onClear, onClick, onColumnMove, onColumnWidthChange, onDataChanged, onHeaderChange, onHeaderClick, onHiddenChange, onHighlightRow, onNoNext, onNoPrev, onRowDeselect, onRowOut, onRowOver, onRowSelect, onUpdate, processRows, refresh, removeRow, renderFooter, renderHeader, renderHiddenHeaders, renderUI, repaintGrid, resize, restoreScroll, scrollToTop, scrollToTop, setAdjustForHScroll, setAutoExpandColumn, setAutoExpandMax, setAutoExpandMin, setAutoFill, setColumnHeader, setColumnLines, setDeferUpdates, setEmptyText, setEnableRowBody, setForceFit, setRowBodyRowSpan, setShowDirtyCells, setSortingEnabled, setStripeRows, setTrackMouseOver, setViewConfig, syncHeaderScroll, syncScroll, templateOnAllColumnWidthsUpdated, templateOnColumnHiddenUpdated, templateOnColumnWidthUpdated, updateAllColumnWidths, updateColumnHidden, updateColumnWidth, updateHeaderSortState, updateSortIcon
protected ColumnConfig<M,?> lastGroupField
protected ColumnConfig<M,?> groupingColumn
protected boolean enableGrouping
public GroupingView()
public GroupingView(GridView.GridAppearance appearance, GroupingView.GroupingViewAppearance groupingAppearance)
appearance
- the grid appearancegroupingAppearance
- the grouping appearancepublic GroupingView(GroupingView.GroupingViewAppearance groupAppearance)
groupAppearance
- the group appearancepublic HandlerRegistration addCollapseHandler(CollapseItemEvent.CollapseItemHandler<List<M>> handler)
CollapseItemEvent.HasCollapseItemHandlers
CollapseItemEvent.CollapseItemHandler
handler for CollapseItemEvent
events.addCollapseHandler
in interface CollapseItemEvent.HasCollapseItemHandlers<List<M>>
handler
- the handlerpublic HandlerRegistration addExpandHandler(ExpandItemEvent.ExpandItemHandler<List<M>> handler)
ExpandItemEvent.HasExpandItemHandlers
ExpandItemEvent.ExpandItemHandler
handler for ExpandItemEvent
events.addExpandHandler
in interface ExpandItemEvent.HasExpandItemHandlers<List<M>>
handler
- the handlerpublic void collapseAllGroups()
public void expandAllGroups()
public GroupingView.GroupingViewAppearance getGroupingAppearance()
public Store.StoreSortInfo<M> getSortState()
GridView
getSortState
in class GridView<M>
public void groupBy(ColumnConfig<M,?> column)
public boolean isEnableGroupingMenu()
public void setEnableGroupingMenu(boolean enableGroupingMenu)
enableGroupingMenu
- true to enable the grouping menu itemspublic boolean isEnabledNoGroups()
public boolean isExpanded(Element group)
group
- the grouppublic boolean isShowGroupedColumn()
public void setShowGroupedColumn(boolean showGroupedColumn)
showGroupedColumn
- true to show the grouped columnpublic boolean isStartCollapsed()
public void setStartCollapsed(boolean startCollapsed)
startCollapsed
- true to start collapsedpublic void setEnableNoGroups(boolean enableNoGroups)
enableNoGroups
- true to enable no groups menu itempublic void toggleAllGroups(boolean expanded)
expanded
- true to expandprotected void afterRender()
GridView
afterRender
in class GridView<M>
protected Menu createContextMenu(int colIndex)
GridView
createContextMenu
in class GridView<M>
colIndex
- the column indexprotected List<GroupingView.GroupingData<M>> createGroupingData()
createGroupingData(java.util.List, int)
protected List<GroupingView.GroupingData<M>> createGroupingData(List<M> rows, int startGroupIndex)
rows
- set of rows in the store to build into groupsstartGroupIndex
- the index to use for the first group in the returned listcreateGroupingData()
protected void doLastSort()
protected SafeHtml doRender(List<ColumnData> cs, List<M> rows, int startRow)
GridView
protected void doSort(int colIndex, SortDir sortDir)
GridView
protected int getGroupIndex(XElement group)
protected <any> getGroups()
protected <any> getRows()
GridView
protected GroupingView.GroupingData<M> makeGroupForRow(int groupIndex, M firstModel, Object value)
groupIndex
- the index of this groupfirstModel
- the first model to add to the groupvalue
- the value that this group is based onprotected void onAdd(List<M> models, int index)
GridView
protected void onMouseDown(Event ge)
GridView
GridView
does nothing.onMouseDown
in class GridView<M>
protected void onRemove(M m, int index, boolean isUpdate)
GridView
protected void refreshRow(int row)
GridView
refreshRow
in class GridView<M>
row
- the row indexprotected void renderGroup(SafeHtmlBuilder buf, GroupingView.GroupingData<M> g, SafeHtml renderedRows)
protected SafeHtml renderGroupHeader(GroupingView.GroupingData<M> groupInfo)
protected SafeHtml renderRows(int startRow, int endRow)
GridView
renderRows
in class GridView<M>
startRow
- the index in the store of the first row to renderendRow
- the index of the last row to render (may be -1 to indicate all rows)protected void toggleGroup(int i, boolean expanded)
protected void toggleGroup(Element group, boolean expanded)
protected boolean valueBelongsInGroup(GroupingView.GroupingData<M> group, Object value)
group
- a group that the value might matchvalue
- an object which may match the data in group.getValue()protected void verifyNewGroup(List<GroupingView.GroupingData<M>> groups, GroupingView.GroupingData<M> nextGroup)
assert
or Class.desiredAssertionStatus()
to ensure that
this won't be in the compiled app if assertions are disabled.groups
- all groups created before the current onenextGroup
- the next group to add to the list, assuming it shouldn't already be listed thereCopyright © 2018. All rights reserved.