com.extjs.gxt.ui.client.widget.grid
Class Grid<M extends ModelData>

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.extjs.gxt.ui.client.widget.Component
              extended by com.extjs.gxt.ui.client.widget.BoxComponent
                  extended by com.extjs.gxt.ui.client.widget.grid.Grid<M>
Type Parameters:
M - the model type
All Implemented Interfaces:
Observable, com.google.gwt.user.client.EventListener
Direct Known Subclasses:
EditorGrid

public class Grid<M extends ModelData>
extends BoxComponent

This class represents the primary interface of a component based grid control.

Events:
CellClick : GridEvent(grid, rowIndex, cellIndex, event)
Fires after a cell is clicked.
CellDoubleClick : GridEvent(grid, rowIndex, cellIndex, event)
Fires after a cell is double clicked.
CellMouseDown : GridEvent(grid, rowIndex, cellIndex, event)
Fires before a cell is clicked.
RowClick : GridEvent(grid, rowIndex, cellIndex, event)
Fires after a row is clicked.
RowDoubleClick : GridEvent(grid, rowIndex, cellIndex, event)
Fires after a row is double clicked.
RowMouseDown : GridEvent(grid, rowIndex, colIndex, event)
Fires before a row is clicked.
HeaderClick : GridEvent(grid, rowIndex, colIndex, event)
Fires a header is clicked.
HeaderDoubleClick : GridEvent(grid, rowIndex, colIndex, event)
Fires a header is double clicked.
HeaderMouseDown : GridEvent(grid, rowIndex, colIndex, event)
Fires before a header is clicked.
ContextMenu : GridEvent(grid)
Fires before the grid's context menu is shown. Listeners can set the doit field to false to cancel the action.
HeaderContextMenu : TableEvent(grid, colIndex, menu)
Fires right before the header's context menu is displayed.
BodyScroll : GridEvent(grid, srollLeft, scrollTop)
Fires when the body element is scrolled.
ColumnResize : GridEvent(grid, colIndex, width)
Fires when the user resizes a column.
ColumnMove : GridEvent(grid, colIndex, size)
Fires when the user moves a column.
SortChange : GridEvent(grid, sortInfo)
Fires when the grid's store sort changes.

 

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
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
Grid(ListStore<M> store, ColumnModel cm)
          Creates a new grid.
 
Method Summary
 java.lang.String getAutoExpandColumn()
          Returns the auto expand column id.
 int getAutoExpandMax()
          Returns the auto expand maximum width.
 int getAutoExpandMin()
          Returns the auto expand miniumum width.
 ColumnModel getColumnModel()
          Returns the column model.
 int getMinColumnWidth()
          Returns the minimum column width.
 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 isEnableColumnResize()
          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.
 void onComponentEvent(ComponentEvent ce)
          Any events a component receives will be forwarded to this method.
 void reconfigure(ListStore<M> store, ColumnModel cm)
          Reconfigures the grid to use a different Store and Column Model.
 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 1000, pre-render).
 void setAutoExpandMin(int autoExpandMin)
          The minimum width the autoExpandColumn can have (if enabled)(pre-render).
 void setContextMenu(Menu menu)
          Sets the component's context menu.
 void setEnableColumnResize(boolean enableColumnResize)
          Sets wheter columns may be resized (defaults to true).
 void setHideHeaders(boolean hideHeaders)
          Sets wheter the header should be hidden (defaults to false).
 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 setSelectionModel(GridSelectionModel<M> sm)
          Sets the grid selection model.
 void setStringProvider(ModelStringProvider 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).
 
Methods inherited from class com.extjs.gxt.ui.client.widget.BoxComponent
getBounds, getHeight, getHeight, getPosition, getShadow, getSize, getWidth, getWidth, isAutoHeight, isAutoWidth, isDeferHeight, isShim, setAutoHeight, setAutoWidth, setBounds, setBounds, setDeferHeight, setHeight, setHeight, setPagePosition, setPagePosition, setPixelSize, setPosition, setShadow, setShim, setSize, setSize, setWidth, setWidth
 
Methods inherited from class com.extjs.gxt.ui.client.widget.Component
addListener, addPlugin, addStyleName, addWidgetListener, disable, disableEvents, disableTextSelection, el, enable, enableEvents, fireEvent, fireEvent, fireEvent, fly, focus, getBaseStyle, getBorders, getData, getData, getElement, getId, getItemId, getModel, getState, getToolTip, hide, hideToolTip, isDisabledEvents, isEnabled, isRendered, isVisible, onBrowserEvent, recalculate, removeAllListeners, removeFromParent, removeListener, removeStyleName, removeWidgetListener, render, render, saveState, setBorders, setData, setData, setElement, setEnabled, setEnableState, setId, setIntStyleAttribute, setItemId, setStyleAttribute, setStyleName, setTitle, setToolTip, setToolTip, setVisible, show, sinkEvents, toString
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
getParent, isAttached
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, setStylePrimaryName, setVisible, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Grid

public Grid(ListStore<M> store,
            ColumnModel cm)
Creates a new grid.

Parameters:
store - the data store
cm - the column model
Method Detail

getAutoExpandColumn

public java.lang.String getAutoExpandColumn()
Returns the auto expand column id.

Returns:
the auto expand column id

getAutoExpandMax

public int getAutoExpandMax()
Returns the auto expand maximum width.

Returns:
the max width in pixels

getAutoExpandMin

public int getAutoExpandMin()
Returns the auto expand miniumum width.

Returns:
the minimum width in pixels

getColumnModel

public ColumnModel getColumnModel()
Returns the column model.

Returns:
the colum model

getMinColumnWidth

public int getMinColumnWidth()
Returns the minimum column width.

Returns:
the min width in pixels

getSelectionModel

public GridSelectionModel<M> getSelectionModel()
Returns the grid's selection model.

Returns:
the selection model

getStore

public ListStore<M> getStore()
Returns the grid's store.

Returns:
the store

getView

public GridView getView()
Returns the grid's view.

Returns:
the grid view

isEnableColumnResize

public boolean isEnableColumnResize()
Returns true if column resizing is enabled.

Returns:
true if resizing is enabled

isHideHeaders

public boolean isHideHeaders()
Returns true if the header is hidden.

Returns:
true for hidden

isLoadMask

public boolean isLoadMask()
Returns true if the load mask in enabled.

Returns:
the load mask state

isStripeRows

public boolean isStripeRows()
Returns true if row striping is enabled.

Returns:
the strip row state

isTrackMouseOver

public boolean isTrackMouseOver()
Returns true if rows are highlighted on mouse over.

Returns:
the track mouse state

onComponentEvent

public void onComponentEvent(ComponentEvent ce)
Description copied from class: Component
Any events a component receives will be forwarded to this method. Subclasses should override as needed. The Component.onBrowserEvent(com.google.gwt.user.client.Event) method should not be overridden or modified.

Overrides:
onComponentEvent in class Component
Parameters:
ce - the base event

reconfigure

public void reconfigure(ListStore<M> store,
                        ColumnModel cm)
Reconfigures the grid to use a different Store and Column Model. The View will be bound to the new objects and refreshed.

Parameters:
store - the new store
cm - the new column model

setAutoExpandColumn

public void setAutoExpandColumn(java.lang.String autoExpandColumn)
The id of a column in this grid that should expand to fill unused space (pre-render). This id can not be 0.

Parameters:
autoExpandColumn - the auto expand column id

setAutoExpandMax

public void setAutoExpandMax(int autoExpandMax)
The maximum width the autoExpandColumn can have (if enabled) (defaults to 1000, pre-render).

Parameters:
autoExpandMax - the auto expand max

setAutoExpandMin

public void setAutoExpandMin(int autoExpandMin)
The minimum width the autoExpandColumn can have (if enabled)(pre-render).

Parameters:
autoExpandMin - the auto expand min width

setContextMenu

public void setContextMenu(Menu menu)
Description copied from class: Component
Sets the component's context menu.

Parameters:
menu - the context menu

setEnableColumnResize

public void setEnableColumnResize(boolean enableColumnResize)
Sets wheter columns may be resized (defaults to true).

Parameters:
enableColumnResize - true to allow column resizing

setHideHeaders

public void setHideHeaders(boolean hideHeaders)
Sets wheter the header should be hidden (defaults to false).

Parameters:
hideHeaders - true to hide the header

setLoadMask

public void setLoadMask(boolean loadMask)
Sets whether a load mask should be displayed during load operations (defaults to false).

Parameters:
loadMask - true to show a mask

setMinColumnWidth

public void setMinColumnWidth(int minColumnWidth)
The minimum width a column can be resized to (defaults to 25).

Parameters:
minColumnWidth - the min column width

setSelectionModel

public void setSelectionModel(GridSelectionModel<M> sm)
Sets the grid selection model.

Parameters:
sm - the selection mdoel

setStringProvider

public void setStringProvider(ModelStringProvider stringProvider)
Sets the binder's string provider.

Parameters:
stringProvider - the string provider

setStripeRows

public void setStripeRows(boolean stripeRows)
True to stripe the rows (defaults to false).

Parameters:
stripeRows - true to strip rows

setTrackMouseOver

public void setTrackMouseOver(boolean trackMouseOver)
True to highlight rows when the mouse is over (defaults to true).

Parameters:
trackMouseOver - true to highlight rows on mouse over

setView

public void setView(GridView view)
Sets the view's grid (pre-render).

Parameters:
view - the view