case 2 :
// Condition FactType, merged between identical
for ( int iCol = 0; iCol < visibleConditionCols.size(); iCol++ ) {
DynamicColumn<BaseColumn> col = visibleConditionCols.get( iCol );
ConditionCol52 cc = (ConditionCol52) col.getModelColumn();
Pattern52 ccPattern = model.getPattern( cc );
tce = DOM.createTD();
tce.addClassName( resources.headerText() );
tce.addClassName( resources.cellTableColumn( col.getModelColumn() ) );
tce.addClassName( resources.headerRowIntermediate() );
tre.appendChild( tce );
// Merging
int colSpan = 1;
int width = col.getWidth();
while ( iCol + colSpan < visibleConditionCols.size() ) {
DynamicColumn<BaseColumn> mergeCol = visibleConditionCols.get( iCol + colSpan );
ConditionCol52 mergeCondCol = (ConditionCol52) mergeCol.getModelColumn();
Pattern52 mergeCondColPattern = model.getPattern( mergeCondCol );
if ( mergeCondColPattern != ccPattern ) {
break;
}
width = width + mergeCol.getWidth();
colSpan++;
}
iCol = iCol + colSpan - 1;
//Make applicable label (TODO move to Factory method)
StringBuilder label = new StringBuilder();
if ( cc instanceof LimitedEntryBRLConditionColumn ) {
//Nothing needed
} else if ( cc instanceof BRLConditionVariableColumn ) {
BRLConditionVariableColumn brl = (BRLConditionVariableColumn) cc;
label.append( brl.getVarName() );
} else if ( cc instanceof ConditionCol52 ) {
String factType = ccPattern.getFactType();
String boundName = ccPattern.getBoundName();
if ( factType != null && factType.length() > 0 ) {
if ( ccPattern.isNegated() ) {
label.append( Constants.INSTANCE.negatedPattern() ).append( " " ).append( factType );
} else {
label.append( factType ).append( " [" ).append( boundName ).append( "]" );
}
}
}
tce.appendChild( makeLabel( label.toString(),
width,
(splitter.isCollapsed ? 0 : resources.rowHeaderHeight()) ) );
tce.<TableCellElement> cast().setColSpan( colSpan );
}
//Action FactType
for ( int iCol = 0; iCol < visibleActionCols.size(); iCol++ ) {
DynamicColumn<BaseColumn> col = visibleActionCols.get( iCol );
ActionCol52 ac = (ActionCol52) col.getModelColumn();
tce = DOM.createTD();
tce.addClassName( resources.headerText() );
tce.addClassName( resources.cellTableColumn( col.getModelColumn() ) );
tce.addClassName( resources.headerRowIntermediate() );
tre.appendChild( tce );
//Make applicable label (TODO move to Factory method)
StringBuilder label = new StringBuilder();
if ( ac instanceof ActionInsertFactCol52 ) {
ActionInsertFactCol52 aifc = (ActionInsertFactCol52) ac;
String factType = aifc.getFactType();
String binding = aifc.getBoundName();
if ( factType != null && factType.length() > 0 ) {
label.append( factType );
if ( binding != null ) {
label.append( " [" + binding + "]" );
}
}
} else if ( ac instanceof ActionSetFieldCol52 ) {
String factType = ((ActionSetFieldCol52) ac).getBoundName();
if ( factType != null && factType.length() > 0 ) {
label.append( factType );
}
} else if ( ac instanceof LimitedEntryActionRetractFactCol52 ) {
String factType = ((LimitedEntryActionRetractFactCol52) ac).getValue().getStringValue();
if ( factType != null && factType.length() > 0 ) {
label.append( factType );
}
} else if ( ac instanceof ActionWorkItemCol52 ) {
String factType = ((ActionWorkItemCol52) ac).getWorkItemDefinition().getDisplayName();
if ( factType != null && factType.length() > 0 ) {
label.append( factType );
}
} else if ( ac instanceof BRLActionVariableColumn ) {
String factType = ((BRLActionVariableColumn) ac).getVarName();
if ( factType != null && factType.length() > 0 ) {
label.append( factType );
}
}
tce.appendChild( makeLabel( label.toString(),
col.getWidth(),
(splitter.isCollapsed ? 0 : resources.rowHeaderHeight()) ) );
}
break;
case 3 :
// Condition Fact Fields
for ( DynamicColumn<BaseColumn> col : visibleConditionCols ) {
tce = DOM.createTD();
tce.addClassName( resources.headerText() );
tce.addClassName( resources.headerRowIntermediate() );
tce.addClassName( resources.cellTableColumn( col.getModelColumn() ) );
tre.appendChild( tce );
ConditionCol52 cc = (ConditionCol52) col.getModelColumn();
//Make applicable label (TODO move to Factory method)
StringBuilder label = new StringBuilder();
if ( cc instanceof LimitedEntryBRLConditionColumn ) {
//Nothing needed
} else if ( cc instanceof BRLConditionVariableColumn ) {
BRLConditionVariableColumn brl = (BRLConditionVariableColumn) cc;
String field = brl.getFactField();
label.append( field == null ? "" : field );
} else if ( cc instanceof ConditionCol52 ) {
String factField = cc.getFactField();
if ( factField != null && factField.length() > 0 ) {
label.append( factField );
}
if ( cc.getConstraintValueType() != BaseSingleFieldConstraint.TYPE_PREDICATE ) {
label.append( " [" );
label.append( cc.getOperator() );
String lev = getLimitedEntryValue( cc );
if ( lev != null ) {
label.append( lev );
}
label.append( "]" );