Search in sources :

Example 1 with IStylesheetDescriptor

use of org.apereo.portal.layout.om.IStylesheetDescriptor in project uPortal by Jasig.

the class SingleTabUrlNodeSyntaxHelper method getDefaultTabIndex.

/** Get the index of the default tab for the user */
protected String getDefaultTabIndex(HttpServletRequest httpServletRequest) {
    final String stylesheetParameter = this.stylesheetUserPreferencesService.getStylesheetParameter(httpServletRequest, PreferencesScope.STRUCTURE, this.defaultTabParameter);
    if (stylesheetParameter != null) {
        return stylesheetParameter;
    }
    final IStylesheetDescriptor stylesheetDescriptor = this.stylesheetUserPreferencesService.getStylesheetDescriptor(httpServletRequest, PreferencesScope.STRUCTURE);
    final IStylesheetParameterDescriptor stylesheetParameterDescriptor = stylesheetDescriptor.getStylesheetParameterDescriptor(this.defaultTabParameter);
    if (stylesheetParameterDescriptor != null) {
        return stylesheetParameterDescriptor.getDefaultValue();
    }
    return null;
}
Also used : IStylesheetParameterDescriptor(org.apereo.portal.layout.om.IStylesheetParameterDescriptor) IStylesheetDescriptor(org.apereo.portal.layout.om.IStylesheetDescriptor)

Example 2 with IStylesheetDescriptor

use of org.apereo.portal.layout.om.IStylesheetDescriptor in project uPortal by Jasig.

the class StylesheetDescriptorTransformerConfigurationSource method getCacheKey.

@Override
public final CacheKey getCacheKey(HttpServletRequest request, HttpServletResponse response) {
    final CacheKeyBuilder cacheKeyBuilder = CacheKey.builder(this.getName());
    final PreferencesScope preferencesScope = this.getStylesheetPreferencesScope(request);
    final IStylesheetDescriptor stylesheetDescriptor = this.stylesheetUserPreferencesService.getStylesheetDescriptor(request, preferencesScope);
    //Build key from stylesheet descriptor parameters
    for (final IStylesheetParameterDescriptor stylesheetParameterDescriptor : stylesheetDescriptor.getStylesheetParameterDescriptors()) {
        final String defaultValue = stylesheetParameterDescriptor.getDefaultValue();
        if (defaultValue != null) {
            final String name = stylesheetParameterDescriptor.getName();
            cacheKeyBuilder.put(name, defaultValue);
        }
    }
    return cacheKeyBuilder.build();
}
Also used : IStylesheetParameterDescriptor(org.apereo.portal.layout.om.IStylesheetParameterDescriptor) CacheKeyBuilder(org.apereo.portal.utils.cache.CacheKey.CacheKeyBuilder) IStylesheetDescriptor(org.apereo.portal.layout.om.IStylesheetDescriptor) PreferencesScope(org.apereo.portal.layout.IStylesheetUserPreferencesService.PreferencesScope)

Example 3 with IStylesheetDescriptor

use of org.apereo.portal.layout.om.IStylesheetDescriptor in project uPortal by Jasig.

the class StylesheetDescriptorTransformerConfigurationSource method getParameters.

@Override
public final Map<String, Object> getParameters(HttpServletRequest request, HttpServletResponse response) {
    final PreferencesScope preferencesScope = this.getStylesheetPreferencesScope(request);
    final IStylesheetDescriptor stylesheetDescriptor = this.stylesheetUserPreferencesService.getStylesheetDescriptor(request, preferencesScope);
    //Build map of stylesheet descriptor parameters
    final LinkedHashMap<String, Object> parameters = new LinkedHashMap<String, Object>();
    for (final IStylesheetParameterDescriptor stylesheetParameterDescriptor : stylesheetDescriptor.getStylesheetParameterDescriptors()) {
        final String defaultValue = stylesheetParameterDescriptor.getDefaultValue();
        if (defaultValue != null) {
            final String name = stylesheetParameterDescriptor.getName();
            parameters.put(name, defaultValue);
        }
    }
    return parameters;
}
Also used : IStylesheetParameterDescriptor(org.apereo.portal.layout.om.IStylesheetParameterDescriptor) IStylesheetDescriptor(org.apereo.portal.layout.om.IStylesheetDescriptor) PreferencesScope(org.apereo.portal.layout.IStylesheetUserPreferencesService.PreferencesScope) LinkedHashMap(java.util.LinkedHashMap)

Example 4 with IStylesheetDescriptor

use of org.apereo.portal.layout.om.IStylesheetDescriptor in project uPortal by Jasig.

the class BaseTransformerSource method getStylesheetResource.

private Resource getStylesheetResource(HttpServletRequest request) {
    final IStylesheetDescriptor stylesheetDescriptor = this.getStylesheetDescriptor(request);
    final String stylesheetResource = stylesheetDescriptor.getStylesheetResource();
    return this.resourceLoader.getResource(stylesheetResource);
}
Also used : IStylesheetDescriptor(org.apereo.portal.layout.om.IStylesheetDescriptor)

Example 5 with IStylesheetDescriptor

use of org.apereo.portal.layout.om.IStylesheetDescriptor in project uPortal by Jasig.

the class PortletWindowRegistryImpl method storePortletWindow.

@Override
public void storePortletWindow(HttpServletRequest request, IPortletWindow portletWindow) {
    if (isDisablePersistentWindowStates(request)) {
        return;
    }
    final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
    final IPerson person = userInstance.getPerson();
    if (person.isGuest()) {
        //Never persist things for the guest user, just rely on in-memory storage
        return;
    }
    final IStylesheetDescriptor themeStylesheetDescriptor = this.getThemeStylesheetDescriptor(request);
    final WindowState windowState = portletWindow.getWindowState();
    final IPortletEntity portletEntity = portletWindow.getPortletEntity();
    final WindowState entityWindowState = portletEntity.getWindowState(themeStylesheetDescriptor);
    //If the window and entity states are different
    if (windowState != entityWindowState && !windowState.equals(entityWindowState)) {
        final WindowState defaultWindowState = this.getDefaultWindowState(themeStylesheetDescriptor);
        //If a window state is set and is one of the persistent states set it on the entity
        if (!defaultWindowState.equals(windowState) && persistentWindowStates.contains(windowState)) {
            portletEntity.setWindowState(themeStylesheetDescriptor, windowState);
        } else //If not remove the state from the entity
        if (entityWindowState != null) {
            portletEntity.setWindowState(themeStylesheetDescriptor, null);
        }
        //Persist the modified entity
        this.portletEntityRegistry.storePortletEntity(request, portletEntity);
    }
}
Also used : IUserInstance(org.apereo.portal.user.IUserInstance) WindowState(javax.portlet.WindowState) IPerson(org.apereo.portal.security.IPerson) IPortletEntity(org.apereo.portal.portlet.om.IPortletEntity) IStylesheetDescriptor(org.apereo.portal.layout.om.IStylesheetDescriptor)

Aggregations

IStylesheetDescriptor (org.apereo.portal.layout.om.IStylesheetDescriptor)31 IStylesheetUserPreferences (org.apereo.portal.layout.om.IStylesheetUserPreferences)15 Scope (org.apereo.portal.layout.om.IStylesheetData.Scope)11 IStylesheetParameterDescriptor (org.apereo.portal.layout.om.IStylesheetParameterDescriptor)10 Map (java.util.Map)7 ILayoutAttributeDescriptor (org.apereo.portal.layout.om.ILayoutAttributeDescriptor)7 Transactional (org.springframework.transaction.annotation.Transactional)6 ConcurrentMap (java.util.concurrent.ConcurrentMap)5 ImmutableMap (com.google.common.collect.ImmutableMap)4 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)4 WindowState (javax.portlet.WindowState)4 HttpSession (javax.servlet.http.HttpSession)4 IUserProfile (org.apereo.portal.IUserProfile)4 IOutputPropertyDescriptor (org.apereo.portal.layout.om.IOutputPropertyDescriptor)4 IPerson (org.apereo.portal.security.IPerson)4 IUserInstance (org.apereo.portal.user.IUserInstance)4 MapPopulator (org.apereo.portal.utils.MapPopulator)4 IUserPreferencesManager (org.apereo.portal.IUserPreferencesManager)3 PreferencesScope (org.apereo.portal.layout.IStylesheetUserPreferencesService.PreferencesScope)3 IPortletEntity (org.apereo.portal.portlet.om.IPortletEntity)3