use of org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52 in project drools-wb by kiegroup.
the class DefaultWidgetFactory method makeNewValue.
private DTCellValue52 makeNewValue() {
final DTColumnConfig52 column = getPlugin().editingCol();
final Pattern52 pattern = getPlugin().editingPattern();
if (column instanceof ActionSetFieldCol52) {
return factory().makeNewValue(pattern, (ActionSetFieldCol52) column);
} else if (column instanceof ConditionCol52) {
return factory().makeNewValue(pattern, (ConditionCol52) column);
} else {
return factory().makeNewValue(column);
}
}
use of org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52 in project drools-wb by kiegroup.
the class DefaultWidgetFactory method getWidget.
private Widget getWidget(final DTCellValue52 defaultValue) {
final DTColumnConfig52 column = getPlugin().editingCol();
final Pattern52 pattern = getPlugin().editingPattern();
if (column instanceof ActionSetFieldCol52) {
final ActionSetFieldCol52 col52 = (ActionSetFieldCol52) column;
return factory().getWidget(pattern, col52, defaultValue);
} else if (column instanceof ConditionCol52) {
final ConditionCol52 col52 = (ConditionCol52) column;
return factory().getWidget(pattern, col52, defaultValue);
} else if (column instanceof ActionInsertFactCol52) {
final ActionInsertFactCol52 col52 = (ActionInsertFactCol52) column;
return factory().getWidget(col52, defaultValue);
}
throw new UnsupportedOperationException("The column type is not supported by the 'DefaultWidget'");
}
use of org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52 in project drools-wb by kiegroup.
the class NewGuidedDecisionTableWizard method complete.
@Override
public void complete() {
// Ensure each page updates the decision table as necessary
for (WizardPage page : this.pages) {
AbstractGuidedDecisionTableWizardPage gep = (AbstractGuidedDecisionTableWizardPage) page;
gep.makeResult(model);
}
// Expand rows
final RowExpander re = new RowExpander(model, oracle);
// Mark columns on which we are to expand (default is to include all)
for (BaseColumn c : model.getExpandedColumns()) {
re.setExpandColumn(c, false);
}
final List<ConditionCol52> columns = columnExpansionPage.getColumnsToExpand();
for (ConditionCol52 c : columns) {
re.setExpandColumn(c, true);
}
// Slurp out expanded rows and construct decision table data
int rowIndex = 0;
final RowExpander.RowIterator ri = re.iterator();
while (ri.hasNext()) {
List<DTCellValue52> row = ri.next();
model.getData().add(row);
model.getData().get(rowIndex).get(0).setNumericValue(new BigDecimal(rowIndex + 1));
rowIndex++;
}
// Save it!
final String baseFileName = summaryPage.getBaseFileName();
final Path contextPath = this.contextPath;
model.setTableName(baseFileName);
super.complete();
handler.save(contextPath, baseFileName, model);
}
use of org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52 in project drools-wb by kiegroup.
the class FactPatternConstraintsPage method isComplete.
@Override
public void isComplete(final Callback<Boolean> callback) {
// Have all patterns conditions been defined?
boolean areConditionsDefined = true;
for (Pattern52 p : model.getPatterns()) {
for (ConditionCol52 c : p.getChildColumns()) {
if (!getValidator().isConditionValid(c)) {
areConditionsDefined = false;
break;
}
}
}
// Signal Condition definitions to other pages
final ConditionsDefinedEvent event = new ConditionsDefinedEvent(areConditionsDefined);
conditionsDefinedEvent.fire(event);
callback.callback(areConditionsDefined);
}
use of org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52 in project drools-wb by kiegroup.
the class FactPatternConstraintsPageViewImpl method makeNewConditionColumn.
private ConditionCol52 makeNewConditionColumn(final AvailableField f) {
final GuidedDecisionTable52.TableFormat format = presenter.getTableFormat();
if (format == GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY) {
final ConditionCol52 c = new ConditionCol52();
c.setFactField(f.getName());
c.setFieldType(f.getType());
c.setConstraintValueType(f.getCalculationType());
return c;
} else {
final LimitedEntryConditionCol52 c = new LimitedEntryConditionCol52();
c.setFactField(f.getName());
c.setFieldType(f.getType());
c.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
return c;
}
}
Aggregations