Search in sources :

Example 1 with DocumentationPage

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);
}
Also used : DocumentationPage(org.kie.workbench.common.stunner.core.documentation.DocumentationPage) AbstractProjectDiagramEditorTest(org.kie.workbench.common.stunner.project.client.editor.AbstractProjectDiagramEditorTest) Test(org.junit.Test)

Example 2 with DocumentationPage

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());
}
Also used : DocumentationPage(org.kie.workbench.common.stunner.core.documentation.DocumentationPage) Test(org.junit.Test)

Example 3 with DocumentationPage

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())));
    });
}
Also used : OnDiagramFocusEvent(org.kie.workbench.common.stunner.project.client.editor.event.OnDiagramFocusEvent) DocumentationPage(org.kie.workbench.common.stunner.core.documentation.DocumentationPage)

Example 4 with DocumentationPage

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);
}
Also used : DocumentationPage(org.kie.workbench.common.stunner.core.documentation.DocumentationPage) Test(org.junit.Test)

Example 5 with DocumentationPage

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();
}
Also used : Widget(com.google.gwt.user.client.ui.Widget) ElementWrapperWidget(org.jboss.errai.common.client.ui.ElementWrapperWidget) MultiPageEditor(org.uberfire.client.workbench.widgets.multipage.MultiPageEditor) ArgumentMatchers.anyBoolean(org.mockito.ArgumentMatchers.anyBoolean) DocumentationPage(org.kie.workbench.common.stunner.core.documentation.DocumentationPage) Test(org.junit.Test)

Aggregations

DocumentationPage (org.kie.workbench.common.stunner.core.documentation.DocumentationPage)5 Test (org.junit.Test)4 Widget (com.google.gwt.user.client.ui.Widget)1 ElementWrapperWidget (org.jboss.errai.common.client.ui.ElementWrapperWidget)1 AbstractProjectDiagramEditorTest (org.kie.workbench.common.stunner.project.client.editor.AbstractProjectDiagramEditorTest)1 OnDiagramFocusEvent (org.kie.workbench.common.stunner.project.client.editor.event.OnDiagramFocusEvent)1 ArgumentMatchers.anyBoolean (org.mockito.ArgumentMatchers.anyBoolean)1 MultiPageEditor (org.uberfire.client.workbench.widgets.multipage.MultiPageEditor)1