public class GridView<M> extends Object
Grid. Methods of
this class may be used to access user interface elements to enable special
display effects. Do not change the DOM structure of the user interface.
This class does not provide ways to manipulate the underlying data. The data
model of a Grid is held in a ListStore.| Constructor and Description |
|---|
GridView() |
| Modifier and Type | Method and Description |
|---|---|
Point |
ensureVisible(int row,
int col,
boolean hscroll)
Ensured the current row and column is visible.
|
Element |
findCell(Element elem)
Returns the cell.
|
int |
findCellIndex(Element elem,
String requiredStyle)
Returns the cell index.
|
Element |
findRow(Element el)
Returns the row element.
|
int |
findRowIndex(Element elem)
Returns the row index.
|
void |
focusCell(int rowIndex,
int colIndex,
boolean hscroll)
Focus the cell and scrolls into view.
|
void |
focusRow(int rowIndex)
Focus the row and scrolls into view.
|
ColumnConfig<M,?> |
getAutoExpandColumn()
Returns the auto expand column id.
|
int |
getAutoExpandMax()
Returns the auto expand maximum width.
|
int |
getAutoExpandMin()
Returns the auto expand minimum width.
|
XElement |
getBody()
Returns the grid's body element.
|
Element |
getCell(int row,
int col)
Returns the grid's <TD> HtmlElement at the specified coordinates.
|
int |
getCellSelectorDepth()
Returns the cell selector depth.
|
Element |
getEditorParent()
Returns the editor parent element.
|
String |
getEmptyText()
Returns the empty text.
|
ColumnHeader<M> |
getHeader()
Returns the grid's column header.
|
Element |
getHeaderCell(int index)
Returns the <TD> HtmlElement which represents the Grid's header cell for
the specified column index.
|
Element |
getInnerCellElement(int row,
int col)
Returns the HtmlElement that represents a cell for the given row and
column.
|
Element |
getRow(int row)
Return the <TR> HtmlElement which represents a Grid row for the
specified index.
|
Element |
getRow(M m)
Return the <TR> HtmlElement which represents a Grid row for the
specified model.
|
int |
getRowSelectorDepth()
Returns the row selector depth.
|
XElement |
getScroller()
Returns the scroll element.
|
Point |
getScrollState()
Returns the current scroll state.
|
GridViewConfig<M> |
getViewConfig()
Returns the view config.
|
boolean |
isAdjustForHScroll()
Returns true if the grid width will be adjusted based on visibility of
horizontal scroll bar.
|
boolean |
isAutoFill()
Returns true if auto fill is enabled.
|
boolean |
isForceFit()
Returns true if force fit is enabled.
|
boolean |
isSelectableTarget(Element target)
Returns true if the given element is selectable.
|
boolean |
isShowDirtyCells()
Returns true if dirty cell markers are enabled.
|
boolean |
isSortingEnabled()
Returns true if sorting is enabled.
|
void |
layout()
Lays out the grid view, adjusting the header and footer width and
accounting for force fit and auto fill settings.
|
void |
refresh(boolean headerToo)
Rebuilds the grid using its current configuration and data.
|
void |
scrollToTop()
Scrolls the grid to the top.
|
void |
setAdjustForHScroll(boolean adjustForHScroll)
True to adjust the grid width when the horizontal scrollbar is hidden and
visible (defaults to true).
|
void |
setAutoExpandColumn(ColumnConfig<M,?> autoExpandColumn)
The id of a column in this grid that should expand to fill unused space
(pre-render).
|
void |
setAutoExpandMax(int autoExpandMax)
The maximum width the autoExpandColumn can have (if enabled) (defaults to
500, pre-render).
|
void |
setAutoExpandMin(int autoExpandMin)
The minimum width the autoExpandColumn can have (if enabled)(pre-render).
|
void |
setAutoFill(boolean autoFill)
True to auto expand the columns to fit the grid when the grid is
created.
|
void |
setCellSelectorDepth(int cellSelectorDepth)
The number of levels to search for cells in event delegation (defaults to
4).
|
void |
setEmptyText(String emptyText)
Default text to display in the grid body when no rows are available
(defaults to '').
|
void |
setForceFit(boolean forceFit)
True to auto expand/contract the size of the columns to fit the grid width
and prevent horizontal scrolling.
|
void |
setRowSelectorDepth(int rowSelectorDepth)
The number of levels to search for rows in event delegation (defaults to
10).
|
void |
setShowDirtyCells(boolean showDirtyCells)
True to display a red triangle in the upper left corner of any cells which
are "dirty" as defined by any existing records in the data store (defaults
to true).
|
void |
setSortingEnabled(boolean sortable)
True to allow column sorting when the user clicks a column (defaults to
true).
|
void |
setViewConfig(GridViewConfig<M> viewConfig)
Sets the view config.
|
public Point ensureVisible(int row, int col, boolean hscroll)
row - the row indexcol - the column indexhscroll - true to scroll horizontally if neededpublic Element findCell(Element elem)
elem - the cell element or a child elementpublic int findCellIndex(Element elem, String requiredStyle)
elem - the cell or child elementrequiredStyle - an optional required style namepublic Element findRow(Element el)
el - the row element or any child elementpublic int findRowIndex(Element elem)
elem - the row or child of the row elementpublic void focusCell(int rowIndex,
int colIndex,
boolean hscroll)
rowIndex - the row indexcolIndex - the column indexhscroll - true to scroll horizontallypublic void focusRow(int rowIndex)
rowIndex - the row indexpublic ColumnConfig<M,?> getAutoExpandColumn()
public int getAutoExpandMax()
public int getAutoExpandMin()
public XElement getBody()
public Element getCell(int row, int col)
row - the row index in which to find the cellcol - the column index of the cellpublic int getCellSelectorDepth()
public Element getEditorParent()
public String getEmptyText()
public ColumnHeader<M> getHeader()
public Element getHeaderCell(int index)
index - the column indexpublic Element getInnerCellElement(int row, int col)
row - the row indexcol - the column indexpublic Element getRow(int row)
row - the row indexpublic Element getRow(M m)
m - the modelpublic int getRowSelectorDepth()
public XElement getScroller()
public Point getScrollState()
public GridViewConfig<M> getViewConfig()
public boolean isAdjustForHScroll()
public boolean isAutoFill()
public boolean isForceFit()
public boolean isSelectableTarget(Element target)
target - the element to checkpublic boolean isShowDirtyCells()
public boolean isSortingEnabled()
public void layout()
public void refresh(boolean headerToo)
headerToo - true to refresh the headerpublic void scrollToTop()
public void setAdjustForHScroll(boolean adjustForHScroll)
adjustForHScroll - true to adjust for horizontal scroll barpublic void setAutoExpandColumn(ColumnConfig<M,?> autoExpandColumn)
autoExpandColumn - the auto expand columnpublic void setAutoExpandMax(int autoExpandMax)
autoExpandMax - the auto expand maxpublic void setAutoExpandMin(int autoExpandMin)
autoExpandMin - the auto expand min widthpublic void setAutoFill(boolean autoFill)
autoFill - true to expandpublic void setCellSelectorDepth(int cellSelectorDepth)
cellSelectorDepth - the cell selector depthpublic void setEmptyText(String emptyText)
emptyText - the empty textpublic void setForceFit(boolean forceFit)
forceFit - true to force fitpublic void setRowSelectorDepth(int rowSelectorDepth)
rowSelectorDepth - the row selector depthpublic void setShowDirtyCells(boolean showDirtyCells)
showDirtyCells - true to display the dirty flagpublic void setSortingEnabled(boolean sortable)
sortable - true for sortable columnspublic void setViewConfig(GridViewConfig<M> viewConfig)
viewConfig - the view configCopyright © 2012. All Rights Reserved.