Search in sources :

Example 96 with GuidedDecisionTable52

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

the class NewGuidedDecisionTableWizard method setContent.

public void setContent(final Path contextPath, final String baseFileName, final GuidedDecisionTable52.TableFormat tableFormat, final GuidedDecisionTable52.HitPolicy hitPolicy, final AsyncPackageDataModelOracle oracle, final GuidedDecisionTableWizardHandler handler) {
    this.model = new GuidedDecisionTable52();
    this.model.setTableFormat(tableFormat);
    this.model.setHitPolicy(hitPolicy);
    if (GuidedDecisionTable52.HitPolicy.RESOLVED_HIT.equals(hitPolicy)) {
        final MetadataCol52 metadataCol52 = new MetadataCol52();
        metadataCol52.setMetadata(GuidedDecisionTable52.HitPolicy.RESOLVED_HIT_METADATA_NAME);
        this.model.getMetadataCols().add(metadataCol52);
    }
    this.contextPath = contextPath;
    this.oracle = oracle;
    this.handler = handler;
    final Validator validator = new Validator(model.getConditions());
    for (WizardPage page : pages) {
        final AbstractGuidedDecisionTableWizardPage dtp = (AbstractGuidedDecisionTableWizardPage) page;
        dtp.setContent(contextPath, baseFileName, tableFormat, hitPolicy, oracle, model, validator);
        dtp.initialise();
    }
}
Also used : MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) 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) Validator(org.drools.workbench.screens.guided.dtable.client.widget.Validator)

Example 97 with GuidedDecisionTable52

use of org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52 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)

Example 98 with GuidedDecisionTable52

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

the class ActionSetFieldsPageViewImpl method makeNewActionColumn.

private ActionSetFieldCol52 makeNewActionColumn(final AvailableField f) {
    final GuidedDecisionTable52.TableFormat format = presenter.getTableFormat();
    if (format == GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY) {
        final ActionSetFieldCol52 a = new ActionSetFieldCol52();
        a.setBoundName(availablePatternsSelection.getBoundName());
        a.setFactField(f.getName());
        a.setType(f.getType());
        return a;
    } else {
        final LimitedEntryActionSetFieldCol52 a = new LimitedEntryActionSetFieldCol52();
        a.setBoundName(availablePatternsSelection.getBoundName());
        a.setFactField(f.getName());
        a.setType(f.getType());
        return a;
    }
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) ActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52) LimitedEntryActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionSetFieldCol52) LimitedEntryActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionSetFieldCol52)

Example 99 with GuidedDecisionTable52

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

the class GuidedDecisionTableEditorPresenterTest method testGetIsDirtySupplierWhenItIsNotDirty.

@Test
public void testGetIsDirtySupplierWhenItIsNotDirty() {
    final GuidedDecisionTableView.Presenter presenter = mock(GuidedDecisionTableView.Presenter.class);
    final GuidedDecisionTable52 model = mock(GuidedDecisionTable52.class);
    final int currentHash = 123;
    final int originalHash = 123;
    doReturn(currentHash).when(this.presenter).currentHashCode(presenter);
    doReturn(originalHash).when(this.presenter).originalHashCode(presenter);
    doReturn(model).when(presenter).getModel();
    doReturn(presenter).when(this.presenter).getActiveDocument();
    final boolean isDirty = this.presenter.getIsDirtySupplier().get();
    assertFalse(isDirty);
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) Test(org.junit.Test)

Example 100 with GuidedDecisionTable52

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

the class CellContextMenuTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    model = new GuidedDecisionTable52();
    uiModel = new GuidedDecisionTableUiModel(mock(ModelSynchronizer.class));
    clipboard = new DefaultClipboard();
    when(dtPresenter.getView()).thenReturn(dtPresenterView);
    when(dtPresenter.getModel()).thenReturn(model);
    when(dtPresenter.getAccess()).thenReturn(access);
    when(dtPresenterView.getModel()).thenReturn(uiModel);
    uiModel.appendColumn(new BaseGridColumn<String>(mock(GridColumn.HeaderMetaData.class), mock(GridColumnRenderer.class), 100));
    uiModel.appendColumn(new BaseGridColumn<String>(mock(GridColumn.HeaderMetaData.class), mock(GridColumnRenderer.class), 100));
    uiModel.appendColumn(new BaseGridColumn<String>(mock(GridColumn.HeaderMetaData.class), mock(GridColumnRenderer.class), 100));
    uiModel.appendRow(new BaseGridRow());
    menu = spy(new CellContextMenu(view, clipboard));
    menu.setup();
}
Also used : DefaultClipboard(org.drools.workbench.screens.guided.dtable.client.editor.clipboard.impl.DefaultClipboard) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) GuidedDecisionTableUiModel(org.drools.workbench.screens.guided.dtable.client.widget.table.model.GuidedDecisionTableUiModel) BaseGridColumn(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) Before(org.junit.Before)

Aggregations

GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)262 Test (org.junit.Test)193 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)92 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)74 Path (org.uberfire.backend.vfs.Path)52 ArrayList (java.util.ArrayList)51 LimitedEntryConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryConditionCol52)51 SingleFieldConstraint (org.drools.workbench.models.datamodel.rule.SingleFieldConstraint)47 BaseSingleFieldConstraint (org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)39 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)37 ActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)35 DescriptionCol52 (org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52)33 RowNumberCol52 (org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)33 PackageDataModelOracleBaselinePayload (org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload)33 AsyncPackageDataModelOracle (org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle)32 BRLActionColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLActionColumn)31 ActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)27 BRLActionVariableColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLActionVariableColumn)27 BRLConditionColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLConditionColumn)26 RawMVELEvaluator (org.kie.soup.project.datamodel.commons.util.RawMVELEvaluator)26