Search in sources :

Example 1 with AttributeColumnConfigRow

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());
    }
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) GuidedDecisionTableModellerView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableModellerView) AttributeColumnConfigRow(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.AttributeColumnConfigRow)

Example 2 with AttributeColumnConfigRow

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);
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) Label(com.google.gwt.user.client.ui.Label) Widget(com.google.gwt.user.client.ui.Widget) ColumnLabelWidget(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnLabelWidget) DeleteColumnManagementAnchorWidget(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.DeleteColumnManagementAnchorWidget) ArrayList(java.util.ArrayList) AttributeColumnConfigRow(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.AttributeColumnConfigRow) Test(org.junit.Test)

Example 3 with AttributeColumnConfigRow

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());
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) ArrayList(java.util.ArrayList) Label(com.google.gwt.user.client.ui.Label) AttributeColumnConfigRow(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.AttributeColumnConfigRow) Test(org.junit.Test)

Aggregations

AttributeCol52 (org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52)3 AttributeColumnConfigRow (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.AttributeColumnConfigRow)3 Label (com.google.gwt.user.client.ui.Label)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)1 Widget (com.google.gwt.user.client.ui.Widget)1 GuidedDecisionTableModellerView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableModellerView)1 ColumnLabelWidget (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnLabelWidget)1 DeleteColumnManagementAnchorWidget (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.DeleteColumnManagementAnchorWidget)1