Search in sources :

Example 66 with ActionInsertFactCol52

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

the class GuidedDecisionTableFactory method makeTableWithActionCol.

public static GuidedDecisionTable52 makeTableWithActionCol(final String packageName, final Collection<Import> imports, final String tableName) {
    final GuidedDecisionTable52 dt = new GuidedDecisionTable52();
    dt.setPackageName(packageName);
    dt.getImports().getImports().addAll(imports);
    dt.setTableName(tableName);
    ActionInsertFactCol52 ins = new ActionInsertFactCol52();
    ins.setBoundName("$i");
    ins.setFactType("Applicant");
    ins.setFactField("age");
    ins.setType(DataType.TYPE_NUMERIC_INTEGER);
    dt.getActionCols().add(ins);
    dt.setData(DataUtilities.makeDataLists(new String[][] { new String[] { "1", "desc", "33" } }));
    return dt;
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) ActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)

Example 67 with ActionInsertFactCol52

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

the class ActionInsertFactWrapper method clone.

private ActionInsertFactCol52 clone(final ActionInsertFactCol52 column) {
    final ActionInsertFactCol52 clone = newActionInsertFact();
    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.setInsertLogical(column.isInsertLogical());
    clone.setDefaultValue(column.getDefaultValue());
    clone.setFactType(column.getFactType());
    clone.setHideColumn(column.isHideColumn());
    clone.setType(column.getType());
    return clone;
}
Also used : ActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52) LimitedEntryActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionInsertFactCol52)

Example 68 with ActionInsertFactCol52

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

the class ActionInsertFactFieldsPage method lookupExistingInsertFactPattern.

private ActionInsertFactFieldsPattern lookupExistingInsertFactPattern(final String boundName) {
    for (ActionInsertFactFieldsPattern p : patternToActionsMap.keySet()) {
        if (p.getBoundName().equals(boundName)) {
            return p;
        }
    }
    final ActionInsertFactFieldsPattern p = new ActionInsertFactFieldsPattern();
    patternToActionsMap.put(p, new ArrayList<ActionInsertFactCol52>());
    return p;
}
Also used : ActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52) ActionInsertFactFieldsPattern(org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactFieldsPattern)

Example 69 with ActionInsertFactCol52

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

the class ActionInsertFactFieldsPageViewImpl method initialiseChosenFields.

private void initialiseChosenFields() {
    chosenFieldsContainer.add(chosenFieldsWidget);
    chosenFieldsWidget.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
    chosenFieldsWidget.setMinimumWidth(130);
    final Label lstEmpty = new Label(GuidedDecisionTableConstants.INSTANCE.DecisionTableWizardNoChosenFields());
    lstEmpty.setStyleName(WizardCellListResources.INSTANCE.cellListStyle().cellListEmptyItem());
    chosenFieldsWidget.setEmptyListWidget(lstEmpty);
    final MultiSelectionModel<ActionInsertFactCol52> selectionModel = new MultiSelectionModel<ActionInsertFactCol52>(System::identityHashCode);
    chosenFieldsWidget.setSelectionModel(selectionModel);
    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {

        @Override
        public void onSelectionChange(final SelectionChangeEvent event) {
            chosenFieldsSelections = new HashSet<ActionInsertFactCol52>();
            final Set<ActionInsertFactCol52> selections = selectionModel.getSelectedSet();
            for (ActionInsertFactCol52 a : selections) {
                chosenFieldsSelections.add(a);
            }
            chosenConditionsSelected(chosenFieldsSelections);
        }

        private void chosenConditionsSelected(final Set<ActionInsertFactCol52> cws) {
            btnRemove.setEnabled(true);
            if (cws.size() == 1) {
                chosenFieldsSelection = cws.iterator().next();
                fieldDefinition.setVisible(true);
                validateFieldHeader();
                populateFieldDefinition();
            } else {
                chosenFieldsSelection = null;
                fieldDefinition.setVisible(false);
                txtColumnHeader.setEnabled(false);
                txtValueList.setEnabled(false);
                defaultValueContainer.setVisible(false);
            }
        }

        private void populateFieldDefinition() {
            // Fields common to all table formats
            txtColumnHeader.setEnabled(true);
            txtColumnHeader.setText(chosenFieldsSelection.getHeader());
            criteriaExtendedEntry.setVisible(presenter.getTableFormat() == GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY);
            criteriaLimitedEntry.setVisible(presenter.getTableFormat() == GuidedDecisionTable52.TableFormat.LIMITED_ENTRY);
            // Fields specific to the table format
            switch(presenter.getTableFormat()) {
                case EXTENDED_ENTRY:
                    txtValueList.setEnabled(!presenter.hasEnums(chosenFieldsSelection));
                    txtValueList.setText(chosenFieldsSelection.getValueList());
                    makeDefaultValueWidget();
                    defaultValueContainer.setVisible(true);
                    break;
                case LIMITED_ENTRY:
                    makeLimitedValueWidget();
                    limitedEntryValueContainer.setVisible(true);
                    break;
            }
        }

        private void makeLimitedValueWidget() {
            if (!(chosenFieldsSelection instanceof LimitedEntryActionInsertFactCol52)) {
                return;
            }
            LimitedEntryActionInsertFactCol52 lea = (LimitedEntryActionInsertFactCol52) chosenFieldsSelection;
            if (lea.getValue() == null) {
                lea.setValue(factory.makeNewValue(chosenFieldsSelection));
            }
            limitedEntryValueWidgetContainer.setWidget(factory.getWidget(chosenFieldsSelection, lea.getValue()));
        }
    });
}
Also used : ActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52) LimitedEntryActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionInsertFactCol52) HashSet(java.util.HashSet) Set(java.util.Set) MultiSelectionModel(com.google.gwt.view.client.MultiSelectionModel) Label(org.gwtbootstrap3.client.ui.Label) LimitedEntryActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionInsertFactCol52) SelectionChangeEvent(com.google.gwt.view.client.SelectionChangeEvent) HashSet(java.util.HashSet)

Example 70 with ActionInsertFactCol52

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

the class ActionInsertFactFieldsPageViewImpl method btnRemoveFactTypesClick.

@UiHandler(value = "btnRemoveFactTypes")
public void btnRemoveFactTypesClick(final ClickEvent event) {
    for (ActionInsertFactFieldsPattern p : chosenPatternsSelections) {
        chosenPatterns.remove(p);
        presenter.removePattern(p);
    }
    chosenPatternsSelection = null;
    setChosenPatterns(chosenPatterns);
    setAvailableFields(new ArrayList<AvailableField>());
    setChosenFields(new ArrayList<ActionInsertFactCol52>());
    presenter.stateChanged();
    txtBinding.setText("");
    txtBinding.setEnabled(false);
    btnRemoveFactTypes.setEnabled(false);
    patternDefinition.setVisible(false);
}
Also used : ActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52) LimitedEntryActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionInsertFactCol52) ActionInsertFactFieldsPattern(org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactFieldsPattern) UiHandler(com.google.gwt.uibinder.client.UiHandler)

Aggregations

ActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)94 Test (org.junit.Test)64 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)35 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)31 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)31 ActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)30 LimitedEntryActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionInsertFactCol52)24 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)19 BRLActionColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLActionColumn)15 ActionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionCol52)13 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)13 LimitedEntryActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionSetFieldCol52)12 LimitedEntryConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryConditionCol52)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 ActionRetractFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionRetractFactCol52)10