use of org.apereo.portal.layout.om.IStylesheetParameterDescriptor 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.IStylesheetParameterDescriptor 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.IStylesheetParameterDescriptor 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.IStylesheetParameterDescriptor in project uPortal by Jasig.
the class WindowStateSettingsStAXComponent method getEventReader.
/* (non-Javadoc)
* @see org.apereo.portal.rendering.PipelineComponent#getEventReader(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public PipelineEventReader<XMLEventReader, XMLEvent> getEventReader(HttpServletRequest request, HttpServletResponse response) {
final PipelineEventReader<XMLEventReader, XMLEvent> pipelineEventReader = this.wrappedComponent.getEventReader(request, response);
final XMLEventReader eventReader = pipelineEventReader.getEventReader();
final IStylesheetDescriptor stylesheetDescriptor = stylesheetAttributeSource.getStylesheetDescriptor(request);
final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
final XMLEventReader filteredEventReader;
if (portalRequestInfo.getTargetedPortletWindowId() == null) {
final IStylesheetParameterDescriptor defaultWindowStateParam = stylesheetDescriptor.getStylesheetParameterDescriptor("dashboardForcedWindowState");
if (defaultWindowStateParam != null) {
//Set all window states to the specified default
final WindowState windowState = PortletUtils.getWindowState(defaultWindowStateParam.getDefaultValue());
filteredEventReader = new SinglePortletWindowStateSettingXMLEventReader(request, eventReader, windowState);
} else {
//Make sure there aren't any portlets in a "targeted" window state
filteredEventReader = new NonTargetedPortletWindowStateSettingXMLEventReader(request, eventReader);
}
} else {
//Not mobile, don't bother filtering
filteredEventReader = eventReader;
}
final Map<String, String> outputProperties = pipelineEventReader.getOutputProperties();
return new PipelineEventReaderImpl<XMLEventReader, XMLEvent>(filteredEventReader, outputProperties);
}
use of org.apereo.portal.layout.om.IStylesheetParameterDescriptor in project uPortal by Jasig.
the class StylesheetDescriptorImporterExporter method importData.
/* (non-Javadoc)
* @see org.apereo.portal.io.xml.IDataImporterExporter#importData(java.lang.Object)
*/
@Transactional
@Override
public void importData(ExternalStylesheetDescriptor data) {
final String stylesheetName = data.getName();
final String uri = data.getUri();
IStylesheetDescriptor stylesheetDescriptor = this.stylesheetDescriptorDao.getStylesheetDescriptorByName(stylesheetName);
if (stylesheetDescriptor == null) {
stylesheetDescriptor = this.stylesheetDescriptorDao.createStylesheetDescriptor(stylesheetName, uri);
} else {
stylesheetDescriptor.setStylesheetResource(uri);
}
stylesheetDescriptor.setUrlNodeSyntaxHelperName(data.getUrlSyntaxHelper());
stylesheetDescriptor.setDescription(data.getDescription());
final List<ExternalOutputPropertyDescriptor> extOutputProperties = data.getOutputProperties();
final List<IOutputPropertyDescriptor> outputPropertyDescriptors = new ArrayList<IOutputPropertyDescriptor>(extOutputProperties.size());
for (final ExternalOutputPropertyDescriptor extOutputProperty : extOutputProperties) {
final String name = extOutputProperty.getName();
final Scope scope = Scope.valueOf(extOutputProperty.getScope().name());
final OutputPropertyDescriptorImpl outputPropertyDescriptor = new OutputPropertyDescriptorImpl(name, scope);
outputPropertyDescriptor.setDefaultValue(extOutputProperty.getDefaultValue());
outputPropertyDescriptor.setDescription(extOutputProperty.getDescription());
outputPropertyDescriptors.add(outputPropertyDescriptor);
}
stylesheetDescriptor.setOutputPropertyDescriptors(outputPropertyDescriptors);
final List<ExternalStylesheetParameterDescriptor> extStylesheetParameters = data.getStylesheetParameters();
final List<IStylesheetParameterDescriptor> stylesheetParameterDescriptors = new ArrayList<IStylesheetParameterDescriptor>(extOutputProperties.size());
for (final ExternalStylesheetParameterDescriptor extStylesheetParameter : extStylesheetParameters) {
final String name = extStylesheetParameter.getName();
final Scope scope = Scope.valueOf(extStylesheetParameter.getScope().name());
final StylesheetParameterDescriptorImpl stylesheetParameterDescriptor = new StylesheetParameterDescriptorImpl(name, scope);
stylesheetParameterDescriptor.setDefaultValue(extStylesheetParameter.getDefaultValue());
stylesheetParameterDescriptor.setDescription(extStylesheetParameter.getDescription());
stylesheetParameterDescriptors.add(stylesheetParameterDescriptor);
}
stylesheetDescriptor.setStylesheetParameterDescriptors(stylesheetParameterDescriptors);
final List<ExternalLayoutAttributeDescriptor> extLayoutAttributes = data.getLayoutAttributes();
final List<ILayoutAttributeDescriptor> layoutAttributeDescriptors = new ArrayList<ILayoutAttributeDescriptor>(extOutputProperties.size());
for (final ExternalLayoutAttributeDescriptor extLayoutAttribute : extLayoutAttributes) {
final String name = extLayoutAttribute.getName();
final Scope scope = Scope.valueOf(extLayoutAttribute.getScope().name());
final LayoutAttributeDescriptorImpl layoutAttributeDescriptor = new LayoutAttributeDescriptorImpl(name, scope);
layoutAttributeDescriptor.setDefaultValue(extLayoutAttribute.getDefaultValue());
layoutAttributeDescriptor.setDescription(extLayoutAttribute.getDescription());
layoutAttributeDescriptor.setTargetElementNames(new LinkedHashSet<String>(extLayoutAttribute.getTargetElements()));
layoutAttributeDescriptors.add(layoutAttributeDescriptor);
}
stylesheetDescriptor.setLayoutAttributeDescriptors(layoutAttributeDescriptors);
this.stylesheetDescriptorDao.updateStylesheetDescriptor(stylesheetDescriptor);
}
Aggregations