use of org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter 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.GuidedDecisionTablePresenter in project drools-wb by kiegroup.
the class GuidedDecisionTableGraphEditorPresenterTest method checkInitRemoveDocumentFromRegisteredDocumentMenu.
@Test
public void checkInitRemoveDocumentFromRegisteredDocumentMenu() {
verify(registeredDocumentsMenuBuilder, times(1)).setRemoveDocumentCommand(removeDocumentCommandCaptor.capture());
final GuidedDecisionTablePresenter dtPresenter = mock(GuidedDecisionTablePresenter.class);
doReturn(true).when(presenter).mayClose(eq(dtPresenter));
doNothing().when(presenter).removeDocument(any(GuidedDecisionTablePresenter.class));
final ParameterizedCommand<KieDocument> removeDocumentCommand = removeDocumentCommandCaptor.getValue();
assertNotNull(removeDocumentCommand);
removeDocumentCommand.execute(dtPresenter);
verify(presenter, times(1)).mayClose(eq(dtPresenter));
verify(presenter, times(1)).removeDocument(eq(dtPresenter));
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter in project drools-wb by kiegroup.
the class GuidedDecisionTableGraphEditorPresenterTest method checkInitActivateDocumentFromRegisteredDocumentMenu.
@Test
public void checkInitActivateDocumentFromRegisteredDocumentMenu() {
verify(registeredDocumentsMenuBuilder, times(1)).setActivateDocumentCommand(activateDocumentCommandCaptor.capture());
final GuidedDecisionTablePresenter dtPresenter = mock(GuidedDecisionTablePresenter.class);
final ParameterizedCommand<KieDocument> activeDocumentCommand = activateDocumentCommandCaptor.getValue();
assertNotNull(activeDocumentCommand);
activeDocumentCommand.execute(dtPresenter);
verify(decisionTableSelectedEvent, times(1)).fire(dtSelectedEventCaptor.capture());
assertNotNull(dtSelectedEventCaptor.getValue());
assertEquals(dtPresenter, dtSelectedEventCaptor.getValue().getPresenter().get());
}
Aggregations