Search in sources :

Example 1 with CellUtilities

use of org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.CellUtilities in project drools-wb by kiegroup.

the class GuidedDecisionTablePresenter method initialiseUtilities.

void initialiseUtilities() {
    this.cellUtilities = new CellUtilities();
    this.columnUtilities = new ColumnUtilities(model, oracle);
    // Setup the DropDownManager that requires the Model and UI data to determine drop-down lists
    // for dependent enumerations. This needs to be called before the columns are created.
    this.dependentEnumsUtilities = new DependentEnumsUtilities(model, oracle);
    // Setup Factories for new Columns and Cells
    gridWidgetColumnFactory.setConverters(getConverters());
    gridWidgetColumnFactory.initialise(model, oracle, columnUtilities, this);
    // Setup synchronizers to update the Model when the UiModel changes.
    synchronizer.setSynchronizers(getSynchronizers());
    synchronizer.initialise(model, uiModel, cellUtilities, columnUtilities, dependentEnumsUtilities, gridWidgetCellFactory, gridWidgetColumnFactory, view, rm, eventBus, access);
}
Also used : ColumnUtilities(org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.ColumnUtilities) DependentEnumsUtilities(org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.DependentEnumsUtilities) CellUtilities(org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.CellUtilities)

Example 2 with CellUtilities

use of org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.CellUtilities in project drools-wb by kiegroup.

the class BaseSynchronizerTest method setup.

@Before
public void setup() {
    // Setup model related classes
    model = new GuidedDecisionTable52();
    uiModel = new GuidedDecisionTableUiModel(modelSynchronizer);
    incrementalDataModelServiceCaller = new CallerMock<>(incrementalDataModelService);
    final BRLRuleModel rm = new BRLRuleModel(model);
    final CellUtilities cellUtilities = new CellUtilities();
    final ColumnUtilities columnUtilities = new ColumnUtilities(model, oracle);
    final DependentEnumsUtilities enumsUtilities = new DependentEnumsUtilities(model, oracle);
    final GridWidgetCellFactory gridWidgetCellFactory = new GridWidgetCellFactoryImpl();
    // Setup mocks
    final GuidedDecisionTableModellerView.Presenter modellerPresenter = mock(GuidedDecisionTableModellerView.Presenter.class);
    final GuidedDecisionTableModellerView modellerView = mock(GuidedDecisionTableModellerView.class);
    final GridLayer gridLayer = mock(GridLayer.class);
    final AbsolutePanel domElementContainer = mock(AbsolutePanel.class);
    final GuidedDecisionTableView.Presenter dtablePresenter = mock(GuidedDecisionTableView.Presenter.class);
    final EventBus eventBus = mock(EventBus.class);
    when(dtablePresenter.getModellerPresenter()).thenReturn(modellerPresenter);
    when(modellerPresenter.getView()).thenReturn(modellerView);
    when(modellerView.getGridLayerView()).thenReturn(gridLayer);
    when(gridLayer.getDomElementContainer()).thenReturn(domElementContainer);
    when(domElementContainer.iterator()).thenReturn(mock(Iterator.class));
    // Setup column converters
    final List<BaseColumnConverter> converters = getConverters();
    gridWidgetColumnFactory.setConverters(converters);
    gridWidgetColumnFactory.initialise(model, oracle, columnUtilities, dtablePresenter);
    // Setup synchronizers
    final List<Synchronizer<? extends MetaData, ? extends MetaData, ? extends MetaData, ? extends MetaData, ? extends MetaData>> synchronizers = getSynchronizers();
    modelSynchronizer.setSynchronizers(synchronizers);
    modelSynchronizer.initialise(model, uiModel, cellUtilities, columnUtilities, enumsUtilities, gridWidgetCellFactory, gridWidgetColumnFactory, view, rm, eventBus, editable);
    // Dummy columns for Row number and Description
    uiModel.appendColumn(gridWidgetColumnFactory.convertColumn(new RowNumberCol52(), readOnly, view));
    uiModel.appendColumn(gridWidgetColumnFactory.convertColumn(new DescriptionCol52(), readOnly, view));
    ApplicationPreferences.setUp(new HashMap<String, String>() {

        {
            put(ApplicationPreferences.DATE_FORMAT, "dd-MM-yyyy");
        }
    });
}
Also used : ColumnUtilities(org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.ColumnUtilities) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) GuidedDecisionTableModellerView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableModellerView) AbsolutePanel(com.google.gwt.user.client.ui.AbsolutePanel) EventBus(com.google.gwt.event.shared.EventBus) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) GridWidgetCellFactoryImpl(org.drools.workbench.screens.guided.dtable.client.widget.table.model.converters.cell.impl.GridWidgetCellFactoryImpl) DescriptionCol52(org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52) MetaData(org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.Synchronizer.MetaData) GuidedDecisionTableUiModel(org.drools.workbench.screens.guided.dtable.client.widget.table.model.GuidedDecisionTableUiModel) Iterator(java.util.Iterator) BaseColumnConverter(org.drools.workbench.screens.guided.dtable.client.widget.table.model.converters.column.BaseColumnConverter) Synchronizer(org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.Synchronizer) BRLRuleModel(org.drools.workbench.models.guided.dtable.shared.model.BRLRuleModel) DependentEnumsUtilities(org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.DependentEnumsUtilities) CellUtilities(org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.CellUtilities) GridLayer(org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer) GridWidgetCellFactory(org.drools.workbench.screens.guided.dtable.client.widget.table.model.converters.cell.GridWidgetCellFactory) RowNumberCol52(org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52) Before(org.junit.Before)

Example 3 with CellUtilities

use of org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.CellUtilities in project drools-wb by kiegroup.

the class ConditionColumnPlugin method assertDefaultValue.

void assertDefaultValue() {
    final CellUtilities cellUtilities = new CellUtilities();
    final AsyncPackageDataModelOracle oracle = presenter.getDataModelOracle();
    final ColumnUtilities columnUtilities = new ColumnUtilities(model(), oracle);
    final List<String> valueList = Arrays.asList(columnUtilities.getValueList(editingCol));
    if (valueList.size() > 0) {
        final String defaultValue = cellUtilities.asString(editingCol().getDefaultValue());
        if (!valueList.contains(defaultValue)) {
            editingCol.getDefaultValue().clearValues();
        }
    } else {
        // Ensure the Default Value has been updated to represent the column's data-type.
        final DTCellValue52 defaultValue = editingCol().getDefaultValue();
        final DataType.DataTypes dataType = columnUtilities.getDataType(editingPattern(), editingCol());
        cellUtilities.convertDTCellValueType(dataType, defaultValue);
    }
}
Also used : AsyncPackageDataModelOracle(org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle) ColumnUtilities(org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.ColumnUtilities) CellUtilities(org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.CellUtilities) DataType(org.kie.soup.project.datamodel.oracle.DataType) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)

Example 4 with CellUtilities

use of org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.CellUtilities in project drools-wb by kiegroup.

the class DefaultWidgetFactory method prepareDefaultValue.

private DTCellValue52 prepareDefaultValue() {
    final CellUtilities cellUtilities = new CellUtilities();
    final DTCellValue52 defaultValue = getDefaultValue();
    cellUtilities.convertDTCellValueType(dataType(), defaultValue);
    return defaultValue;
}
Also used : CellUtilities(org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.CellUtilities) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)

Example 5 with CellUtilities

use of org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.CellUtilities in project drools-wb by kiegroup.

the class AbstractGuidedDecisionTableWizardPage method setContent.

public void setContent(final Path contextPath, final String baseFileName, final GuidedDecisionTable52.TableFormat tableFormat, final GuidedDecisionTable52.HitPolicy hitPolicy, final AsyncPackageDataModelOracle oracle, final GuidedDecisionTable52 model, final Validator validator) {
    this.contextPath = contextPath;
    this.baseFileName = baseFileName;
    this.tableFormat = tableFormat;
    this.hitPolicy = hitPolicy;
    this.oracle = oracle;
    this.model = model;
    this.validator = validator;
    this.cellUtilities = new CellUtilities();
    this.columnUtilities = new ColumnUtilities(model, oracle);
}
Also used : ColumnUtilities(org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.ColumnUtilities) CellUtilities(org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.CellUtilities)

Aggregations

CellUtilities (org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.CellUtilities)5 ColumnUtilities (org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.ColumnUtilities)4 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)2 DependentEnumsUtilities (org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.DependentEnumsUtilities)2 EventBus (com.google.gwt.event.shared.EventBus)1 AbsolutePanel (com.google.gwt.user.client.ui.AbsolutePanel)1 Iterator (java.util.Iterator)1 BRLRuleModel (org.drools.workbench.models.guided.dtable.shared.model.BRLRuleModel)1 DescriptionCol52 (org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52)1 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)1 RowNumberCol52 (org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)1 GuidedDecisionTableModellerView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableModellerView)1 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)1 GuidedDecisionTableUiModel (org.drools.workbench.screens.guided.dtable.client.widget.table.model.GuidedDecisionTableUiModel)1 GridWidgetCellFactory (org.drools.workbench.screens.guided.dtable.client.widget.table.model.converters.cell.GridWidgetCellFactory)1 GridWidgetCellFactoryImpl (org.drools.workbench.screens.guided.dtable.client.widget.table.model.converters.cell.impl.GridWidgetCellFactoryImpl)1 BaseColumnConverter (org.drools.workbench.screens.guided.dtable.client.widget.table.model.converters.column.BaseColumnConverter)1 Synchronizer (org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.Synchronizer)1 MetaData (org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.Synchronizer.MetaData)1 Before (org.junit.Before)1