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