Search in sources :

Example 96 with DTCellValue52

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

the class FactPatternConstraintsPageViewImpl method makeDefaultValueWidget.

private void makeDefaultValueWidget() {
    DTCellValue52 defaultValue = chosenConditionsSelection.getDefaultValue();
    if (defaultValue == null) {
        defaultValue = factory.makeNewValue(chosenConditionsSelection);
        chosenConditionsSelection.setDefaultValue(defaultValue);
    }
    // Correct comma-separated Default Value if operator does not support it
    if (!validator.doesOperatorAcceptCommaSeparatedValues(chosenConditionsSelection)) {
        cellUtilities.removeCommaSeparatedValue(defaultValue);
    }
    defaultValueWidgetContainer.setWidget(factory.getWidget(availablePatternsSelection, chosenConditionsSelection, defaultValue));
}
Also used : DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)

Example 97 with DTCellValue52

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

the class ActionSetFieldsPage method assertDefaultValue.

@Override
public void assertDefaultValue(final Pattern52 selectedPattern, final ActionSetFieldCol52 selectedAction) {
    final List<String> valueList = Arrays.asList(columnUtilities.getValueList(selectedAction));
    if (valueList.size() > 0) {
        final String defaultValue = cellUtilities.asString(selectedAction.getDefaultValue());
        if (!valueList.contains(defaultValue)) {
            selectedAction.getDefaultValue().clearValues();
        }
    } else {
        // Ensure the Default Value has been updated to represent the column's data-type.
        final DTCellValue52 defaultValue = selectedAction.getDefaultValue();
        final DataType.DataTypes dataType = columnUtilities.getDataType(selectedPattern, selectedAction);
        cellUtilities.convertDTCellValueType(dataType, defaultValue);
    }
}
Also used : DataType(org.kie.soup.project.datamodel.oracle.DataType) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)

Example 98 with DTCellValue52

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

the class RowExpander method addLimitedEntryColumn.

private void addLimitedEntryColumn(final ConditionCol52 c) {
    final List<DTCellValue52> values = new ArrayList<DTCellValue52>();
    values.add(new DTCellValue52(Boolean.TRUE));
    values.add(new DTCellValue52(Boolean.FALSE));
    final ColumnValues cv = new ColumnValues(columns, values, c.getDefaultValue());
    this.expandedColumns.put(c, cv);
    this.columns.add(cv);
}
Also used : ArrayList(java.util.ArrayList) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)

Example 99 with DTCellValue52

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

the class CellContextMenuTest method testOnDecisionTableSelectionsChangedEventWithSelectionsWithClipboardPopulated.

@Test
public void testOnDecisionTableSelectionsChangedEventWithSelectionsWithClipboardPopulated() {
    model.getMetadataCols().add(new MetadataCol52());
    model.getData().add(new ArrayList<DTCellValue52>() {

        {
            add(new DTCellValue52(1));
            add(new DTCellValue52("descr"));
            add(new DTCellValue52("md"));
        }
    });
    uiModel.selectCell(0, 2);
    clipboard.setData(new HashSet<Clipboard.ClipboardData>() {

        {
            add(new DefaultClipboard.ClipboardDataImpl(0, 2, model.getData().get(0).get(2)));
        }
    });
    menu.onDecisionTableSelectionsChangedEvent(new DecisionTableSelectionsChangedEvent(dtPresenter));
    verify(view, times(1)).enableCutMenuItem(eq(true));
    verify(view, times(1)).enableCopyMenuItem(eq(true));
    verify(view, times(1)).enablePasteMenuItem(eq(true));
    verify(view, times(1)).enableDeleteCellMenuItem(eq(true));
}
Also used : MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) DecisionTableSelectionsChangedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectionsChangedEvent) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) Test(org.junit.Test)

Example 100 with DTCellValue52

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

the class RowSynchronizerTest method testMoveRowMoveUpMidBlock.

@Test
public void testMoveRowMoveUpMidBlock() throws VetoException {
    modelSynchronizer.appendRow();
    modelSynchronizer.appendRow();
    modelSynchronizer.appendRow();
    final GridRow uiRow0 = uiModel.getRow(0);
    final GridRow uiRow1 = uiModel.getRow(1);
    final GridRow uiRow2 = uiModel.getRow(2);
    final List<DTCellValue52> row0 = model.getData().get(0);
    final List<DTCellValue52> row1 = model.getData().get(1);
    final List<DTCellValue52> row2 = model.getData().get(2);
    uiModel.moveRowsTo(1, new ArrayList<GridRow>() {

        {
            add(uiRow2);
        }
    });
    assertEquals(uiRow0, uiModel.getRow(0));
    assertEquals(uiRow2, uiModel.getRow(1));
    assertEquals(uiRow1, uiModel.getRow(2));
    assertEquals(row0, model.getData().get(0));
    assertEquals(row2, model.getData().get(1));
    assertEquals(row1, model.getData().get(2));
}
Also used : DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) GridRow(org.uberfire.ext.wires.core.grids.client.model.GridRow) Test(org.junit.Test)

Aggregations

DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)244 Test (org.junit.Test)121 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)53 ArrayList (java.util.ArrayList)51 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)46 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)46 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)39 LimitedEntryConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryConditionCol52)39 AttributeCol52 (org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52)30 List (java.util.List)29 ActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)28 BaseSingleFieldConstraint (org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)27 ActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)25 AsyncPackageDataModelOracle (org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle)24 RowNumberCol52 (org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)23 DescriptionCol52 (org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52)21 RuleModel (org.drools.workbench.models.datamodel.rule.RuleModel)20 SingleFieldConstraint (org.drools.workbench.models.datamodel.rule.SingleFieldConstraint)20 GuidedDTTemplateDataProvider (org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider)20 TemplateDataProvider (org.drools.workbench.models.guided.dtable.backend.util.TemplateDataProvider)20