use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BaseUiColumn 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.columns.BaseUiColumn in project drools-wb by kiegroup.
the class GridWidgetColumnFactoryImplTest method columnResizingListenerSetup_ActionSetFieldColumn.
@Test
public void columnResizingListenerSetup_ActionSetFieldColumn() {
final Pattern52 pattern = mock(Pattern52.class);
final ActionSetFieldCol52 column = new ActionSetFieldCol52();
column.setFactField("MyField");
column.setHeader("MyColumn");
column.setBoundName("$f");
when(model.getConditions()).thenReturn(new ArrayList<CompositeColumn<? extends BaseColumn>>() {
{
add(pattern);
}
});
when(pattern.getFactType()).thenReturn("MyFact");
when(pattern.getBoundName()).thenReturn("$f");
when(pattern.isBound()).thenReturn(true);
when(oracle.getFieldType("MyFact", "MyField")).thenReturn(DataType.TYPE_STRING);
final GridColumn<?> uiColumn = factory.convertColumn(column, access, gridWidget);
assertTrue(uiColumn instanceof BaseUiColumn);
assertEquals((int) uiColumn.getWidth(), column.getWidth());
uiColumn.setWidth(200.0);
assertEquals(200, column.getWidth());
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BaseUiColumn in project drools-wb by kiegroup.
the class GridWidgetColumnFactoryImplTest method columnResizingListenerSetup_MetadataColumn.
@Test
public void columnResizingListenerSetup_MetadataColumn() {
final MetadataCol52 column = new MetadataCol52();
column.setMetadata("metadata");
final GridColumn<?> uiColumn = factory.convertColumn(column, access, gridWidget);
assertTrue(uiColumn instanceof BaseUiColumn);
assertEquals((int) uiColumn.getWidth(), column.getWidth());
uiColumn.setWidth(200.0);
assertEquals(200, column.getWidth());
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BaseUiColumn in project drools-wb by kiegroup.
the class GridWidgetColumnFactoryImplTest method columnResizingListenerSetup_ConditionColumn.
@Test
public void columnResizingListenerSetup_ConditionColumn() {
final Pattern52 pattern = mock(Pattern52.class);
final ConditionCol52 column = new ConditionCol52();
column.setFactField("MyField");
column.setHeader("MyColumn");
when(model.getPattern(eq(column))).thenReturn(pattern);
when(pattern.getFactType()).thenReturn("MyFact");
when(oracle.getFieldType("MyFact", "MyField")).thenReturn(DataType.TYPE_STRING);
final GridColumn<?> uiColumn = factory.convertColumn(column, access, gridWidget);
assertTrue(uiColumn instanceof BaseUiColumn);
assertEquals((int) uiColumn.getWidth(), column.getWidth());
uiColumn.setWidth(200.0);
assertEquals(200, column.getWidth());
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BaseUiColumn in project drools-wb by kiegroup.
the class GridWidgetColumnFactoryImplTest method columnResizingListenerSetup_DescriptionColumn.
@Test
public void columnResizingListenerSetup_DescriptionColumn() {
final BaseColumn column = new DescriptionCol52();
final GridColumn<?> uiColumn = factory.convertColumn(column, access, gridWidget);
assertTrue(uiColumn instanceof BaseUiColumn);
assertEquals((int) uiColumn.getWidth(), column.getWidth());
assertEquals(150.0, column.getWidth(), 0.0);
uiColumn.setWidth(200.0);
assertEquals(200, column.getWidth());
}
Aggregations