@Override public void execute(PerspectiveDefinition perspectiveDef) { perspectiveChangeEvent.fire(new PerspectiveChange(placeRequest, perspectiveDef, currentPerspective.getMenus(), currentPerspective.getIdentifier())); doWhenFinished.execute(perspectiveDef); } }
@PostConstruct public void init() { view.removeAllOptions(); String currentPerspectiveId = perspectiveManager.getCurrentPerspective().getIdentifier(); availablePerspectives.keySet().forEach(perspectiveId -> addPerspective(perspectiveId, availablePerspectives.get(perspectiveId), perspectiveId.equals(currentPerspectiveId))); view.setOptionChangeCommand(() -> goToPerspective(view.getSelectedOption())); view.refresh(); }
@Override public void savePerspectiveState(Command doWhenFinished) { if (currentPerspective != null && !currentPerspective.isTransient()) { wbServices.save(currentPerspective.getIdentifier(), livePerspectiveDef, doWhenFinished); } else { doWhenFinished.execute(); } }
private void goToHomePerspective() { final PerspectiveActivity homePerspectiveActivity = workbench.getHomePerspectiveActivity(); if (homePerspectiveActivity != null) { final String homePerspectiveIdentifier = homePerspectiveActivity.getIdentifier(); if (hasAccessToPerspective(homePerspectiveIdentifier)) { placeManager.goTo(homePerspectiveIdentifier); } } }
public List<MenuItem> getPerspectivesMenuItems() { final List<MenuItem> perspectives = new ArrayList<>(); for (final PerspectiveActivity perspective : getPerspectiveActivities()) { final String name = perspective.getDefaultPerspectiveLayout().getName(); final MenuItem item = newSimpleItem(name).perspective(perspective.getIdentifier()).endMenu().build().getItems().get(0); perspectives.add(item); } return perspectives; }
@Override public void execute() { if ( currentPerspective != null ) { final PlaceRequest pr = new ForcedPlaceRequest( currentPerspective.getIdentifier(), currentPerspective.getPlace().getParameters() ); placeManager.goTo( pr ); } } } );
@Before public void setupMocks() { super.setupMocks(); when(perspectiveActivity.getIdentifier()).thenReturn(PERSPECTIVE_ID); commonConstants = org.jbpm.workbench.common.client.resources.i18n.Constants.INSTANCE; }
@Before public void setupMocks() { super.setupMocks(); when(perspectiveActivity.getIdentifier()).thenReturn(PERSPECTIVE_ID); commonConstants = org.jbpm.workbench.common.client.resources.i18n.Constants.INSTANCE; }
@Before public void setup() { when(perspectiveActivityMock.getIdentifier()).thenReturn(selected_Perspective); when(perspectiveManagerMock.getCurrentPerspective()).thenReturn(perspectiveActivityMock); when(view.getSelectedOption()).thenReturn(selected_Perspective); when(activityManagerMock.getActivities(any(DefaultPlaceRequest.class))).thenReturn(Sets.create(mock(Activity.class))); }
@Before public void setup() { when(perspectiveActivityMock.getIdentifier()).thenReturn(selected_Perspective); when(perspectiveManagerMock.getCurrentPerspective()).thenReturn(perspectiveActivityMock); when(view.getSelectedOption()).thenReturn(selected_Perspective); when(activityManagerMock.getActivities(any(DefaultPlaceRequest.class))).thenReturn(Sets.create(mock(Activity.class))); }
@Test public void setupHomeLinkWithNoPermissionToAccessDefaultPerspective() { final PerspectiveActivity homePerspective = mock(PerspectiveActivity.class); doReturn("identifier").when(homePerspective).getIdentifier(); doReturn(homePerspective).when(workbench).getHomePerspectiveActivity(); doReturn(false).when(presenter).hasAccessToPerspective(any()); presenter.setupHomeLink(); ArgumentCaptor<Command> commandCaptor = ArgumentCaptor.forClass(Command.class); verify(view).setHomeLinkAction(commandCaptor.capture()); verify(view).setBrandImageAction(commandCaptor.capture()); commandCaptor.getValue().execute(); verify(placeManager, never()).goTo(anyString()); }
@Test public void setupHomeLinkWithPermissionToAccessDefaultPerspective() { final PerspectiveActivity homePerspective = mock(PerspectiveActivity.class); doReturn("identifier").when(homePerspective).getIdentifier(); doReturn(homePerspective).when(workbench).getHomePerspectiveActivity(); doReturn(true).when(presenter).hasAccessToPerspective(any()); presenter.setupHomeLink(); ArgumentCaptor<Command> commandCaptor = ArgumentCaptor.forClass(Command.class); verify(view).setHomeLinkAction(commandCaptor.capture()); verify(view).setBrandImageAction(commandCaptor.capture()); commandCaptor.getValue().execute(); verify(placeManager).goTo("identifier"); }
@Test public void setupHomeLinkWithPermissionToAccessDefaultPerspective() { final PerspectiveActivity homePerspective = mock(PerspectiveActivity.class); doReturn("identifier").when(homePerspective).getIdentifier(); doReturn(homePerspective).when(workbench).getHomePerspectiveActivity(); doReturn(true).when(presenter).hasAccessToPerspective(any()); presenter.setupHomeLink(); ArgumentCaptor<Command> commandCaptor = ArgumentCaptor.forClass(Command.class); verify(view).setHomeLinkAction(commandCaptor.capture()); verify(view).setBrandImageAction(commandCaptor.capture()); commandCaptor.getValue().execute(); verify(placeManager).goTo("identifier"); }
@Before public void setup() { when(perspectiveActivityMock.getIdentifier()).thenReturn(PERSPECTIVE_ID); when(perspectiveManagerMock.getCurrentPerspective()).thenReturn(perspectiveActivityMock); when(serverTemplateSelectorMenuBuilderMock.getView()).thenReturn(serverTemplateSelectorElementViewMock); when(presenter.getListView()).thenReturn(listView); presenter.setPerspectiveManager(perspectiveManagerMock); presenter.setUberfireBreadcrumbs(breadcrumbsMock); }
@Before public void setup() { when(perspectiveActivityMock.getIdentifier()).thenReturn(PERSPECTIVE_ID); when(perspectiveManagerMock.getCurrentPerspective()).thenReturn(perspectiveActivityMock); when(serverTemplateSelectorMenuBuilderMock.getView()).thenReturn(serverTemplateSelectorElementViewMock); when(presenter.getListView()).thenReturn(listView); presenter.setPerspectiveManager(perspectiveManagerMock); presenter.setUberfireBreadcrumbs(breadcrumbsMock); }
@Before public void setup() { processRuntimeDataServiceCaller = new CallerMock<ProcessRuntimeDataService>(processRuntimeDataService); presenter.setProcessRuntimeDataService(processRuntimeDataServiceCaller); when(view.getListGrid()).thenReturn(extendedPagedTable); when(extendedPagedTable.getColumnSortList()).thenReturn(new ColumnSortList()); when(perspectiveManager.getCurrentPerspective()).thenReturn(perspectiveActivity); when(perspectiveActivity.getIdentifier()).thenReturn(PERSPECTIVE_ID); commonConstants = org.jbpm.workbench.common.client.resources.i18n.Constants.INSTANCE; }
@Test public void goToDefaultPerspective() throws Exception { when(perspectiveActivity1.isDefault()).thenReturn(true); when(perspectiveActivity2.isDefault()).thenReturn(false); workbench.startIfNotBlocked(); verify(placeManager).goTo(new DefaultPlaceRequest(perspectiveActivity1.getIdentifier())); }
@Test public void goToDefaultPerspective() throws Exception { when(perspectiveActivity1.isDefault()).thenReturn(true); when(perspectiveActivity2.isDefault()).thenReturn(false); workbench.startIfNotBlocked(); verify(placeManager).goTo(new DefaultPlaceRequest(perspectiveActivity1.getIdentifier())); }
@Test public void goToHomePerspective() throws Exception { when(authorizationPolicy.getHomePerspective(identity)).thenReturn("perspective1"); workbench.startIfNotBlocked(); verify(placeManager).goTo(new DefaultPlaceRequest(perspectiveActivity1.getIdentifier())); }
@Test public void goToHomePerspective() throws Exception { when(authorizationPolicy.getHomePerspective(identity)).thenReturn("perspective1"); workbench.startIfNotBlocked(); verify(placeManager).goTo(new DefaultPlaceRequest(perspectiveActivity1.getIdentifier())); }