Search in sources :

Example 41 with DecisionTableSelectedEvent

use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent in project drools-wb by kiegroup.

the class InsertMenuBuilderTest method testOnDecisionTableSelectedEventReadOnly.

@Test
public void testOnDecisionTableSelectedEventReadOnly() {
    dtPresenter.getAccess().setReadOnly(true);
    builder.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(dtPresenter));
    assertFalse(builder.miAppendRow.getMenuItem().isEnabled());
    assertFalse(builder.miInsertRowAbove.getMenuItem().isEnabled());
    assertFalse(builder.miInsertRowBelow.getMenuItem().isEnabled());
    assertFalse(builder.miInsertColumn.getMenuItem().isEnabled());
}
Also used : DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent) Test(org.junit.Test)

Example 42 with DecisionTableSelectedEvent

use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent in project drools-wb by kiegroup.

the class InsertMenuBuilderTest method testOnDecisionTableSelectedEventWithMultipleRowsSelectedAndItHasEditableColumns.

@Test
public void testOnDecisionTableSelectedEventWithMultipleRowsSelectedAndItHasEditableColumns() {
    model.getConditions().add(makePattern52());
    model.getData().add(makeDTCellValue52List());
    model.getData().add(makeDTCellValue52List());
    uiModel.selectCells(0, 2, 1, 2);
    builder.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(dtPresenter));
    assertTrue(builder.miAppendRow.getMenuItem().isEnabled());
    assertFalse(builder.miInsertRowAbove.getMenuItem().isEnabled());
    assertFalse(builder.miInsertRowBelow.getMenuItem().isEnabled());
    assertTrue(builder.miInsertColumn.getMenuItem().isEnabled());
}
Also used : DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent) Test(org.junit.Test)

Example 43 with DecisionTableSelectedEvent

use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent in project drools-wb by kiegroup.

the class RowContextMenuTest method testOnDecisionTableSelectedEventReadOnly.

@Test
public void testOnDecisionTableSelectedEventReadOnly() {
    dtPresenter.getAccess().setReadOnly(true);
    menu.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(dtPresenter));
    verify(view, times(1)).enableCutMenuItem(eq(false));
    verify(view, times(1)).enableCopyMenuItem(eq(false));
    verify(view, times(1)).enablePasteMenuItem(eq(false));
    verify(view, times(1)).enableInsertRowAboveMenuItem(eq(false));
    verify(view, times(1)).enableInsertRowBelowMenuItem(eq(false));
    verify(view, times(1)).enableDeleteRowMenuItem(eq(false));
}
Also used : DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent) Test(org.junit.Test)

Example 44 with DecisionTableSelectedEvent

use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent in project drools-wb by kiegroup.

the class RowContextMenuTest method testOnDecisionTableSelectedEventWithMultipleRowsSelected.

@Test
public void testOnDecisionTableSelectedEventWithMultipleRowsSelected() {
    model.getData().add(new ArrayList<DTCellValue52>() {

        {
            add(new DTCellValue52(1));
            add(new DTCellValue52("descr"));
            add(new DTCellValue52("md"));
        }
    });
    model.getData().add(new ArrayList<DTCellValue52>() {

        {
            add(new DTCellValue52(1));
            add(new DTCellValue52("descr"));
            add(new DTCellValue52("md"));
        }
    });
    uiModel.selectCells(0, 2, 1, 2);
    menu.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(dtPresenter));
    verify(view, times(1)).enableCutMenuItem(eq(true));
    verify(view, times(1)).enableCopyMenuItem(eq(true));
    verify(view, times(1)).enablePasteMenuItem(eq(false));
    verify(view, times(1)).enableInsertRowAboveMenuItem(eq(false));
    verify(view, times(1)).enableInsertRowBelowMenuItem(eq(false));
    verify(view, times(1)).enableDeleteRowMenuItem(eq(true));
}
Also used : DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent) Test(org.junit.Test)

Example 45 with DecisionTableSelectedEvent

use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent in project drools-wb by kiegroup.

the class BaseGuidedDecisionTableEditorPresenterTest method checkRefreshDocument.

@Test
public void checkRefreshDocument() {
    final ObservablePath path = mock(ObservablePath.class);
    final PlaceRequest placeRequest = mock(PlaceRequest.class);
    final GuidedDecisionTableEditorContent content = makeDecisionTableContent();
    final MultiPageEditor pageEditor = mock(MultiPageEditor.class);
    final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable(path, path, placeRequest, content);
    presenter.onStartup(path, placeRequest);
    verify(view, times(1)).showLoading();
    verify(dtService, times(1)).loadContent(eq(path));
    verify(decisionTableSelectedEvent, times(1)).fire(dtSelectedEventCaptor.capture());
    verify(view, times(1)).hideBusyIndicator();
    final DecisionTableSelectedEvent dtSelectedEvent = dtSelectedEventCaptor.getValue();
    assertNotNull(dtSelectedEvent);
    assertTrue(dtSelectedEvent.getPresenter().isPresent());
    assertEquals(dtPresenter, dtSelectedEvent.getPresenter().get());
    when(dtPresenter.getCurrentPath()).thenReturn(path);
    when(presenter.getKieEditorWrapperMultiPage()).thenReturn(pageEditor);
    presenter.refreshDocument(dtPresenter);
    verify(view, times(2)).showLoading();
    verify(dtService, times(2)).loadContent(eq(path));
    verify(modeller, times(1)).refreshDecisionTable(eq(dtPresenter), eq(path), eq(placeRequest), eq(content), any(Boolean.class));
    verify(presenter, times(1)).activateDocument(eq(dtPresenter));
    verify(view, times(2)).hideBusyIndicator();
}
Also used : PlaceRequest(org.uberfire.mvp.PlaceRequest) GuidedDecisionTableEditorContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent) MultiPageEditor(org.uberfire.client.workbench.widgets.multipage.MultiPageEditor) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) Matchers.anyBoolean(org.mockito.Matchers.anyBoolean) ObservablePath(org.uberfire.backend.vfs.ObservablePath) DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent) Test(org.junit.Test)

Aggregations

DecisionTableSelectedEvent (org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent)58 Test (org.junit.Test)54 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)14 ObservablePath (org.uberfire.backend.vfs.ObservablePath)10 PlaceRequest (org.uberfire.mvp.PlaceRequest)10 GuidedDecisionTablePresenter (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter)9 GuidedDecisionTableEditorContent (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent)9 MetadataCol52 (org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52)7 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)5 GuidedDecisionTableEditorGraphContent (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphContent)2 GuidedDecisionTableGraphEntry (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry)2 OverviewWidgetPresenter (org.kie.workbench.common.widgets.metadata.client.widget.OverviewWidgetPresenter)2 Matchers.anyBoolean (org.mockito.Matchers.anyBoolean)2 MultiPageEditor (org.uberfire.client.workbench.widgets.multipage.MultiPageEditor)2 PathPlaceRequest (org.uberfire.mvp.impl.PathPlaceRequest)2 PostConstruct (javax.annotation.PostConstruct)1 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)1 Overview (org.guvnor.common.services.shared.metadata.model.Overview)1 AsyncPackageDataModelOracle (org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle)1 ImportsWidgetPresenter (org.kie.workbench.common.widgets.configresource.client.widget.bound.ImportsWidgetPresenter)1