org.drools.guvnor.client.widgets.decoratedgrid
Class MergableGridWidget<T>

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by org.drools.guvnor.client.widgets.decoratedgrid.MergableGridWidget<T>
All Implemented Interfaces:
com.google.gwt.cell.client.ValueUpdater<Object>, 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, HasRowGroupingChangeHandlers, HasSelectedCellChangeHandlers
Direct Known Subclasses:
VerticalMergableGridWidget

public abstract class MergableGridWidget<T>
extends com.google.gwt.user.client.ui.Widget
implements com.google.gwt.cell.client.ValueUpdater<Object>, HasSelectedCellChangeHandlers, HasRowGroupingChangeHandlers

An abstract grid of data. Implementations can choose the orientation to render "rows" and "columns" (e.g. some may transpose the normal meaning to provide a horizontal implementation of normally vertical tabular data)


Nested Class Summary
static class MergableGridWidget.CellSelectionDetail
          Container for a details of a selected cell
static class MergableGridWidget.MOVE_DIRECTION
           
 
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  boolean bDragOperationPrimed
           
protected  List<DynamicColumn<T>> columns
           
protected  DynamicData data
           
protected static Constants messages
           
protected  MergableGridWidget.MOVE_DIRECTION rangeDirection
           
protected  CellValue<?> rangeExtentCell
           
protected  CellValue<?> rangeOriginCell
           
protected static DecisionTableResources resource
           
protected  TreeSet<CellValue<? extends Comparable<?>>> selections
           
protected static String selectorGroupedCellsHtml
           
protected static String selectorUngroupedCellsHtml
           
protected static DecisionTableResources.DecisionTableStyle style
           
protected  com.google.gwt.dom.client.TableElement table
           
protected  com.google.gwt.dom.client.TableSectionElement tbody
           
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
MergableGridWidget()
          A grid of cells.
 
Method Summary
 com.google.gwt.event.shared.HandlerRegistration addRowGroupingChangeHandler(RowGroupingChangeHandler handler)
          Add a handler for RowGroupingChangeEvents
 com.google.gwt.event.shared.HandlerRegistration addSelectedCellChangeHandler(SelectedCellChangeHandler handler)
          Add a handler for SelectedCellChangeEvents
protected  void clearSelection()
           
protected abstract  void createEmptyRowElement(int index)
           
protected abstract  void createRowElement(int index, DynamicDataRow rowData)
           
 void deleteColumn(DynamicColumn<T> column, boolean bRedraw)
          Delete a column
 void deleteRow(DynamicDataRow row)
          Delete the given row.
protected abstract  void deleteRowElement(int index)
           
 List<DynamicColumn<T>> getColumns()
          Return grid's columns
 DynamicData getData()
          Return grid's data.
 List<CellValue<?>> getSelectedCells()
          Return an immutable list of selected cells
 void insertColumnBefore(DynamicColumn<T> columnBefore, DynamicColumn<T> newColumn, List<CellValue<? extends Comparable<?>>> columnData, boolean bRedraw)
          Insert a column before another
 DynamicDataRow insertRowBefore(DynamicDataRow rowBefore, List<CellValue<? extends Comparable<?>>> rowData)
          Insert the given row before the provided index.
protected  boolean isGroupWidgetClicked(com.google.gwt.user.client.Event event, com.google.gwt.dom.client.Element target)
           
abstract  void redraw()
          Redraw the whole table
abstract  void redrawColumn(int index)
          Redraw table column.
abstract  void redrawColumns(int startRedrawIndex, int endRedrawIndex)
          Redraw table columns.
protected abstract  void redrawRows(int startRedrawIndex, int endRedrawIndex)
          Redraw table rows.
protected abstract  void removeRowElement(int index)
           
 boolean toggleMerging()
          Toggle the state of DecoratedGridWidget merging.
 void update(Object value)
           
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 

Field Detail

selections

protected TreeSet<CellValue<? extends Comparable<?>>> selections

table

protected com.google.gwt.dom.client.TableElement table

tbody

protected com.google.gwt.dom.client.TableSectionElement tbody

messages

protected static final Constants messages

resource

protected static final DecisionTableResources resource

style

protected static final DecisionTableResources.DecisionTableStyle style

selectorGroupedCellsHtml

protected static final String selectorGroupedCellsHtml

selectorUngroupedCellsHtml

protected static final String selectorUngroupedCellsHtml

columns

protected List<DynamicColumn<T>> columns

data

protected DynamicData data

rangeOriginCell

protected CellValue<?> rangeOriginCell

rangeExtentCell

protected CellValue<?> rangeExtentCell

rangeDirection

protected MergableGridWidget.MOVE_DIRECTION rangeDirection

bDragOperationPrimed

protected boolean bDragOperationPrimed
Constructor Detail

MergableGridWidget

public MergableGridWidget()
A grid of cells.

Method Detail

addRowGroupingChangeHandler

public com.google.gwt.event.shared.HandlerRegistration addRowGroupingChangeHandler(RowGroupingChangeHandler handler)
Add a handler for RowGroupingChangeEvents

Specified by:
addRowGroupingChangeHandler in interface HasRowGroupingChangeHandlers
Parameters:
handler - the handler
Returns:
the handler registration

addSelectedCellChangeHandler

public com.google.gwt.event.shared.HandlerRegistration addSelectedCellChangeHandler(SelectedCellChangeHandler handler)
Add a handler for SelectedCellChangeEvents

Specified by:
addSelectedCellChangeHandler in interface HasSelectedCellChangeHandlers
Parameters:
handler - the handler
Returns:
the handler registration

deleteColumn

public void deleteColumn(DynamicColumn<T> column,
                         boolean bRedraw)
Delete a column

Parameters:
column - Column to delete
bRedraw - Should grid be redrawn

deleteRow

public void deleteRow(DynamicDataRow row)
Delete the given row. Partial redraw.

Parameters:
row -

getColumns

public List<DynamicColumn<T>> getColumns()
Return grid's columns

Returns:
columns

getData

public DynamicData getData()
Return grid's data. Grouping reflected in the UI will be collapsed in the return value. Use of getFlattenedData() should be used in preference if the ungrouped data is needed (e.g. when persisting the model).

Returns:
data

getSelectedCells

public List<CellValue<?>> getSelectedCells()
Return an immutable list of selected cells

Returns:
The selected cells

insertColumnBefore

public void insertColumnBefore(DynamicColumn<T> columnBefore,
                               DynamicColumn<T> newColumn,
                               List<CellValue<? extends Comparable<?>>> columnData,
                               boolean bRedraw)
Insert a column before another

Parameters:
columnBefore - The column before which the new column should be inserted
newColumn - Column definition
columnData - Data for column
bRedraw - Should grid be redrawn

insertRowBefore

public DynamicDataRow insertRowBefore(DynamicDataRow rowBefore,
                                      List<CellValue<? extends Comparable<?>>> rowData)
Insert the given row before the provided index. Partial redraw.

Parameters:
rowBefore - The row before which the new row should be inserted
rowData - The row of data to insert

redraw

public abstract void redraw()
Redraw the whole table


redrawColumn

public abstract void redrawColumn(int index)
Redraw table column. Partial redraw

Parameters:
index - Start column index (inclusive)

redrawColumns

public abstract void redrawColumns(int startRedrawIndex,
                                   int endRedrawIndex)
Redraw table columns. Partial redraw

Parameters:
startRedrawIndex - Start column index (inclusive)
endRedrawIndex - End column index (inclusive)

toggleMerging

public boolean toggleMerging()
Toggle the state of DecoratedGridWidget merging.

Returns:
The state of merging after completing this call

update

public void update(Object value)
Specified by:
update in interface com.google.gwt.cell.client.ValueUpdater<Object>

clearSelection

protected void clearSelection()

createEmptyRowElement

protected abstract void createEmptyRowElement(int index)

createRowElement

protected abstract void createRowElement(int index,
                                         DynamicDataRow rowData)

deleteRowElement

protected abstract void deleteRowElement(int index)

isGroupWidgetClicked

protected boolean isGroupWidgetClicked(com.google.gwt.user.client.Event event,
                                       com.google.gwt.dom.client.Element target)

redrawRows

protected abstract void redrawRows(int startRedrawIndex,
                                   int endRedrawIndex)
Redraw table rows. Partial redraw

Parameters:
startRedrawIndex - Start row index (inclusive)
endRedrawIndex - End row index (inclusive)

removeRowElement

protected abstract void removeRowElement(int index)


Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.