Search in sources :

Example 1 with DeleteColumnManagementAnchorWidget

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);
}
Also used : Command(com.google.gwt.user.client.Command) ParameterizedCommand(org.uberfire.mvp.ParameterizedCommand) DeleteColumnManagementAnchorWidget(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.DeleteColumnManagementAnchorWidget) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 2 with DeleteColumnManagementAnchorWidget

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);
}
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 DeleteColumnManagementAnchorWidget

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;
}
Also used : Command(com.google.gwt.user.client.Command) DeleteColumnManagementAnchorWidget(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.DeleteColumnManagementAnchorWidget)

Example 4 with DeleteColumnManagementAnchorWidget

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

DeleteColumnManagementAnchorWidget (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.DeleteColumnManagementAnchorWidget)4 Test (org.junit.Test)3 Command (com.google.gwt.user.client.Command)2 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)2 ColumnLabelWidget (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnLabelWidget)2 CheckBox (org.gwtbootstrap3.client.ui.CheckBox)2 Matchers.anyString (org.mockito.Matchers.anyString)1 ParameterizedCommand (org.uberfire.mvp.ParameterizedCommand)1