Search in sources :

Example 16 with ActionSetFieldCol52

use of org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52 in project drools-wb by kiegroup.

the class PluginHandlerTest method testEditWhenColumnIsAnActionSetFieldCol52.

@Test
public void testEditWhenColumnIsAnActionSetFieldCol52() {
    final ActionSetFieldCol52 originalColumn = mock(ActionSetFieldCol52.class);
    final ActionSetFactPlugin plugin = spy(new ActionSetFactPlugin(patternPage, fieldPage, valueOptionsPage, additionalInfoPage, event, translationService));
    testEditActionColumn(plugin, actionSetFactPlugin, originalColumn);
}
Also used : ActionSetFactPlugin(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.ActionSetFactPlugin) ActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52) Test(org.junit.Test)

Example 17 with ActionSetFieldCol52

use of org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52 in project drools-wb by kiegroup.

the class ActionSetFactWrapper method clone.

private ActionSetFieldCol52 clone(final ActionSetFieldCol52 column) {
    final ActionSetFieldCol52 clone = newActionSetField();
    if (tableFormat() == LIMITED_ENTRY) {
        asLimited(clone).setValue(asLimited(column).getValue());
    }
    clone.setFactField(column.getFactField());
    clone.setBoundName(column.getBoundName());
    clone.setValueList(column.getValueList());
    clone.setHeader(column.getHeader());
    clone.setUpdate(column.isUpdate());
    clone.setDefaultValue(column.getDefaultValue());
    clone.setHideColumn(column.isHideColumn());
    clone.setType(column.getType());
    return clone;
}
Also used : ActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52) LimitedEntryActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionSetFieldCol52)

Example 18 with ActionSetFieldCol52

use of org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52 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 19 with ActionSetFieldCol52

use of org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52 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 20 with ActionSetFieldCol52

use of org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52 in project drools-wb by kiegroup.

the class ActionSetFieldsPage method initialise.

@Override
public void initialise() {
    view.init(this);
    view.setValidator(getValidator());
    patternToActionsMap.clear();
    // Set-up validator for the pattern-to-action mapping voodoo
    getValidator().setPatternToActionSetFieldsMap(patternToActionsMap);
    // Set-up a factory for value editors
    view.setDTCellValueWidgetFactory(DTCellValueWidgetFactory.getInstance(model, oracle, false, allowEmptyValues()));
    // Existing ActionSetFieldCols (should be empty for a new Decision Table)
    for (ActionCol52 a : model.getActionCols()) {
        if (a instanceof ActionSetFieldCol52) {
            final ActionSetFieldCol52 asf = (ActionSetFieldCol52) a;
            final Pattern52 p = model.getConditionPattern(asf.getBoundName());
            if (!patternToActionsMap.containsKey(p)) {
                patternToActionsMap.put(p, new ArrayList<ActionSetFieldCol52>());
            }
            final List<ActionSetFieldCol52> actions = patternToActionsMap.get(p);
            actions.add(asf);
        }
    }
    view.setChosenFields(new ArrayList<ActionSetFieldCol52>());
    content.setWidget(view);
}
Also used : Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) ActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)

Aggregations

ActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)75 Test (org.junit.Test)49 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)39 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)38 ActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)29 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)27 LimitedEntryActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionSetFieldCol52)23 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)16 LimitedEntryConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryConditionCol52)16 LimitedEntryActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionInsertFactCol52)12 RawMVELEvaluator (org.kie.soup.project.datamodel.commons.util.RawMVELEvaluator)12 PackageDataModelOracleBaselinePayload (org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload)12 AsyncPackageDataModelOracle (org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle)12 Path (org.uberfire.backend.vfs.Path)12 ModelField (org.kie.soup.project.datamodel.oracle.ModelField)11 ModuleDataModelOracle (org.kie.soup.project.datamodel.oracle.ModuleDataModelOracle)11 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)10 ActionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionCol52)9 ActionRetractFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionRetractFactCol52)8 AttributeCol52 (org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52)8