org.drools.guvnor.client.decisiontable.widget
Class AbstractDecisionTableWidget

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.decisiontable.widget.AbstractDecisionTableWidget
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, HasColumns<DTColumnConfig>, HasRows, HasSystemControlledColumns
Direct Known Subclasses:
VerticalDecisionTableWidget

public abstract class AbstractDecisionTableWidget
extends com.google.gwt.user.client.ui.Composite
implements HasRows, HasColumns<DTColumnConfig>, HasSystemControlledColumns

An abstract Decision Table and the necessary boiler-plate to convert from DTColumnConfig objects to the DynamicData related classes used by the DecoratedGridWidget


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  DecisionTableCellFactory cellFactory
           
protected  DecisionTableCellValueFactory cellValueFactory
           
protected  DecisionTableControlsWidget dtableCtrls
           
protected  TypeSafeGuidedDecisionTable model
           
protected  SuggestionCompletionEngine sce
           
protected  DecoratedGridWidget<DTColumnConfig> widget
           
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
AbstractDecisionTableWidget(DecisionTableControlsWidget dtableCtrls, SuggestionCompletionEngine sce)
          Constructor
 
Method Summary
 void addColumn(DTColumnConfig modelColumn)
          Add a column to the table, at the appropriate position determined by the column subclass: RowNumberCol, Metadata columns, Attribute columns, Condition columns and lastly Action columns.
 void appendRow()
          Append an empty row to the end of the table
protected  boolean canAcceptOtherwiseValues(CellValue<?> cell)
          Check whether the given Cell can accept "otherwise" values
 void deleteColumn(DTColumnConfig modelColumn)
          Delete the given column
 void deleteRow(DynamicDataRow row)
          Delete the given row
 TypeSafeGuidedDecisionTable getModel()
          Return the model
 SuggestionCompletionEngine getSCE()
          Return the SCE associated with this Decision Table
 void insertRowBefore(DynamicDataRow rowBefore)
          Insert an empty row before the given row
 void makeOtherwiseCell()
          Mark a cell as containing the magical "otherwise" value.
 void redrawSystemControlledColumns()
          Force the system controlled columns to be redrawn
 void scrapeColumns()
          Update the Decision Table model with the columns contained in the grid.
 void scrapeData()
          Update the Decision Table model with the data contained in the grid.
 void setColumnVisibility(DTColumnConfig modelColumn, boolean isVisible)
           
 void setModel(TypeSafeGuidedDecisionTable model)
          Set the Decision Table's data.
 void setPixelSize(int width, int height)
          Ensure the wrapped DecoratedGridWidget's size is set too
 void updateColumn(ActionInsertFactCol origColumn, ActionInsertFactCol editColumn)
          Update an ActionSetFieldCol column
 void updateColumn(ActionSetFieldCol origColumn, ActionSetFieldCol editColumn)
          Update an ActionSetFieldCol column
 void updateColumn(ConditionCol origColumn, ConditionCol editColumn)
          Update a Condition column
 void updateSystemControlledColumnValues()
           
 
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

model

protected TypeSafeGuidedDecisionTable model

widget

protected DecoratedGridWidget<DTColumnConfig> widget

sce

protected SuggestionCompletionEngine sce

cellFactory

protected DecisionTableCellFactory cellFactory

cellValueFactory

protected DecisionTableCellValueFactory cellValueFactory

dtableCtrls

protected DecisionTableControlsWidget dtableCtrls
Constructor Detail

AbstractDecisionTableWidget

public AbstractDecisionTableWidget(DecisionTableControlsWidget dtableCtrls,
                                   SuggestionCompletionEngine sce)
Constructor

Parameters:
sce -
Method Detail

addColumn

public void addColumn(DTColumnConfig modelColumn)
Add a column to the table, at the appropriate position determined by the column subclass: RowNumberCol, Metadata columns, Attribute columns, Condition columns and lastly Action columns. Condition Ccolumns are further grouped by Pattern.

Specified by:
addColumn in interface HasColumns<DTColumnConfig>
Parameters:
modelColumn - The Decision Table column to insert

appendRow

public void appendRow()
Append an empty row to the end of the table

Specified by:
appendRow in interface HasRows

deleteColumn

public void deleteColumn(DTColumnConfig modelColumn)
Delete the given column

Specified by:
deleteColumn in interface HasColumns<DTColumnConfig>
Parameters:
modelColumn - The Decision Table column to delete

deleteRow

public void deleteRow(DynamicDataRow row)
Delete the given row

Specified by:
deleteRow in interface HasRows
Parameters:
The - Decision Table row to delete

getModel

public TypeSafeGuidedDecisionTable getModel()
Return the model

Returns:
The DecisionTable data model

getSCE

public SuggestionCompletionEngine getSCE()
Return the SCE associated with this Decision Table

Returns:

insertRowBefore

public void insertRowBefore(DynamicDataRow rowBefore)
Insert an empty row before the given row

Specified by:
insertRowBefore in interface HasRows
Parameters:
rowBefore - The row before which the new (empty) row will be inserted. If this value is null the row will be appended to the end of the table

makeOtherwiseCell

public void makeOtherwiseCell()
Mark a cell as containing the magical "otherwise" value. The magical "otherwise" value has the meaning of all values other than those explicitly defined for this column.


redrawSystemControlledColumns

public void redrawSystemControlledColumns()
Force the system controlled columns to be redrawn


scrapeColumns

public void scrapeColumns()
Update the Decision Table model with the columns contained in the grid. The Decision Table controls indexing of new columns to preserve grouping of column types. If the order of columns is important to client-code this can be called to ensure columns within the model are synchronised with the Decision Table.


scrapeData

public void scrapeData()
Update the Decision Table model with the data contained in the grid. The Decision Table does not synchronise model data with UI data during user interaction with the UI. Consequentially this should be called to refresh the Model with the UI when needed.


setColumnVisibility

public void setColumnVisibility(DTColumnConfig modelColumn,
                                boolean isVisible)
Specified by:
setColumnVisibility in interface HasColumns<DTColumnConfig>

setModel

public void setModel(TypeSafeGuidedDecisionTable model)
Set the Decision Table's data. This removes all existing columns from the Decision Table and re-creates them based upon the provided data.

Parameters:
data -

setPixelSize

public void setPixelSize(int width,
                         int height)
Ensure the wrapped DecoratedGridWidget's size is set too

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

updateColumn

public void updateColumn(ActionInsertFactCol origColumn,
                         ActionInsertFactCol editColumn)
Update an ActionSetFieldCol column

Parameters:
origCol - The existing column in the grid
editColumn - A copy (not clone) of the original column containing the modified values

updateColumn

public void updateColumn(ActionSetFieldCol origColumn,
                         ActionSetFieldCol editColumn)
Update an ActionSetFieldCol column

Parameters:
origCol - The existing column in the grid
editColumn - A copy (not clone) of the original column containing the modified values

updateColumn

public void updateColumn(ConditionCol origColumn,
                         ConditionCol editColumn)
Update a Condition column

Parameters:
origCol - The existing column in the grid
editColumn - A copy (not clone) of the original column containing the modified values

updateSystemControlledColumnValues

public void updateSystemControlledColumnValues()
Specified by:
updateSystemControlledColumnValues in interface HasSystemControlledColumns

canAcceptOtherwiseValues

protected boolean canAcceptOtherwiseValues(CellValue<?> cell)
Check whether the given Cell can accept "otherwise" values

Parameters:
cell -
Returns:
true if the Cell can accept "otherwise" values


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