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;
}
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();
}
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;
}
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);
}
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);
}
}
Aggregations