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