Search in sources :

Example 1 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 onFocus.

protected void onFocus() {
    modeller.getActiveDecisionTable().ifPresent(dt -> {
        decisionTableSelectedEvent.fire(new DecisionTableSelectedEvent(dt));
        dt.initialiseAnalysis();
    });
}
Also used : DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent)

Example 2 with DecisionTableSelectedEvent

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

the class GuidedDecisionTableGraphEditorPresenter method init.

@PostConstruct
public void init() {
    super.init();
    // Selecting a Decision Table in the document selector fires a selection event
    registeredDocumentsMenuBuilder.setActivateDocumentCommand((document) -> {
        final GuidedDecisionTablePresenter dtPresenter = ((GuidedDecisionTablePresenter) document);
        decisionTableSelectedEvent.fire(new DecisionTableSelectedEvent(dtPresenter));
    });
    // Removing a Decision Table from the document selector is equivalent to closing the editor
    registeredDocumentsMenuBuilder.setRemoveDocumentCommand((document) -> {
        final GuidedDecisionTablePresenter dtPresenter = ((GuidedDecisionTablePresenter) document);
        if (mayClose(dtPresenter)) {
            removeDocument(dtPresenter);
        }
    });
    registeredDocumentsMenuBuilder.setNewDocumentCommand(this::onNewDocument);
}
Also used : GuidedDecisionTablePresenter(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter) DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent) PostConstruct(javax.annotation.PostConstruct)

Example 3 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 onDecisionTableSelectedWhenInPinnedMode.

@Test
@SuppressWarnings("unchecked")
public void onDecisionTableSelectedWhenInPinnedMode() {
    final GuidedDecisionTableView.Presenter dtPresenter1 = makeDecisionTable();
    final GuidedDecisionTableView.Presenter dtPresenter2 = makeDecisionTable();
    final DecisionTableSelectedEvent event = new DecisionTableSelectedEvent(dtPresenter1);
    when(gridLayer.isGridPinned()).thenReturn(true);
    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, times(1)).flipToGridWidget(eq(dtPresenter1.getView()));
}
Also used : DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent) Test(org.junit.Test)

Example 4 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 onDecisionTableSelectedWithOtherActiveDecisionTable.

@Test
@SuppressWarnings("unchecked")
public void onDecisionTableSelectedWithOtherActiveDecisionTable() {
    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.getActiveDecisionTable()).thenReturn(Optional.of(dtPresenter2));
    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());
}
Also used : DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent) Test(org.junit.Test)

Example 5 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 onDecisionTableSelectedWithSameActiveDecisionTable.

@Test
@SuppressWarnings("unchecked")
public void onDecisionTableSelectedWithSameActiveDecisionTable() {
    final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
    final DecisionTableSelectedEvent event = new DecisionTableSelectedEvent(dtPresenter);
    when(presenter.isDecisionTableAvailable(eq(dtPresenter))).thenReturn(true);
    when(presenter.getActiveDecisionTable()).thenReturn(Optional.of(dtPresenter));
    when(presenter.getAvailableDecisionTables()).thenReturn(Collections.singleton(dtPresenter));
    presenter.onDecisionTableSelected(event);
    verify(dtPresenter, never()).initialiseAnalysis();
    verify(view, never()).select(any(GuidedDecisionTableView.class));
}
Also used : 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