Search in sources :

Example 71 with ConditionCol52

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);
    }
}
Also used : ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) DTColumnConfig52(org.drools.workbench.models.guided.dtable.shared.model.DTColumnConfig52) ActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)

Example 72 with ConditionCol52

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'");
}
Also used : ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) ActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52) DTColumnConfig52(org.drools.workbench.models.guided.dtable.shared.model.DTColumnConfig52) ActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)

Example 73 with ConditionCol52

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);
}
Also used : Path(org.uberfire.backend.vfs.Path) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) BigDecimal(java.math.BigDecimal) RowExpander(org.drools.workbench.screens.guided.dtable.client.wizard.table.pages.RowExpander) ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) AbstractGuidedDecisionTableWizardPage(org.drools.workbench.screens.guided.dtable.client.wizard.table.pages.AbstractGuidedDecisionTableWizardPage) WizardPage(org.uberfire.ext.widgets.core.client.wizards.WizardPage) AbstractGuidedDecisionTableWizardPage(org.drools.workbench.screens.guided.dtable.client.wizard.table.pages.AbstractGuidedDecisionTableWizardPage) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)

Example 74 with ConditionCol52

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);
}
Also used : ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) ConditionsDefinedEvent(org.drools.workbench.screens.guided.dtable.client.wizard.table.pages.events.ConditionsDefinedEvent)

Example 75 with ConditionCol52

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;
    }
}
Also used : LimitedEntryConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryConditionCol52) ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) LimitedEntryConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryConditionCol52)

Aggregations

ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)229 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)184 Test (org.junit.Test)170 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)74 LimitedEntryConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryConditionCol52)59 ActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)38 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)38 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)34 ActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)31 ArrayList (java.util.ArrayList)27 Path (org.uberfire.backend.vfs.Path)27 StringUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.StringUiColumn)25 RawMVELEvaluator (org.kie.soup.project.datamodel.commons.util.RawMVELEvaluator)25 PackageDataModelOracleBaselinePayload (org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload)25 AsyncPackageDataModelOracle (org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle)25 BaseSingleFieldConstraint (org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)24 IntegerUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.IntegerUiColumn)24 DescriptionCol52 (org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52)23 RowNumberCol52 (org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)23 ModelField (org.kie.soup.project.datamodel.oracle.ModelField)23