Search in sources :

Example 31 with DecisionTableSelectedEvent

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

the class GuidedDecisionTableModellerPresenterTest method onDecisionTableSelectedNotAvailable.

@Test
public void onDecisionTableSelectedNotAvailable() {
    final GuidedDecisionTableView.Presenter dtPresenter1 = makeDecisionTable();
    final GuidedDecisionTableView.Presenter dtPresenter2 = makeDecisionTable();
    final DecisionTableSelectedEvent event = new DecisionTableSelectedEvent(dtPresenter1);
    when(presenter.getAvailableDecisionTables()).thenReturn(Collections.singleton(dtPresenter2));
    presenter.onDecisionTableSelected(event);
    assertFalse(presenter.getActiveDecisionTable().isPresent());
    verify(presenter, never()).doDecisionTableSelected(any(GuidedDecisionTableView.Presenter.class));
}
Also used : DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent) Test(org.junit.Test)

Example 32 with DecisionTableSelectedEvent

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

the class GuidedDecisionTableModellerPresenterTest method onDecisionTableSelectedNoneSelected.

@Test
public void onDecisionTableSelectedNoneSelected() {
    final DecisionTableSelectedEvent event = DecisionTableSelectedEvent.NONE;
    presenter.onDecisionTableSelected(event);
    assertFalse(presenter.getActiveDecisionTable().isPresent());
    verify(presenter, never()).doDecisionTableSelected(any(GuidedDecisionTableView.Presenter.class));
}
Also used : DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent) Test(org.junit.Test)

Example 33 with DecisionTableSelectedEvent

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

the class GuidedDecisionTableModellerPresenterTest method onDecisionTableSelectedWhenNotInPinnedMode.

@Test
@SuppressWarnings("unchecked")
public void onDecisionTableSelectedWhenNotInPinnedMode() {
    final GuidedDecisionTableView.Presenter dtPresenter1 = makeDecisionTable();
    final GuidedDecisionTableView.Presenter dtPresenter2 = makeDecisionTable();
    final DecisionTableSelectedEvent event = new DecisionTableSelectedEvent(dtPresenter1);
    when(presenter.isDecisionTableAvailable(eq(dtPresenter1))).thenReturn(true);
    when(presenter.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {

        {
            add(dtPresenter1);
            add(dtPresenter2);
        }
    });
    presenter.onDecisionTableSelected(event);
    verify(dtPresenter1, times(1)).initialiseAnalysis();
    verify(view, times(1)).select(dtPresenter1.getView());
    verify(gridLayer, never()).flipToGridWidget(any(GuidedDecisionTableView.class));
}
Also used : DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent) Test(org.junit.Test)

Example 34 with DecisionTableSelectedEvent

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

the class BaseGuidedDecisionTableEditorPresenter method openOtherDecisionTable.

void openOtherDecisionTable() {
    decisionTableSelectedEvent.fire(DecisionTableSelectedEvent.NONE);
    final Set<GuidedDecisionTableView.Presenter> availableDecisionTables = modeller.getAvailableDecisionTables();
    if (!(availableDecisionTables == null || availableDecisionTables.isEmpty())) {
        final GuidedDecisionTableView.Presenter dtPresenter = availableDecisionTables.iterator().next();
        decisionTableSelectedEvent.fire(new DecisionTableSelectedEvent(dtPresenter));
    }
}
Also used : GuidedDecisionTablePresenter(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter) SavePopUpPresenter(org.uberfire.ext.editor.commons.client.file.popups.SavePopUpPresenter) OverviewWidgetPresenter(org.kie.workbench.common.widgets.metadata.client.widget.OverviewWidgetPresenter) ImportsWidgetPresenter(org.kie.workbench.common.widgets.configresource.client.widget.bound.ImportsWidgetPresenter) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent)

Example 35 with DecisionTableSelectedEvent

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

the class GuidedDecisionTableEditorPresenterTest method startUpSelectsDecisionTable.

@Test
public void startUpSelectsDecisionTable() {
    final ObservablePath path = mock(ObservablePath.class);
    final PlaceRequest placeRequest = mock(PlaceRequest.class);
    final GuidedDecisionTableEditorContent content = makeDecisionTableContent();
    final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable(path, path, placeRequest, content);
    presenter.onStartup(path, placeRequest);
    verify(decisionTableSelectedEvent, times(1)).fire(dtSelectedEventCaptor.capture());
    final DecisionTableSelectedEvent dtSelectedEvent = dtSelectedEventCaptor.getValue();
    assertNotNull(dtSelectedEvent);
    assertTrue(dtSelectedEvent.getPresenter().isPresent());
    assertEquals(dtPresenter, dtSelectedEvent.getPresenter().get());
    verify(modellerGridPanel).setFocus(eq(true));
}
Also used : PlaceRequest(org.uberfire.mvp.PlaceRequest) GuidedDecisionTableEditorContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) 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