Search in sources :

Example 1 with PreferenceScopeResolutionStrategyInfo

use of org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo in project kie-wb-common by kiegroup.

the class LibraryPlaces method goToPreferences.

public void goToPreferences() {
    final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy = projectScopedResolutionStrategySupplier.get();
    final PreferencesCentralInitializationEvent initEvent = new PreferencesCentralInitializationEvent("ProjectPreferences", customScopeResolutionStrategy, null);
    final DefaultPlaceRequest placeRequest = new DefaultPlaceRequest(PreferencesRootScreen.IDENTIFIER);
    final PartDefinitionImpl part = new PartDefinitionImpl(placeRequest);
    part.setSelectable(false);
    placeManager.goTo(part, libraryPerspective.getRootPanel());
    preferencesCentralInitializationEvent.fire(initEvent);
    setupLibraryBreadCrumbsForPreferences();
}
Also used : PartDefinitionImpl(org.uberfire.workbench.model.impl.PartDefinitionImpl) PreferenceScopeResolutionStrategyInfo(org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo) PreferencesCentralInitializationEvent(org.uberfire.ext.preferences.client.event.PreferencesCentralInitializationEvent) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest)

Example 2 with PreferenceScopeResolutionStrategyInfo

use of org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo in project kie-wb-common by kiegroup.

the class LibraryPlacesTest method goToPreferencesTest.

@Test
public void goToPreferencesTest() {
    final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo = mock(PreferenceScopeResolutionStrategyInfo.class);
    doReturn(scopeResolutionStrategyInfo).when(projectScopedResolutionStrategySupplier).get();
    final DefaultPlaceRequest placeRequest = new DefaultPlaceRequest(PreferencesRootScreen.IDENTIFIER);
    final PartDefinitionImpl part = new PartDefinitionImpl(placeRequest);
    part.setSelectable(false);
    libraryPlaces.goToPreferences();
    verify(placeManager).goTo(eq(part), any(PanelDefinition.class));
    verify(preferencesCentralInitializationEvent).fire(new PreferencesCentralInitializationEvent("ProjectPreferences", scopeResolutionStrategyInfo, null));
    verify(libraryPlaces).setupLibraryBreadCrumbsForPreferences();
}
Also used : PartDefinitionImpl(org.uberfire.workbench.model.impl.PartDefinitionImpl) PanelDefinition(org.uberfire.workbench.model.PanelDefinition) PreferenceScopeResolutionStrategyInfo(org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo) PreferencesCentralInitializationEvent(org.uberfire.ext.preferences.client.event.PreferencesCentralInitializationEvent) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) Test(org.junit.Test)

Example 3 with PreferenceScopeResolutionStrategyInfo

use of org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo in project kie-wb-common by kiegroup.

the class WorkbenchPreferenceScopeResolutionStrategiesImplTest method getInfoTest.

@Test
public void getInfoTest() {
    final PreferenceScopeResolutionStrategyInfo scopeInfo = scopeResolutionStrategies.getUserInfoFor(null, null);
    final List<PreferenceScope> order = scopeInfo.order();
    assertEquals(2, order.size());
    final PreferenceScope firstScope = order.get(0);
    assertEquals("user", firstScope.type());
    assertEquals("admin", firstScope.key());
    final PreferenceScope secondScope = order.get(1);
    assertEquals("global", secondScope.type());
    assertEquals("global", secondScope.key());
    final PreferenceScope defaultScope = scopeInfo.defaultScope();
    assertEquals("user", defaultScope.type());
    assertEquals("admin", defaultScope.key());
}
Also used : PreferenceScopeResolutionStrategyInfo(org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo) PreferenceScope(org.uberfire.preferences.shared.PreferenceScope) Test(org.junit.Test)

Example 4 with PreferenceScopeResolutionStrategyInfo

use of org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo in project kie-wb-common by kiegroup.

the class WorkbenchPreferenceScopeResolutionStrategiesImplTest method getInfoWithScopeTest.

@Test
public void getInfoWithScopeTest() {
    final PreferenceScopeResolutionStrategyInfo scopeInfo = scopeResolutionStrategies.getUserInfoFor(WorkbenchPreferenceScopes.PROJECT, "my-project");
    final List<PreferenceScope> order = scopeInfo.order();
    assertEquals(3, order.size());
    final PreferenceScope firstScope = order.get(0);
    assertEquals("user", firstScope.type());
    assertEquals("admin", firstScope.key());
    assertEquals("project", firstScope.childScope().type());
    assertEquals("my-project", firstScope.childScope().key());
    final PreferenceScope secondScope = order.get(1);
    assertEquals("user", secondScope.type());
    assertEquals("admin", secondScope.key());
    final PreferenceScope threeScope = order.get(2);
    assertEquals("global", threeScope.type());
    assertEquals("global", threeScope.key());
    final PreferenceScope defaultScope = scopeInfo.defaultScope();
    assertEquals("user", defaultScope.type());
    assertEquals("admin", defaultScope.key());
    assertEquals("project", defaultScope.childScope().type());
    assertEquals("my-project", defaultScope.childScope().key());
}
Also used : PreferenceScopeResolutionStrategyInfo(org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo) PreferenceScope(org.uberfire.preferences.shared.PreferenceScope) Test(org.junit.Test)

Aggregations

PreferenceScopeResolutionStrategyInfo (org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo)4 Test (org.junit.Test)3 PreferencesCentralInitializationEvent (org.uberfire.ext.preferences.client.event.PreferencesCentralInitializationEvent)2 DefaultPlaceRequest (org.uberfire.mvp.impl.DefaultPlaceRequest)2 PreferenceScope (org.uberfire.preferences.shared.PreferenceScope)2 PartDefinitionImpl (org.uberfire.workbench.model.impl.PartDefinitionImpl)2 PanelDefinition (org.uberfire.workbench.model.PanelDefinition)1