use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.DeleteColumnManagementAnchorWidget in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testDeleteMetaDataColumnAnchor.
@Test
public void testDeleteMetaDataColumnAnchor() {
final DeleteColumnManagementAnchorWidget expectedWidget = mock(DeleteColumnManagementAnchorWidget.class);
final String columnHeader = "columnHeader";
final Command command = mock(Command.class);
doReturn(columnHeader).when(metadataColumn).getMetadata();
doReturn(expectedWidget).when(deleteColumnManagementAnchorWidgets).get();
doReturn(command).when(presenter).deleteMetadataCommand(modeller, metadataColumn);
final DeleteColumnManagementAnchorWidget actualWidget = presenter.deleteMetaDataColumnAnchor(modeller, metadataColumn);
verify(actualWidget).init(columnHeader, command);
assertEquals(expectedWidget, actualWidget);
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.DeleteColumnManagementAnchorWidget 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.DeleteColumnManagementAnchorWidget in project drools-wb by kiegroup.
the class ColumnsPagePresenter method deleteMetaDataColumnAnchor.
DeleteColumnManagementAnchorWidget deleteMetaDataColumnAnchor(final GuidedDecisionTableModellerView.Presenter modeller, final MetadataCol52 metaDataColumn) {
final DeleteColumnManagementAnchorWidget deleteWidget = deleteColumnManagementAnchorWidgets.get();
final Command deleteMetadataCommand = deleteMetadataCommand(modeller, metaDataColumn);
deleteWidget.init(metaDataColumn.getMetadata(), deleteMetadataCommand);
return deleteWidget;
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.DeleteColumnManagementAnchorWidget 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