//Add pattern to model, if applicable
if ( !model.getConditions().contains( editPattern ) ) {
model.getConditions().add( editPattern );
//Signal patterns changed event
BoundFactsChangedEvent pce = new BoundFactsChangedEvent( rm.getLHSBoundFacts() );
eventBus.fireEvent( pce );
}
boolean bUpdateColumnData = false;
boolean bUpdateColumnDefinition = false;
// Change in bound name requires column to be repositioned
if ( !isEqualOrNull( origPattern.getBoundName(),
editPattern.getBoundName() ) ) {
editPattern.getChildColumns().add( editColumn );
List<DTCellValue52> columnData = cellValueFactory.makeColumnData( editColumn );
int origColumnIndex = model.getExpandedColumns().indexOf( origColumn );
// If the FactType, FieldType and ConstraintValueType are unchanged
// we can copy cell values from the old column into the new
if ( isEqualOrNull( origPattern.getFactType(),
editPattern.getFactType() )
&& isEqualOrNull( origColumn.getFactField(),
editColumn.getFactField() )
&& origColumn.getConstraintValueType() == editColumn.getConstraintValueType() ) {
columnData.clear();
for ( int iRow = 0; iRow < model.getData().size(); iRow++ ) {
List<DTCellValue52> row = model.getData().get( iRow );
columnData.add( row.get( origColumnIndex ) );
}
}
addColumn( editColumn,
columnData,
true );
// Delete old column
origPattern.getChildColumns().remove( origColumn );
if ( origPattern.getChildColumns().size() == 0 ) {
model.getConditions().remove( origPattern );
//Signal patterns changed event to Decision Table Widget
BRLRuleModel rm = new BRLRuleModel( model );
BoundFactsChangedEvent pce = new BoundFactsChangedEvent( rm.getLHSBoundFacts() );
eventBus.fireEvent( pce );
}
deleteColumn( origColumnIndex,
true );