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);
}
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");
}
});
}
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);
}
}
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;
}
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);
}
Aggregations