use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.AttributeColumnConfigRow in project drools-wb by kiegroup.
the class ColumnsPagePresenter method refreshAttributeWidget.
void refreshAttributeWidget(final List<AttributeCol52> attributeColumns) {
final Optional<GuidedDecisionTableModellerView.Presenter> optionalModeller = Optional.ofNullable(getModeller());
final VerticalPanel attributeWidget = getAttributeWidget();
if (!optionalModeller.isPresent()) {
return;
}
final GuidedDecisionTableModellerView.Presenter modeller = optionalModeller.get();
attributeWidget.clear();
if (attributeColumns.isEmpty()) {
attributeWidget.add(blankSlate());
return;
}
for (final AttributeCol52 attributeColumn : attributeColumns) {
final AttributeColumnConfigRow columnConfigRow = attributeColumnConfigRow.get();
columnConfigRow.init(attributeColumn, modeller);
attributeWidget.add(columnConfigRow.getView());
}
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.AttributeColumnConfigRow in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testRefreshAttributeWidgetWhenAttributeColumnsIsNotEmpty.
@Test
public void testRefreshAttributeWidgetWhenAttributeColumnsIsNotEmpty() {
final AttributeColumnConfigRow attributeColumnConfigRow = mock(AttributeColumnConfigRow.class);
final Label blankSlate = mock(Label.class);
final AttributeCol52 attributeCol52 = mock(AttributeCol52.class);
final Widget widget = mock(Widget.class);
final List<AttributeCol52> attributeColumns = new ArrayList<AttributeCol52>() {
{
add(attributeCol52);
}
};
doReturn(verticalPanel).when(presenter).getAttributeWidget();
doReturn(attributeColumnConfigRow).when(this.attributeColumnConfigRow).get();
doReturn(widget).when(attributeColumnConfigRow).getView();
doReturn(blankSlate).when(presenter).blankSlate();
presenter.refreshAttributeWidget(attributeColumns);
verify(attributeColumnConfigRow).init(attributeCol52, modeller);
verify(verticalPanel, never()).add(blankSlate);
verify(verticalPanel).add(widget);
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.AttributeColumnConfigRow in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testRefreshAttributeWidgetWhenAttributeColumnsIsEmpty.
@Test
public void testRefreshAttributeWidgetWhenAttributeColumnsIsEmpty() {
final List<AttributeCol52> attributeColumns = new ArrayList<>();
final AttributeColumnConfigRow attributeColumnConfigRow = mock(AttributeColumnConfigRow.class);
final Label blankSlate = mock(Label.class);
doReturn(verticalPanel).when(presenter).getAttributeWidget();
doReturn(attributeColumnConfigRow).when(this.attributeColumnConfigRow).get();
doReturn(blankSlate).when(presenter).blankSlate();
presenter.refreshAttributeWidget(attributeColumns);
verify(verticalPanel).add(blankSlate);
verify(attributeColumnConfigRow, never()).init(any(), any());
}
Aggregations