com.extjs.gxt.ui.client.widget.grid
Class RowEditor<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.Container<T>
                      extended by com.extjs.gxt.ui.client.widget.ScrollContainer<Component>
                          extended by com.extjs.gxt.ui.client.widget.LayoutContainer
                              extended by com.extjs.gxt.ui.client.widget.ContentPanel
                                  extended by com.extjs.gxt.ui.client.widget.grid.RowEditor<M>
Type Parameters:
M - the model type
All Implemented Interfaces:
Observable, ComponentPlugin, IconSupport, com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.IsWidget

public class RowEditor<M extends ModelData>
extends ContentPanel
implements ComponentPlugin

This RowEditor should be used as a plugin to Grid. It displays an editor for all cells in a row.

Events:
BeforeEdit : RowEditorEvent(rowEditor, rowIndex)
Fires before row editing is triggered. Listeners can cancel the action by calling BaseEvent.setCancelled(boolean).
ValidateEdit : RowEditorEvent(rowEditor, rowIndex, changes)
Fires right before the model is updated. Listeners can cancel the action by calling BaseEvent.setCancelled(boolean).
AfterEdit : RowEditorEvent(rowEditor, rowIndex, changes)
Fires after a row has been edited.


Nested Class Summary
 class RowEditor.RowEditorMessages
           
 
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  ContentPanel btns
           
protected  Button cancelBtn
           
protected  Grid<M> grid
           
protected  RowEditor.RowEditorMessages messages
           
protected  boolean renderButtons
           
protected  int rowIndex
           
protected  Button saveBtn
           
 
Fields inherited from class com.extjs.gxt.ui.client.widget.ContentPanel
bbarStyle, bodStyle, body, bwrap, bwrapStyle, collapseStyle, fbar, footerStyle, frame, head, headerStyle, headerTextStyle, tbarStyle
 
Fields inherited from class com.extjs.gxt.ui.client.widget.Container
attachChildren, enableLayout, layoutExecuted, layoutNeeded, layoutOnAttach, layoutOnChange
 
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
RowEditor()
           
 
Method Summary
protected  void afterRender()
          Called after the component has been rendered and is attached for the first time.
protected  void bindHandler()
           
protected  void createButtons()
           
protected  void deferFocus(int colIndex)
           
protected  void deferFocus(Point pt)
           
protected  void doAttachChildren()
           
protected  void doDetachChildren()
           
protected  void doFocus(int colIndex)
           
protected  void doFocus(Point pt)
           
protected  void ensureVisible(CellEditor editor)
           
protected  Component findField(com.google.gwt.user.client.Element elem)
           
 EditorGrid.ClicksToEdit getClicksToEdit()
          Returns the clicks to edit.
protected  java.lang.String getErrorText()
           
 RowEditor.RowEditorMessages getMessages()
          Returns the roweditors's messages.
 int getMonitorPoll()
          Returns the interval in ms in that the roweditor is validated
protected  Point getPosition(com.google.gwt.user.client.Element row)
           
protected  Record getRecord(M model)
           
protected  int getTargetColumnIndex(Point pt)
           
protected  void hideTooltip()
           
 void init(Component component)
          Initializes the plugin when the component is created.
protected  void initFields()
           
protected  boolean isDirty()
           
 boolean isEditing()
          Returns true of the RowEditor is active and editing.
 boolean isErrorSummary()
          Returns true if a tooltip with an error summary is shown.
 boolean isMonitorValid()
          Returns true if this roweditor is monitored.
protected  boolean isValid()
           
 void onComponentEvent(ComponentEvent ce)
          Any events a component receives will be forwarded to this method.
protected  void onEnter(ComponentEvent ce)
           
protected  void onEscape(ComponentEvent ce)
           
protected  void onGridKey(GridEvent<M> e)
           
protected  void onHide()
           
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 onRowClick(GridEvent<M> e)
           
protected  void onRowDblClick(GridEvent<M> e)
           
protected  void onShow()
           
protected  void onTab(ComponentEvent ce)
           
protected  void positionButtons()
           
 void setClicksToEdit(EditorGrid.ClicksToEdit clicksToEdit)
          Sets the number of clicks to edit (defaults to ONE).
 void setErrorSummary(boolean errorSummary)
          True to show a tooltip with an error summary (defaults to true)
 void setMessages(RowEditor.RowEditorMessages messages)
          Sets the roweditors's messages.
 void setMonitorPoll(int monitorPoll)
          Sets the polling interval in ms in that the roweditor validation is done (defaults to 200)
 void setMonitorValid(boolean monitorValid)
          True to monitor the valid status of this roweditor (defaults to true)
protected  void showTooltip(java.lang.String msg)
           
 void startEditing(int rowIndex, boolean doFocus)
          Start editing of a specific row.
protected  void startMonitoring()
           
 void stopEditing(boolean saveChanges)
          Stops editing.
protected  void stopMonitoring()
           
protected  void verifyLayout(boolean force)
           
 
Methods inherited from class com.extjs.gxt.ui.client.widget.ContentPanel
addButton, adjustBodySize, afterCollapse, afterExpand, collapse, createStyles, expand, getAnimCollapse, getBody, getBodyBorder, getBodyStyle, getBottomComponent, getButtonAlign, getButtonBar, getCollapseBtn, getCollapsible, getElement, getFrame, getFrameHeight, getFrameSize, getFrameWidth, getHeader, getHeading, getIcon, getInnerHeight, getInnerWidth, getLayoutTarget, getMinButtonWidth, getTitleCollapse, getTitleText, getTopComponent, initTools, isCollapsed, isExpanded, isFooter, isHeaderVisible, isHideCollapseTool, layoutBars, notifyHide, notifyShow, onClick, onCollapse, onDisable, onEnable, onExpand, onResize, remove, setAnimCollapse, setBodyBorder, setBodyStyle, setBodyStyleName, setBottomComponent, setButtonAlign, setCollapsible, setExpanded, setFooter, setFrame, setHeaderVisible, setHeading, setHideCollapseTool, setIcon, setIconStyle, setInsetBorder, setMinButtonWidth, setTitleCollapse, setTopComponent, setUrl
 
Methods inherited from class com.extjs.gxt.ui.client.widget.LayoutContainer
add, add, addText, findComponent, getLayout, getWindowResizeDelay, insert, insert, isLayoutOnChange, isMonitorWindowResize, layout, layout, onBlur, onFocus, remove, removeAll, setLayout, setLayoutData, setLayoutOnChange, setMonitorWindowResize, setWindowResizeDelay
 
Methods inherited from class com.extjs.gxt.ui.client.widget.ScrollContainer
addScrollListener, getHScrollPosition, getScrollMode, getVScrollPosition, removeScrollListener, scrollIntoView, setHScrollPosition, setScrollMode, setVScrollPosition
 
Methods inherited from class com.extjs.gxt.ui.client.widget.Container
add, adjustIndex, adopt, createContainerEvent, disable, doLayout, doLayout, enable, findItem, getItem, getItemByItemId, getItemCount, getItems, getWidget, indexOf, insert, isLayoutNeeded, iterator, onAfterLayout, onAttach, onBeforeLayoutExcecuted, onInsert, onLayoutExcecuted, onRemove, orphan, remove, removeAll, scrollIntoView, setLayoutNeeded, wrapWidget
 
Methods inherited from class com.extjs.gxt.ui.client.widget.BoxComponent
adjustPosition, adjustSize, createComponentEvent, getBounds, getHeight, getHeight, getPosition, getPositionEl, getResizeEl, getShadow, getShadowOffset, getShadowPosition, getSize, getWidth, getWidth, hideShadow, hideShim, hideUnders, isAutoHeight, isAutoWidth, isDeferHeight, isShim, onPosition, 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.extjs.gxt.ui.client.widget.Component
addAttachable, addListener, addPlugin, addStyleName, addStyleOnOver, addWidgetListener, applyState, assertAfterRender, assertPreRender, beforeRender, blur, clearState, createObservable, disableContextMenu, disableEvents, disableTextSelection, el, enableEvents, fireEvent, fireEvent, fireEvent, fly, focus, frame, getAriaSupport, getBaseStyle, getBorders, getContextMenu, getData, getElement, getFocusEl, getFocusSupport, getHideMode, getId, getItemId, getListeners, getModel, getObservable, getPlugins, getState, getStateId, getTabIndex, getTitle, getToolTip, hasListeners, hasListeners, hide, hideToolTip, initState, isDisabledEvents, isDisableTextSelection, isEnabled, isMasked, isRendered, isStateful, isVisible, isVisible, mask, mask, mask, onBrowserEvent, onDetach, onDetachHelper, onEnsureDebugId, onHideContextMenu, onLoad, onRightClick, onShowContextMenu, onWindowResize, previewEvent, recalculate, removeAllListeners, removeAttachagle, removeFromParent, removeListener, removeStyleName, removeStyleOnOver, removeSwallow, removeToolTip, removeWidgetListener, render, render, repaint, saveState, setAriaRole, setAriaState, setAriaSupport, setBorders, setContextMenu, setData, setEl, setElement, setElement, setEnabled, setFiresEvents, setHideMode, setId, setIntStyleAttribute, setItemId, setModel, setParent, setStateful, setStateId, setStyleAttribute, setStyleName, setTabIndex, setTitle, setToolTip, setToolTip, setVisible, setZIndex, show, sinkEvents, swallowEvent, swallowEvent, toString, unframe, unmask
 
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

btns

protected ContentPanel btns

grid

protected Grid<M extends ModelData> grid

messages

protected RowEditor.RowEditorMessages messages

renderButtons

protected boolean renderButtons

rowIndex

protected int rowIndex

saveBtn

protected Button saveBtn

cancelBtn

protected Button cancelBtn
Constructor Detail

RowEditor

public RowEditor()
Method Detail

getClicksToEdit

public EditorGrid.ClicksToEdit getClicksToEdit()
Returns the clicks to edit.

Returns:
the clicks to edit

getMessages

public RowEditor.RowEditorMessages getMessages()
Returns the roweditors's messages.

Returns:
the messages

getMonitorPoll

public int getMonitorPoll()
Returns the interval in ms in that the roweditor is validated

Returns:
the interval in ms in that the roweditor is validated

init

public void init(Component component)
Description copied from interface: ComponentPlugin
Initializes the plugin when the component is created.

Specified by:
init in interface ComponentPlugin
Parameters:
component - the source component

isEditing

public boolean isEditing()
Returns true of the RowEditor is active and editing.

Returns:
true if the RowEditor is active

isErrorSummary

public boolean isErrorSummary()
Returns true if a tooltip with an error summary is shown.

Returns:
true if a tooltip with an error summary is shown

isMonitorValid

public boolean isMonitorValid()
Returns true if this roweditor is monitored.

Returns:
true if the roweditor is monitored

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 ContentPanel
Parameters:
ce - the base event

setClicksToEdit

public void setClicksToEdit(EditorGrid.ClicksToEdit clicksToEdit)
Sets the number of clicks to edit (defaults to ONE).

Parameters:
clicksToEdit - the clicks to edit

setErrorSummary

public void setErrorSummary(boolean errorSummary)
True to show a tooltip with an error summary (defaults to true)

Parameters:
errorSummary - true to show an error summary.

setMessages

public void setMessages(RowEditor.RowEditorMessages messages)
Sets the roweditors's messages.

Parameters:
messages - the messages

setMonitorPoll

public void setMonitorPoll(int monitorPoll)
Sets the polling interval in ms in that the roweditor validation is done (defaults to 200)

Parameters:
monitorPoll - the polling interval in ms in that validation is done

setMonitorValid

public void setMonitorValid(boolean monitorValid)
True to monitor the valid status of this roweditor (defaults to true)

Parameters:
monitorValid - true to monitor this roweditor

startEditing

public void startEditing(int rowIndex,
                         boolean doFocus)
Start editing of a specific row.

Parameters:
rowIndex - the index of the row to edit.
doFocus - true to focus the field

stopEditing

public void stopEditing(boolean saveChanges)
Stops editing.

Parameters:
saveChanges - true to save the changes. false to ignore them.

afterRender

protected void afterRender()
Description copied from class: Component
Called after the component has been rendered and is attached for the first time. At this time, the component will be part of the DOM which is required when retrieving location and offsets.

Overrides:
afterRender in class ScrollContainer<Component>

bindHandler

protected void bindHandler()

createButtons

protected void createButtons()

deferFocus

protected void deferFocus(int colIndex)

deferFocus

protected void deferFocus(Point pt)

doAttachChildren

protected void doAttachChildren()
Overrides:
doAttachChildren in class ContentPanel

doDetachChildren

protected void doDetachChildren()
Overrides:
doDetachChildren in class ContentPanel

doFocus

protected void doFocus(Point pt)

doFocus

protected void doFocus(int colIndex)

ensureVisible

protected void ensureVisible(CellEditor editor)

findField

protected Component findField(com.google.gwt.user.client.Element elem)

getErrorText

protected java.lang.String getErrorText()

getPosition

protected Point getPosition(com.google.gwt.user.client.Element row)

getRecord

protected Record getRecord(M model)

getTargetColumnIndex

protected int getTargetColumnIndex(Point pt)

hideTooltip

protected void hideTooltip()

initFields

protected void initFields()

isDirty

protected boolean isDirty()

isValid

protected boolean isValid()

onEnter

protected void onEnter(ComponentEvent ce)

onEscape

protected void onEscape(ComponentEvent ce)

onGridKey

protected void onGridKey(GridEvent<M> e)

onHide

protected void onHide()
Overrides:
onHide in class BoxComponent

onRender

protected void onRender(com.google.gwt.user.client.Element target,
                        int index)
Description copied from class: Component
Subclasses must override and ensure setElement is called for lazy rendered components.

Overrides:
onRender in class ContentPanel
Parameters:
target - the target element
index - the insert location

onRowClick

protected void onRowClick(GridEvent<M> e)

onRowDblClick

protected void onRowDblClick(GridEvent<M> e)

onShow

protected void onShow()
Overrides:
onShow in class BoxComponent

onTab

protected void onTab(ComponentEvent ce)

positionButtons

protected void positionButtons()

showTooltip

protected void showTooltip(java.lang.String msg)

startMonitoring

protected void startMonitoring()

stopMonitoring

protected void stopMonitoring()

verifyLayout

protected void verifyLayout(boolean force)