Search in sources :

Example 16 with PlaceGainFocusEvent

use of org.uberfire.client.workbench.events.PlaceGainFocusEvent in project kie-wb-common by kiegroup.

the class KieEditorTest method testShowDiagramEditorDocks.

@Test
public void testShowDiagramEditorDocks() {
    doReturn(Optional.of(mock(WorkspaceProject.class))).when(workbenchContext).getActiveWorkspaceProject();
    PlaceRequest placeRequest = mock(PlaceRequest.class);
    when(placeRequest.getIdentifier()).thenReturn(KieEditorFake.EDITOR_ID);
    presenter.init(mock(ObservablePath.class), placeRequest, mock(ClientResourceType.class));
    when(docks.isSetup()).thenReturn(false);
    PerspectiveActivity perspectiveActivity = mock(PerspectiveActivity.class);
    when(perspectiveActivity.getIdentifier()).thenReturn("perspectiveId");
    when(perspectiveManager.getCurrentPerspective()).thenReturn(perspectiveActivity);
    presenter.onShowDiagramEditorDocks(new PlaceGainFocusEvent(placeRequest));
    verify(docks).setup(eq("perspectiveId"), placeRequestArgumentCaptor.capture());
    assertEquals("org.kie.guvnor.explorer", placeRequestArgumentCaptor.getValue().getIdentifier());
    verify(docks).show();
}
Also used : PlaceRequest(org.uberfire.mvp.PlaceRequest) PlaceGainFocusEvent(org.uberfire.client.workbench.events.PlaceGainFocusEvent) PerspectiveActivity(org.uberfire.client.mvp.PerspectiveActivity) ClientResourceType(org.uberfire.client.workbench.type.ClientResourceType) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Example 17 with PlaceGainFocusEvent

use of org.uberfire.client.workbench.events.PlaceGainFocusEvent in project kie-wb-common by kiegroup.

the class KieEditorTest method testShowDiagramEditorDocksInitDone.

@Test
public void testShowDiagramEditorDocksInitDone() {
    doReturn(Optional.of(mock(WorkspaceProject.class))).when(workbenchContext).getActiveWorkspaceProject();
    PlaceRequest placeRequest = mock(PlaceRequest.class);
    when(placeRequest.getIdentifier()).thenReturn(KieEditorFake.EDITOR_ID);
    presenter.init(mock(ObservablePath.class), placeRequest, mock(ClientResourceType.class));
    when(docks.isSetup()).thenReturn(true);
    PerspectiveActivity perspectiveActivity = mock(PerspectiveActivity.class);
    when(perspectiveActivity.getIdentifier()).thenReturn("perspectiveId");
    when(perspectiveManager.getCurrentPerspective()).thenReturn(perspectiveActivity);
    presenter.onShowDiagramEditorDocks(new PlaceGainFocusEvent(placeRequest));
    verify(docks, never()).setup(anyString(), any());
    verify(docks).show();
}
Also used : PlaceRequest(org.uberfire.mvp.PlaceRequest) PlaceGainFocusEvent(org.uberfire.client.workbench.events.PlaceGainFocusEvent) PerspectiveActivity(org.uberfire.client.mvp.PerspectiveActivity) ClientResourceType(org.uberfire.client.workbench.type.ClientResourceType) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Example 18 with PlaceGainFocusEvent

use of org.uberfire.client.workbench.events.PlaceGainFocusEvent in project drools-wb by kiegroup.

the class BaseGuidedDecisionTableEditorPresenterTest method setupTheDocks.

@Test
public void setupTheDocks() {
    final ObservablePath path = mock(ObservablePath.class);
    final PlaceRequest placeRequest = mock(PlaceRequest.class);
    doReturn(GuidedDecisionTableEditorPresenter.IDENTIFIER).when(placeRequest).getIdentifier();
    final GuidedDecisionTableEditorContent content = makeDecisionTableContent();
    makeDecisionTable(path, path, placeRequest, content);
    doReturn("perspectiveId").when(currentPerspective).getIdentifier();
    doReturn(false).when(docks).isSetup();
    final GuidedDecisionTableView.Presenter activeDtable = mock(GuidedDecisionTableView.Presenter.class);
    when(modeller.getActiveDecisionTable()).thenReturn(Optional.of(activeDtable));
    presenter.onStartup(path, placeRequest);
    presenter.onShowDiagramEditorDocks(new PlaceGainFocusEvent(placeRequest));
    verify(docks).setup(eq("perspectiveId"), placeRequestArgumentCaptor.capture());
    assertEquals("org.kie.guvnor.explorer", placeRequestArgumentCaptor.getValue().getIdentifier());
}
Also used : PlaceRequest(org.uberfire.mvp.PlaceRequest) PlaceGainFocusEvent(org.uberfire.client.workbench.events.PlaceGainFocusEvent) GuidedDecisionTableEditorContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)18 PlaceGainFocusEvent (org.uberfire.client.workbench.events.PlaceGainFocusEvent)18 DefaultPlaceRequest (org.uberfire.mvp.impl.DefaultPlaceRequest)8 ObservablePath (org.uberfire.backend.vfs.ObservablePath)7 PlaceRequest (org.uberfire.mvp.PlaceRequest)5 GuidedDecisionTableEditorContent (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent)3 ClientResourceType (org.uberfire.client.workbench.type.ClientResourceType)3 OnDiagramFocusEvent (org.kie.workbench.common.stunner.project.client.editor.event.OnDiagramFocusEvent)2 PerspectiveActivity (org.uberfire.client.mvp.PerspectiveActivity)2 PathPlaceRequest (org.uberfire.mvp.impl.PathPlaceRequest)2 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)1 PlaceHiddenEvent (org.uberfire.client.workbench.events.PlaceHiddenEvent)1