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

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Composite
              extended by org.drools.guvnor.client.widgets.decoratedgrid.DecoratedGridWidget<T>
Type Parameters:
T - The type of domain columns represented by the Grid
All Implemented Interfaces:
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
Direct Known Subclasses:
VerticalDecoratedGridWidget

public abstract class DecoratedGridWidget<T>
extends com.google.gwt.user.client.ui.Composite

Abstract grid, decorated with DecoratedGridHeaderWidget and DecoratedGridSidebarWidget encapsulating basic operation: keyboard navigation and column resizing.


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  com.google.gwt.user.client.ui.Panel bodyPanel
           
protected  MergableGridWidget<T> gridWidget
           
protected  HasSystemControlledColumns hasSystemControlledColumns
           
protected  DecoratedGridHeaderWidget<T> headerWidget
           
protected  int height
           
protected  com.google.gwt.user.client.ui.Panel mainPanel
           
protected static DecisionTableResources resource
           
protected  com.google.gwt.user.client.ui.ScrollPanel scrollPanel
           
protected  DecoratedGridSidebarWidget<T> sidebarWidget
           
protected static DecisionTableResources.DecisionTableStyle style
           
protected  int width
           
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
DecoratedGridWidget()
          Construct at empty DecoratedGridWidget, without DecoratedGridHeaderWidget or DecoratedGridSidebarWidget These should be set before the grid is displayed using setHeaderWidget and setSidebarWidget respectively.
 
Method Summary
 void appendColumn(DynamicColumn<T> column, List<CellValue<? extends Comparable<?>>> columnData, boolean bRedraw)
          Append a column to the end of the column list
 void assertDimensions()
          Resize the DecoratedGridHeaderWidget and DecoratedGridSidebarWidget when DecoratedGridWidget shows scrollbars
 void deleteColumn(DynamicColumn<T> column)
          Delete the given column
 void deleteRow(DynamicDataRow row)
          Delete the given row
abstract  com.google.gwt.user.client.ui.Panel getBodyPanel()
          Get the DecoratedGridWidget inner panel to which the DecoratedGridHeaderWidget will be added.
abstract  MergableGridWidget<T> getGridWidget()
          Return the Widget responsible for rendering the DecoratedGridWidget "grid".
 DecoratedGridHeaderWidget<T> getHeaderWidget()
          Return the Widget responsible for rendering the DecoratedGridWidget "header".
abstract  com.google.gwt.user.client.ui.Panel getMainPanel()
          Return the DecoratedGridWidget outer most panel to which all child widgets is added.
abstract  com.google.gwt.event.dom.client.ScrollHandler getScrollHandler()
          Return the ScrollPanel in which the DecoratedGridWidget "grid" is nested.
 DecoratedGridSidebarWidget<T> getSidebarWidget()
          Return the Widget responsible for rendering the DecoratedGridWidget "sidebar".
 void insertColumnBefore(DynamicColumn<T> columnBefore, DynamicColumn<T> newColumn, List<CellValue<? extends Comparable<?>>> columnData, boolean bRedraw)
          Insert a column before that specified
 void insertRowBefore(DynamicDataRow rowBefore, List<CellValue<? extends Comparable<?>>> rowData)
          Insert a row before that specified
 void redrawSystemControlledColumns()
          Redraw any columns that have their values programmatically manipulated
 void setColumnVisibility(int index, boolean isVisible)
          Set the visibility of a column
 void setHasSystemControlledColumns(HasSystemControlledColumns hasSystemControlledColumns)
          Some implementations may require the values of cells within the DecoratedGridWidget to be programmatically manipulated (such as "Row Number", which has to be recalculated after a sort operation).
 void setHeaderWidget(DecoratedGridHeaderWidget<T> headerWidget)
          Set the Header Widget and attach resize handlers to GridWidget to support column resizing and to resize GridWidget's ScrollPanel when header resizes.
 void setPixelSize(int width, int height)
          This should be used instead of setHeight(String) and setWidth(String) as various child Widgets of the DecisionTable need to have their sizes set relative to the outermost Widget (i.e. this).
 void setSidebarWidget(DecoratedGridSidebarWidget<T> sidebarWidget)
          Set the SidebarWidget and attach a ResizeEvent handler to the Sidebar for when the header changes size and the Sidebar needs to be redrawn to align correctly.
 void sort()
          Sort data based upon information stored in Columns
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
getWidget, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, 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, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mainPanel

protected com.google.gwt.user.client.ui.Panel mainPanel

bodyPanel

protected com.google.gwt.user.client.ui.Panel bodyPanel

scrollPanel

protected com.google.gwt.user.client.ui.ScrollPanel scrollPanel

gridWidget

protected MergableGridWidget<T> gridWidget

headerWidget

protected DecoratedGridHeaderWidget<T> headerWidget

sidebarWidget

protected DecoratedGridSidebarWidget<T> sidebarWidget

hasSystemControlledColumns

protected HasSystemControlledColumns hasSystemControlledColumns

height

protected int height

width

protected int width

resource

protected static final DecisionTableResources resource

style

protected static final DecisionTableResources.DecisionTableStyle style
Constructor Detail

DecoratedGridWidget

public DecoratedGridWidget()
Construct at empty DecoratedGridWidget, without DecoratedGridHeaderWidget or DecoratedGridSidebarWidget These should be set before the grid is displayed using setHeaderWidget and setSidebarWidget respectively.

Method Detail

appendColumn

public void appendColumn(DynamicColumn<T> column,
                         List<CellValue<? extends Comparable<?>>> columnData,
                         boolean bRedraw)
Append a column to the end of the column list

Parameters:
column -
columnData -
bRedraw - Redraw the grid after the column has been appended

assertDimensions

public void assertDimensions()
Resize the DecoratedGridHeaderWidget and DecoratedGridSidebarWidget when DecoratedGridWidget shows scrollbars


deleteColumn

public void deleteColumn(DynamicColumn<T> column)
Delete the given column

Parameters:
column -

deleteRow

public void deleteRow(DynamicDataRow row)
Delete the given row

Parameters:
row -

getBodyPanel

public abstract com.google.gwt.user.client.ui.Panel getBodyPanel()
Get the DecoratedGridWidget inner panel to which the DecoratedGridHeaderWidget will be added. This allows subclasses to have some control over the internal layout of the grid.

Returns:

getGridWidget

public abstract MergableGridWidget<T> getGridWidget()
Return the Widget responsible for rendering the DecoratedGridWidget "grid".

Returns:

getHeaderWidget

public DecoratedGridHeaderWidget<T> getHeaderWidget()
Return the Widget responsible for rendering the DecoratedGridWidget "header".

Returns:

getMainPanel

public abstract com.google.gwt.user.client.ui.Panel getMainPanel()
Return the DecoratedGridWidget outer most panel to which all child widgets is added. This allows subclasses to have some control over the internal layout of the grid.

Returns:

getScrollHandler

public abstract com.google.gwt.event.dom.client.ScrollHandler getScrollHandler()
Return the ScrollPanel in which the DecoratedGridWidget "grid" is nested. This allows ScrollEvents to be hooked up to other defendant controls (e.g. the Header).

Returns:

getSidebarWidget

public DecoratedGridSidebarWidget<T> getSidebarWidget()
Return the Widget responsible for rendering the DecoratedGridWidget "sidebar".

Returns:

insertColumnBefore

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

Parameters:
columnBefore -
newColumn -
columnData -
bRedraw - Redraw the grid after the column has been inserted

insertRowBefore

public void insertRowBefore(DynamicDataRow rowBefore,
                            List<CellValue<? extends Comparable<?>>> rowData)
Insert a row before that specified

Parameters:
rowBefore - Row before which the new row will be inserted, or null in which case the row will be appended to the end
rowData - New row data

redrawSystemControlledColumns

public void redrawSystemControlledColumns()
Redraw any columns that have their values programmatically manipulated


setColumnVisibility

public void setColumnVisibility(int index,
                                boolean isVisible)
Set the visibility of a column

Parameters:
index - The index of the column to hide
isVisible - true if the column is to be visible

setHasSystemControlledColumns

public void setHasSystemControlledColumns(HasSystemControlledColumns hasSystemControlledColumns)
Some implementations may require the values of cells within the DecoratedGridWidget to be programmatically manipulated (such as "Row Number", which has to be recalculated after a sort operation). Such implementations can register themselves here to receive requests to update cell values when necessary (currently only after a sort).

Parameters:
hasSystemControlledColumns -

setHeaderWidget

public void setHeaderWidget(DecoratedGridHeaderWidget<T> headerWidget)
Set the Header Widget and attach resize handlers to GridWidget to support column resizing and to resize GridWidget's ScrollPanel when header resizes.

Parameters:
headerWidget -

setPixelSize

public void setPixelSize(int width,
                         int height)
This should be used instead of setHeight(String) and setWidth(String) as various child Widgets of the DecisionTable need to have their sizes set relative to the outermost Widget (i.e. this).

Overrides:
setPixelSize in class com.google.gwt.user.client.ui.UIObject

setSidebarWidget

public void setSidebarWidget(DecoratedGridSidebarWidget<T> sidebarWidget)
Set the SidebarWidget and attach a ResizeEvent handler to the Sidebar for when the header changes size and the Sidebar needs to be redrawn to align correctly. Also attach a RowGroupingChangeEvent handler to the MergableGridWidget so the Sidebar can redraw itself when rows are merged, grouped, ungrouped or unmerged.

Parameters:
sidebarWidget -

sort

public void sort()
Sort data based upon information stored in Columns



Copyright © 2001-2011 JBoss Inc.. All Rights Reserved.