Search in sources :

Example 1 with ColumnLabelWidget

use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnLabelWidget in project drools-wb by kiegroup.

the class ColumnsPagePresenter method makeMetaDataWidget.

HorizontalPanel makeMetaDataWidget(final GuidedDecisionTableModellerView.Presenter modeller, final MetadataCol52 metaDataColumn) {
    final HorizontalPanel horizontalPanel = makeHorizontalPanel();
    final ColumnLabelWidget label = makeColumnLabel(metaDataColumn);
    final boolean isEditable = modeller.isActiveDecisionTableEditable();
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.add(label);
    horizontalPanel.add(hideColumnCheckBox(modeller, metaDataColumn));
    if (isEditable) {
        horizontalPanel.add(deleteMetaDataColumnAnchor(modeller, metaDataColumn));
    }
    return horizontalPanel;
}
Also used : ColumnLabelWidget(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnLabelWidget) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel)

Example 2 with ColumnLabelWidget

use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnLabelWidget in project drools-wb by kiegroup.

the class ColumnsPagePresenterTest method testMakeMetaDataWidgetWhenDecisionTableIsNotEditable.

@Test
public void testMakeMetaDataWidgetWhenDecisionTableIsNotEditable() {
    final HorizontalPanel expectedHorizontalPanel = mock(HorizontalPanel.class);
    final ColumnLabelWidget columnLabelWidget = mock(ColumnLabelWidget.class);
    final CheckBox hideColumnCheckBox = mock(CheckBox.class);
    final DeleteColumnManagementAnchorWidget deleteColumnManagementAnchorWidget = mock(DeleteColumnManagementAnchorWidget.class);
    final boolean isEditable = false;
    doReturn(expectedHorizontalPanel).when(presenter).makeHorizontalPanel();
    doReturn(columnLabelWidget).when(presenter).makeColumnLabel(metadataColumn);
    doReturn(hideColumnCheckBox).when(presenter).hideColumnCheckBox(modeller, metadataColumn);
    doReturn(deleteColumnManagementAnchorWidget).when(presenter).deleteMetaDataColumnAnchor(modeller, metadataColumn);
    doReturn(isEditable).when(modeller).isActiveDecisionTableEditable();
    final HorizontalPanel actualHorizontalPanel = presenter.makeMetaDataWidget(modeller, metadataColumn);
    verify(actualHorizontalPanel).setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verify(actualHorizontalPanel).add(columnLabelWidget);
    verify(actualHorizontalPanel).add(hideColumnCheckBox);
    verify(actualHorizontalPanel, never()).add(deleteColumnManagementAnchorWidget);
    assertEquals(expectedHorizontalPanel, actualHorizontalPanel);
}
Also used : ColumnLabelWidget(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnLabelWidget) CheckBox(org.gwtbootstrap3.client.ui.CheckBox) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) DeleteColumnManagementAnchorWidget(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.DeleteColumnManagementAnchorWidget) Test(org.junit.Test)

Example 3 with ColumnLabelWidget

use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnLabelWidget in project drools-wb by kiegroup.

the class ColumnUtilitiesTest method testSetColumnLabelStyleWhenHiddenNegative.

@Test
public void testSetColumnLabelStyleWhenHiddenNegative() throws Exception {
    final ColumnLabelWidget label = mock(ColumnLabelWidget.class);
    ColumnUtilities.setColumnLabelStyleWhenHidden(label, false);
    verify(label).removeStyleName(GuidedDecisionTableResources.INSTANCE.css().columnLabelHidden());
}
Also used : ColumnLabelWidget(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnLabelWidget) Test(org.junit.Test)

Example 4 with ColumnLabelWidget

use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnLabelWidget in project drools-wb by kiegroup.

the class ColumnsPagePresenter method makeColumnLabel.

ColumnLabelWidget makeColumnLabel(final MetadataCol52 metaDataColumn) {
    final ColumnLabelWidget label = new ColumnLabelWidget(metaDataColumn.getMetadata());
    ColumnUtilities.setColumnLabelStyleWhenHidden(label, metaDataColumn.isHideColumn());
    return label;
}
Also used : ColumnLabelWidget(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnLabelWidget)

Example 5 with ColumnLabelWidget

use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnLabelWidget in project drools-wb by kiegroup.

the class ColumnsPagePresenterTest method testMakeMetaDataWidgetWhenDecisionTableIsEditable.

@Test
public void testMakeMetaDataWidgetWhenDecisionTableIsEditable() {
    final HorizontalPanel expectedHorizontalPanel = mock(HorizontalPanel.class);
    final ColumnLabelWidget columnLabelWidget = mock(ColumnLabelWidget.class);
    final CheckBox hideColumnCheckBox = mock(CheckBox.class);
    final DeleteColumnManagementAnchorWidget deleteColumnManagementAnchorWidget = mock(DeleteColumnManagementAnchorWidget.class);
    final boolean isEditable = true;
    doReturn(expectedHorizontalPanel).when(presenter).makeHorizontalPanel();
    doReturn(columnLabelWidget).when(presenter).makeColumnLabel(metadataColumn);
    doReturn(hideColumnCheckBox).when(presenter).hideColumnCheckBox(modeller, metadataColumn);
    doReturn(deleteColumnManagementAnchorWidget).when(presenter).deleteMetaDataColumnAnchor(modeller, metadataColumn);
    doReturn(isEditable).when(modeller).isActiveDecisionTableEditable();
    final HorizontalPanel actualHorizontalPanel = presenter.makeMetaDataWidget(modeller, metadataColumn);
    verify(actualHorizontalPanel).setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verify(actualHorizontalPanel).add(columnLabelWidget);
    verify(actualHorizontalPanel).add(hideColumnCheckBox);
    verify(actualHorizontalPanel).add(deleteColumnManagementAnchorWidget);
    assertEquals(expectedHorizontalPanel, actualHorizontalPanel);
}
Also used : ColumnLabelWidget(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnLabelWidget) CheckBox(org.gwtbootstrap3.client.ui.CheckBox) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) DeleteColumnManagementAnchorWidget(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.DeleteColumnManagementAnchorWidget) Test(org.junit.Test)

Aggregations

ColumnLabelWidget (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnLabelWidget)6 Test (org.junit.Test)4 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)3 DeleteColumnManagementAnchorWidget (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.DeleteColumnManagementAnchorWidget)2 CheckBox (org.gwtbootstrap3.client.ui.CheckBox)2