use of org.drools.workbench.screens.guided.dtable.client.widget.table.model.converters.column.BaseColumnConverter in project drools-wb by kiegroup.
the class BaseSynchronizerTest method getConverters.
protected List<BaseColumnConverter> getConverters() {
final List<BaseColumnConverter> converters = new ArrayList<BaseColumnConverter>();
converters.add(new ActionInsertFactColumnConverter());
converters.add(new ActionRetractFactColumnConverter());
converters.add(new ActionSetFieldColumnConverter());
converters.add(new ActionWorkItemExecuteColumnConverter());
converters.add(new ActionWorkItemInsertFactColumnConverter());
converters.add(new ActionWorkItemSetFieldColumnConverter());
converters.add(new AttributeColumnConverter());
converters.add(new BRLActionVariableColumnConverter());
converters.add(new BRLConditionVariableColumnConverter());
converters.add(new ConditionColumnConverter());
converters.add(new DescriptionColumnConverter());
converters.add(new LimitedEntryColumnConverter());
converters.add(new MetaDataColumnConverter());
converters.add(new RuleNameColumnConverter());
converters.add(new RowNumberColumnConverter());
return converters;
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.model.converters.column.BaseColumnConverter 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, rule name and Description
uiModel.appendColumn(gridWidgetColumnFactory.convertColumn(new RowNumberCol52(), readOnly, view));
uiModel.appendColumn(gridWidgetColumnFactory.convertColumn(new RuleNameColumn(), 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.model.converters.column.BaseColumnConverter in project drools-wb by kiegroup.
the class GridWidgetColumnFactoryImpl method convertColumn.
@Override
public GridColumn<?> convertColumn(final BaseColumn column, final GuidedDecisionTablePresenter.Access access, final GuidedDecisionTableView gridWidget) {
for (BaseColumnConverter converter : converters) {
if (converter.handles(column)) {
final GridColumn<?> uiColumn = converter.convertColumn(column, access, gridWidget);
if (uiColumn instanceof BaseUiColumn) {
((BaseUiColumn) uiColumn).setColumnResizeListener((double width) -> column.setWidth(((int) width)));
}
// Copy back UI Column width into Model as BaseColumn does not have a width set by default
column.setWidth((int) uiColumn.getWidth());
return uiColumn;
}
}
throw new IllegalArgumentException("Column '" + column.getHeader() + "' was not converted.");
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.model.converters.column.BaseColumnConverter in project drools-wb by kiegroup.
the class BaseConverterTest method setup.
@Before
public void setup() {
this.model = getModel();
this.oracle = getOracle();
this.presenter = getPresenter();
this.columnUtilities = new ColumnUtilities(model, oracle);
for (BaseColumnConverter bcc : getConverters()) {
bcc.initialise(model, oracle, columnUtilities, presenter);
}
}
Aggregations