use of org.apereo.portal.url.UrlState in project uPortal by Jasig.
the class PortletRequestParameterProcessor method processParameters.
/* (non-Javadoc)
* @see org.apereo.portal.url.processing.IRequestParameterProcessor#processParameters(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public boolean processParameters(HttpServletRequest request, HttpServletResponse response) {
final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
final IPortletWindowId targetedPortletWindowId = portalRequestInfo.getTargetedPortletWindowId();
for (final IPortletRequestInfo portletRequestInfo : portalRequestInfo.getPortletRequestInfoMap().values()) {
final IPortletWindowId portletWindowId = portletRequestInfo.getPortletWindowId();
final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(request, targetedPortletWindowId);
final UrlType urlType = portalRequestInfo.getUrlType();
switch(urlType) {
case RENDER:
{
final Map<String, List<String>> portletParameters = portletRequestInfo.getPortletParameters();
portletWindow.setRenderParameters(ParameterMap.convertListMap(portletParameters));
//fall through, render uses state/mode info
}
case ACTION:
{
final WindowState windowState = portletRequestInfo.getWindowState();
if (windowState != null) {
portletWindow.setWindowState(windowState);
}
final PortletMode portletMode = portletRequestInfo.getPortletMode();
if (portletMode != null) {
portletWindow.setPortletMode(portletMode);
}
break;
}
}
//Override the window state of the targeted portlet window based on the url state
if (portletWindowId.equals(targetedPortletWindowId)) {
final UrlState urlState = portalRequestInfo.getUrlState();
switch(urlState) {
case MAX:
{
portletWindow.setWindowState(WindowState.MAXIMIZED);
break;
}
case DETACHED:
{
portletWindow.setWindowState(IPortletRenderer.DETACHED);
break;
}
case EXCLUSIVE:
{
portletWindow.setWindowState(IPortletRenderer.EXCLUSIVE);
break;
}
}
}
this.portletWindowRegistry.storePortletWindow(request, portletWindow);
}
return true;
}
use of org.apereo.portal.url.UrlState in project uPortal by Jasig.
the class FocusedOnOnePortletPredicate method apply.
@Override
public boolean apply(final HttpServletRequest request) {
final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
if (null == portalRequestInfo) {
logger.warn("Portal request info was not available for this request, " + "so assuming that it does not represent focus on one portlet.");
// focused-on-one-portlet portal state.
return false;
}
final UrlState urlState = portalRequestInfo.getUrlState();
// true when there is a portal request and that request is not for a portal in NORMAL state
// i.e. portal is in some other state, like Maximized or Exclusive or Detached.
// false otherwise.
final boolean doesRequestFocusOnOnePortlet = (!(UrlState.NORMAL.equals(urlState)));
logger.debug("Determined request with UrlState {} {} focus on one portlet.", urlState, doesRequestFocusOnOnePortlet ? "does" : "does not");
return doesRequestFocusOnOnePortlet;
}
use of org.apereo.portal.url.UrlState in project uPortal by Jasig.
the class URLInSpecificState method apply.
@Override
public boolean apply(final HttpServletRequest request) {
final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
if (null == portalRequestInfo) {
logger.warn("Portal request info was not available for this request, " + "so assuming that it does not represent focus on one portlet.");
// focused-on-one-portlet portal state.
return false;
}
final UrlState urlState = portalRequestInfo.getUrlState();
boolean stateEqual = urlState.toString().equals(state);
return isNegated ? !stateEqual : stateEqual;
}
use of org.apereo.portal.url.UrlState in project uPortal by Jasig.
the class UserLayoutParameterProcessor method processParameters.
@Override
public boolean processParameters(HttpServletRequest request, HttpServletResponse response) {
final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager();
final IUserLayoutManager userLayoutManager = preferencesManager.getUserLayoutManager();
final String tabId = portalRequestInfo.getTargetedLayoutNodeId();
if (tabId != null) {
this.stylesheetUserPreferencesService.setStylesheetParameter(request, PreferencesScope.STRUCTURE, "focusedTabID", tabId);
}
// on a portlet, it will get overwritten with the new value below.
if (userLayoutManager instanceof TransientUserLayoutManagerWrapper) {
final TransientUserLayoutManagerWrapper transientUserLayoutManagerWrapper = (TransientUserLayoutManagerWrapper) userLayoutManager;
transientUserLayoutManagerWrapper.setFocusedId(null);
}
final UrlState urlState = portalRequestInfo.getUrlState();
switch(urlState) {
case DETACHED:
this.stylesheetUserPreferencesService.setStylesheetParameter(request, PreferencesScope.STRUCTURE, "detached", Boolean.TRUE.toString());
case MAX:
{
final IPortletRequestInfo portletRequestInfo = portalRequestInfo.getTargetedPortletRequestInfo();
if (portletRequestInfo != null) {
final IPortletWindowId targetWindowId = portletRequestInfo.getPortletWindowId();
final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(request, targetWindowId);
final IPortletEntity portletEntity = portletWindow.getPortletEntity();
final String channelSubscribeId = portletEntity.getLayoutNodeId();
this.stylesheetUserPreferencesService.setStylesheetParameter(request, PreferencesScope.STRUCTURE, "userLayoutRoot", channelSubscribeId);
if (userLayoutManager instanceof TransientUserLayoutManagerWrapper) {
// get wrapper implementation for focusing
final TransientUserLayoutManagerWrapper transientUserLayoutManagerWrapper = (TransientUserLayoutManagerWrapper) userLayoutManager;
// .. and now set it as the focused id
transientUserLayoutManagerWrapper.setFocusedId(channelSubscribeId);
}
//If portletRequestInfo was null just fall through to NORMAL state
break;
}
}
case NORMAL:
default:
{
this.stylesheetUserPreferencesService.setStylesheetParameter(request, PreferencesScope.STRUCTURE, "userLayoutRoot", IUserLayout.ROOT_NODE_NAME);
break;
}
}
return true;
}
Aggregations