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;
}
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);
}
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());
}
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;
}
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);
}
Aggregations