|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.extjs.gxt.ui.client.widget.Component
com.extjs.gxt.ui.client.widget.BoxComponent
com.extjs.gxt.ui.client.widget.grid.Grid<M>
M
- the model typepublic class Grid<M extends ModelData>
This class represents the primary interface of a component based grid
control. The grid requires a ListStore
and
ColumnModel
when constructed. Each model in the store will be
rendered as a row in the grid. Any updates to the store are automatically
pushed to the grid. This includes inserting, removing, sorting and filter.
setAutoExpandColumn(String)
.GridView.setAutoFill(boolean)
to
enable this feature. With auto fill, the calculations are only run once.
After the grid is rendered, the columns widths will not be adjusted when
available width changes. You can use @link
GridView.setForceFit(boolean)
to always run the width calculations on
any changes to available width or column sizes. Columns can be "fixed" which
prevents their columns widths to be adjusted by the grid "weight"
calculations. See @link ColumnConfig.setFixed(boolean)
.Component.setStateful(boolean)
. When the store uses a
PagingListLoader
the offset and limit parameter are saved with
the Grid's state. These 2 values can be retrieved and used to make the first
load request to return the user to the same location they left the grid.
Code snippet:
PagingLoadConfig config = new BasePagingLoadConfig(); config.setOffset(0); config.setLimit(50); Mapstate = grid.getState(); if (state.containsKey("offset")) { int offset = (Integer)state.get("offset"); int limit = (Integer)state.get("limit"); config.setOffset(offset); config.setLimit(limit); } if (state.containsKey("sortField")) { config.setSortField((String)state.get("sortField")); config.setSortDir(SortDir.valueOf((String)state.get("sortDir"))); } loader.load(config);
BaseEvent.setCancelled(boolean)
.BaseEvent.setCancelled(boolean)
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject |
---|
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled |
Field Summary | |
---|---|
protected ColumnModel |
cm
|
protected EditorSupport<M> |
editSupport
|
protected GridSelectionModel<M> |
sm
|
protected ListStore<M> |
store
|
protected ModelStringProvider<M> |
stringProvider
|
protected GridView |
view
|
protected boolean |
viewReady
|
Fields inherited from class com.extjs.gxt.ui.client.widget.BoxComponent |
---|
adjustSize, cacheSizes, ensureVisibilityOnSizing, height, lastSize, layer, shim, width |
Fields inherited from class com.extjs.gxt.ui.client.widget.Component |
---|
afterRender, attachables, baseStyle, disabled, disabledStyle, disableTextSelection, dummy, focusable, hidden, mask, maskMessage, maskMessageStyleName, monitorWindowResize, rendered, resizeHandler, setElementRender, stateId, swallowEvents, toolTip, windowResizeDelay, windowResizeTask |
Fields inherited from class com.google.gwt.user.client.ui.UIObject |
---|
DEBUG_ID_PREFIX |
Constructor Summary | |
---|---|
protected |
Grid()
|
|
Grid(ListStore<M> store,
ColumnModel cm)
Creates a new grid. |
Method Summary | |
---|---|
protected void |
afterRender()
Called after the component has been rendered and is attached for the first time. |
protected void |
afterRenderView()
|
protected void |
applyState(java.util.Map<java.lang.String,java.lang.Object> state)
|
protected ComponentEvent |
createComponentEvent(com.google.gwt.user.client.Event event)
|
void |
disableTextSelection(boolean disable)
Enables and disables text selection for the component. |
protected void |
doApplyStoreState(java.util.Map<java.lang.String,java.lang.Object> state)
|
protected void |
doAttachChildren()
|
protected void |
doDetachChildren()
|
java.lang.String |
getAutoExpandColumn()
Returns the auto expand column id. |
int |
getAutoExpandMax()
Returns the auto expand maximum width. |
int |
getAutoExpandMin()
Returns the auto expand minimum width. |
ColumnModel |
getColumnModel()
Returns the column model. |
protected EditorSupport<M> |
getEditSupport()
|
protected El |
getFocusEl()
|
int |
getLazyRowRender()
Returns the time in ms after the rows get rendered. |
int |
getMinColumnWidth()
Returns the minimum column width. |
ModelProcessor<M> |
getModelProcessor()
Returns the model processor. |
GridSelectionModel<M> |
getSelectionModel()
Returns the grid's selection model. |
ListStore<M> |
getStore()
Returns the grid's store. |
GridView |
getView()
Returns the grid's view. |
boolean |
isColumnLines()
Returns true if column lines are enabled. |
boolean |
isColumnReordering()
Returns true if column reordering is enabled. |
boolean |
isColumnResize()
Returns true if column resizing is enabled. |
boolean |
isHideHeaders()
Returns true if the header is hidden. |
boolean |
isLoadMask()
Returns true if the load mask in enabled. |
boolean |
isStripeRows()
Returns true if row striping is enabled. |
boolean |
isTrackMouseOver()
Returns true if rows are highlighted on mouse over. |
boolean |
isViewReady()
Returns true if the view is ready. |
protected void |
notifyHide()
|
protected void |
notifyShow()
|
protected void |
onAfterRenderView()
|
protected void |
onBlur(ComponentEvent ce)
|
protected void |
onClick(GridEvent<M> e)
|
void |
onComponentEvent(ComponentEvent ce)
Any events a component receives will be forwarded to this method. |
protected void |
onDisable()
|
protected void |
onDoubleClick(GridEvent<M> e)
|
protected void |
onEnable()
|
protected void |
onFocus(ComponentEvent ce)
|
protected void |
onMouseDown(GridEvent<M> e)
|
protected void |
onMouseUp(GridEvent<M> e)
|
protected void |
onRender(com.google.gwt.user.client.Element target,
int index)
Subclasses must override and ensure setElement is called for lazy rendered components. |
protected void |
onResize(int width,
int height)
Called after the component is resized, this method is empty by default but can be implemented by any subclass that needs to perform custom logic after a resize occurs. |
void |
reconfigure(ListStore<M> store,
ColumnModel cm)
Reconfigures the grid to use a different Store and Column Model. |
protected void |
setAriaRole(java.lang.String roleName)
|
protected void |
setAriaState(java.lang.String stateName,
java.lang.String stateValue)
|
void |
setAutoExpandColumn(java.lang.String 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 |
setColumnLines(boolean columnLines)
True to enable column separation lines (defaults to false). |
void |
setColumnReordering(boolean enableColumnReorder)
True to enable column reordering via drag and drop (defaults to false). |
void |
setColumnResize(boolean enableColumnResize)
Sets whether columns may be resized (defaults to true). |
void |
setHideHeaders(boolean hideHeaders)
Sets whether the header should be hidden (defaults to false). |
void |
setLazyRowRender(int lazyRowRender)
Sets the time in ms after the row gets rendered (defaults to 10). |
void |
setLoadMask(boolean loadMask)
Sets whether a load mask should be displayed during load operations (defaults to false). |
void |
setMinColumnWidth(int minColumnWidth)
The minimum width a column can be resized to (defaults to 25). |
void |
setModelProcessor(ModelProcessor<M> modelProcessor)
Sets the grid's model processor. |
void |
setSelectionModel(GridSelectionModel<M> sm)
Sets the grid selection model. |
void |
setStringProvider(ModelStringProvider<M> stringProvider)
Sets the binder's string provider. |
void |
setStripeRows(boolean stripeRows)
True to stripe the rows (defaults to false). |
void |
setTrackMouseOver(boolean trackMouseOver)
True to highlight rows when the mouse is over (defaults to true). |
void |
setView(GridView view)
Sets the view's grid (pre-render). |
protected GridSelectionModel.Cell |
walkCells(int row,
int col,
int step,
GridSelectionModel.Callback callback,
boolean acceptNavs)
|
Methods inherited from class com.extjs.gxt.ui.client.widget.BoxComponent |
---|
adjustPosition, adjustSize, getBounds, getHeight, getHeight, getPosition, getPositionEl, getResizeEl, getShadow, getShadowOffset, getShadowPosition, getSize, getWidth, getWidth, hideShadow, hideShim, hideUnders, isAutoHeight, isAutoWidth, isDeferHeight, isShim, onHide, onPosition, onShow, onUnload, setAutoHeight, setAutoWidth, setBounds, setBounds, setDeferHeight, setHeight, setHeight, setPagePosition, setPagePosition, setPixelSize, setPosition, setShadow, setShadowOffset, setShadowPosition, setShim, setSize, setSize, setWidth, setWidth, sync, syncSize |
Methods inherited from class com.google.gwt.user.client.ui.Widget |
---|
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, setLayoutData |
Methods inherited from class com.google.gwt.user.client.ui.UIObject |
---|
addStyleDependentName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, removeStyleDependentName, setElement, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, sinkBitlessEvent, unsinkEvents |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected ColumnModel cm
protected EditorSupport<M extends ModelData> editSupport
protected GridSelectionModel<M extends ModelData> sm
protected ListStore<M extends ModelData> store
protected ModelStringProvider<M extends ModelData> stringProvider
protected GridView view
protected boolean viewReady
Constructor Detail |
---|
public Grid(ListStore<M> store, ColumnModel cm)
store
- the data storecm
- the column modelprotected Grid()
Method Detail |
---|
public void disableTextSelection(boolean disable)
Component
disableTextSelection
in class Component
disable
- true
to disable text selectionpublic java.lang.String getAutoExpandColumn()
public int getAutoExpandMax()
public int getAutoExpandMin()
public ColumnModel getColumnModel()
public int getLazyRowRender()
public int getMinColumnWidth()
public ModelProcessor<M> getModelProcessor()
public GridSelectionModel<M> getSelectionModel()
public ListStore<M> getStore()
public GridView getView()
public boolean isColumnLines()
public boolean isColumnReordering()
public boolean isColumnResize()
public boolean isHideHeaders()
public boolean isLoadMask()
public boolean isStripeRows()
public boolean isTrackMouseOver()
public boolean isViewReady()
public void onComponentEvent(ComponentEvent ce)
Component
Component.onBrowserEvent(com.google.gwt.user.client.Event)
method
should not be overridden or modified.
onComponentEvent
in class Component
ce
- the base eventpublic void reconfigure(ListStore<M> store, ColumnModel cm)
store
- the new storecm
- the new column modelpublic void setAutoExpandColumn(java.lang.String autoExpandColumn)
autoExpandColumn
- the auto expand column idpublic void setAutoExpandMax(int autoExpandMax)
autoExpandMax
- the auto expand maxpublic void setAutoExpandMin(int autoExpandMin)
autoExpandMin
- the auto expand min widthpublic void setColumnLines(boolean columnLines)
columnLines
- true to enable column separation linespublic void setColumnReordering(boolean enableColumnReorder)
enableColumnReorder
- true to enablepublic void setColumnResize(boolean enableColumnResize)
enableColumnResize
- true to allow column resizingpublic void setHideHeaders(boolean hideHeaders)
hideHeaders
- true to hide the headerpublic void setLazyRowRender(int lazyRowRender)
lazyRowRender
- the time in ms after the rows get rendered.public void setLoadMask(boolean loadMask)
loadMask
- true to show a maskpublic void setMinColumnWidth(int minColumnWidth)
minColumnWidth
- the min column widthpublic void setModelProcessor(ModelProcessor<M> modelProcessor)
modelProcessor
- ModelProcessor
public void setSelectionModel(GridSelectionModel<M> sm)
sm
- the selection modelpublic void setStringProvider(ModelStringProvider<M> stringProvider)
stringProvider
- the string providerpublic void setStripeRows(boolean stripeRows)
stripeRows
- true to strip rowspublic void setTrackMouseOver(boolean trackMouseOver)
trackMouseOver
- true to highlight rows on mouse overpublic void setView(GridView view)
view
- the viewprotected void afterRender()
Component
afterRender
in class BoxComponent
protected void afterRenderView()
protected void applyState(java.util.Map<java.lang.String,java.lang.Object> state)
applyState
in class Component
protected ComponentEvent createComponentEvent(com.google.gwt.user.client.Event event)
createComponentEvent
in class BoxComponent
protected void doApplyStoreState(java.util.Map<java.lang.String,java.lang.Object> state)
protected void doAttachChildren()
doAttachChildren
in class Component
protected void doDetachChildren()
doDetachChildren
in class Component
protected EditorSupport<M> getEditSupport()
protected El getFocusEl()
getFocusEl
in class Component
protected void notifyHide()
notifyHide
in class Component
protected void notifyShow()
notifyShow
in class Component
protected void onAfterRenderView()
protected void onBlur(ComponentEvent ce)
protected void onClick(GridEvent<M> e)
protected void onDisable()
onDisable
in class Component
protected void onDoubleClick(GridEvent<M> e)
protected void onEnable()
onEnable
in class Component
protected void onFocus(ComponentEvent ce)
protected void onMouseDown(GridEvent<M> e)
protected void onMouseUp(GridEvent<M> e)
protected void onRender(com.google.gwt.user.client.Element target, int index)
Component
onRender
in class Component
target
- the target elementindex
- the insert locationprotected void onResize(int width, int height)
BoxComponent
onResize
in class BoxComponent
width
- the widthheight
- the heightprotected void setAriaRole(java.lang.String roleName)
setAriaRole
in class Component
protected void setAriaState(java.lang.String stateName, java.lang.String stateValue)
setAriaState
in class Component
protected GridSelectionModel.Cell walkCells(int row, int col, int step, GridSelectionModel.Callback callback, boolean acceptNavs)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |