use of org.kie.workbench.common.stunner.core.documentation.DocumentationPage in project kie-wb-common by kiegroup.
the class BPMNDiagramEditorTest method testAddDocumentationPage.
@Test
@SuppressWarnings("unchecked")
public void testAddDocumentationPage() {
when(documentationView.isEnabled()).thenReturn(Boolean.TRUE);
when(translationService.getValue(StunnerWidgetsConstants.Documentation)).thenReturn(DOC_LABEL);
when(documentationView.initialize(diagram)).thenReturn(documentationView);
ArgumentCaptor<DocumentationPage> documentationPageCaptor = ArgumentCaptor.forClass(DocumentationPage.class);
diagramEditor.addDocumentationPage(diagram);
verify(translationService).getValue(StunnerWidgetsConstants.Documentation);
verify(kieView).addPage(documentationPageCaptor.capture());
DocumentationPage documentationPage = documentationPageCaptor.getValue();
assertEquals(documentationPage.getDocumentationView(), documentationView);
assertEquals(documentationPage.getLabel(), DOC_LABEL);
}
use of org.kie.workbench.common.stunner.core.documentation.DocumentationPage in project kie-wb-common by kiegroup.
the class DMNDiagramEditorTest method testGetDocumentationPage.
@Test
public void testGetDocumentationPage() {
final DocumentationPage documentationPage = editor.getDocumentationPage();
assertEquals("Documentation", documentationPage.getLabel());
assertEquals(documentationView, documentationPage.getDocumentationView());
}
use of org.kie.workbench.common.stunner.core.documentation.DocumentationPage in project kie-wb-common by kiegroup.
the class AbstractProjectDiagramEditor method addDocumentationPage.
@SuppressWarnings("unchecked")
public void addDocumentationPage(final ProjectDiagram diagram) {
Optional.ofNullable(documentationView.isEnabled()).filter(Boolean.TRUE::equals).ifPresent(enabled -> {
final String label = translationService.getValue(StunnerWidgetsConstants.Documentation);
addPage(new DocumentationPage(documentationView.initialize(diagram), label, // firing the OnDiagramFocusEvent will force the docks to be minimized
() -> onDiagramFocusEvent.fire(new OnDiagramFocusEvent(getDockQualifiers())), // check the DocumentationPage is active, the index is 2
() -> Objects.equals(2, kieView.getSelectedTabIndex())));
});
}
use of org.kie.workbench.common.stunner.core.documentation.DocumentationPage in project kie-wb-common by kiegroup.
the class AbstractProjectDiagramEditorTest method testAddDocumentationPage.
@Test
@SuppressWarnings("unchecked")
public void testAddDocumentationPage() {
when(documentationView.isEnabled()).thenReturn(Boolean.TRUE);
when(translationService.getValue(StunnerWidgetsConstants.Documentation)).thenReturn(DOC_LABEL);
when(documentationView.initialize(diagram)).thenReturn(documentationView);
tested.addDocumentationPage(diagram);
verify(translationService).getValue(StunnerWidgetsConstants.Documentation);
ArgumentCaptor<DocumentationPage> documentationPageCaptor = ArgumentCaptor.forClass(DocumentationPage.class);
verify(kieView).addPage(documentationPageCaptor.capture());
final DocumentationPage documentationPage = documentationPageCaptor.getValue();
assertEquals(documentationPage.getDocumentationView(), documentationView);
assertEquals(documentationPage.getLabel(), DOC_LABEL);
}
use of org.kie.workbench.common.stunner.core.documentation.DocumentationPage in project kie-wb-common by kiegroup.
the class DMNDiagramEditorTest method testInit.
@Test
public void testInit() {
final Widget screenPanelWidget = mock(Widget.class);
final MultiPageEditor multiPageEditor = mock(MultiPageEditor.class);
final DocumentationPage documentationPage = mock(DocumentationPage.class);
final Supplier<Boolean> isDataTypesTabActiveSupplier = () -> true;
final Supplier<Integer> hashcodeSupplier = () -> 123;
doReturn(hashcodeSupplier).when(editor).getHashcodeSupplier();
doReturn(isDataTypesTabActiveSupplier).when(editor).getIsDataTypesTabActiveSupplier();
doReturn(documentationPage).when(editor).getDocumentationPage();
when(kieView.getMultiPage()).thenReturn(multiPageEditor);
when(screenPanelView.asWidget()).thenReturn(screenPanelWidget);
editor.init();
verify(decisionNavigatorDock).init(AuthoringPerspective.PERSPECTIVE_ID);
verify(diagramPreviewAndExplorerDock).init(AuthoringPerspective.PERSPECTIVE_ID);
verify(diagramPropertiesDock).init(AuthoringPerspective.PERSPECTIVE_ID);
verify(kieView).setPresenter(editor);
verify(kieView).clear();
verify(kieView).addMainEditorPage(screenPanelWidget);
verify(multiPageEditor).addPage(dataTypesPage);
verify(multiPageEditor).addPage(includedModelsPage);
verify(multiPageEditor).addPage(documentationPage);
verify(editorSearchIndex).setIsDataTypesTabActiveSupplier(isDataTypesTabActiveSupplier);
verify(editorSearchIndex).setCurrentAssetHashcodeSupplier(hashcodeSupplier);
verify(editor).setupSearchComponent();
}
Aggregations