Package javax.portlet

Examples of javax.portlet.WindowState


                portalURL.setResourceID(decodeControlParameter(token)[0]);
            }
          // Window state definition: portalURL.setWindowState().
          else if (token.startsWith(PREFIX + WINDOW_STATE)) {
            String[] decoded = decodeControlParameter(token);
            portalURL.setWindowState(decoded[0], new WindowState(decoded[1]));
          }
          // Portlet mode definition: portalURL.setPortletMode().
          else if (token.startsWith(PREFIX + PORTLET_MODE)) {
            String[] decoded = decodeControlParameter(token);
            portalURL.setPortletMode(decoded[0], new PortletMode(decoded[1]));
View Full Code Here


      {
         return WindowState.MAXIMIZED;
      }
      else
      {
         return new WindowState(windowStateName);
      }
   }
View Full Code Here

      {
         return WindowState.MAXIMIZED;
      }
      else
      {
         return new WindowState(windowStateName);
      }
   }
View Full Code Here

        try {
            // The PortletMode and WindowState can change during a portlet invocation, so we need
            // to be able to compare the results before and after invoking the portlet to know if
            // we need to broadcast a change event or not.
            PortletMode currentPortletMode = uicomponent.getCurrentPortletMode();
            WindowState currentWindowState = uicomponent.getCurrentWindowState();

            String action = context.getRequestParameter(PortalRequestContext.UI_COMPONENT_ACTION);
            if (action != null) {
                Event<UIComponent> event = uicomponent.createEvent(action, Event.Phase.PROCESS, context);
                if (event != null)
                    event.broadcast();
                return;
            }

            String portletMode = context.getRequestParameter(org.exoplatform.portal.Constants.PORTAL_PORTLET_MODE);
            if (portletMode != null) {
                Event<UIComponent> event = uicomponent.createEvent("ChangePortletMode", Event.Phase.PROCESS, context);
                if (event != null)
                    event.broadcast();
            }

            String windowState = context.getRequestParameter(org.exoplatform.portal.Constants.PORTAL_WINDOW_STATE);
            if (windowState != null) {
                Event<UIComponent> event = uicomponent.createEvent("ChangeWindowState", Event.Phase.PROCESS, context);
                if (event != null)
                    event.broadcast();
            }

            /*
             * Check the type of the incoming request, can be either an ActionURL or a RenderURL one
             *
             * In case of a RenderURL, the parameter state map must be invalidated and this is done in the associated
             * ActionListener
             *
             * If no action type is specified we assume the default, which is to render
             */
            String portletActionType = context.getRequestParameter(Constants.TYPE_PARAMETER);
            if (portletActionType != null) {
                if (portletActionType.equals(Constants.PORTAL_PROCESS_ACTION)) {
                    Event<UIComponent> event = uicomponent.createEvent("ProcessAction", Event.Phase.PROCESS, context);
                    if (event != null)
                        event.broadcast();
                } else if (portletActionType.equals(Constants.PORTAL_SERVE_RESOURCE)) {
                    Event<UIComponent> event = uicomponent.createEvent("ServeResource", Event.Phase.PROCESS, context);
                    if (event != null)
                        event.broadcast();
                }
            } else {
                Event<UIComponent> event = uicomponent.createEvent("Render", Event.Phase.PROCESS, context);
                if (event != null)
                    event.broadcast();
            }

            // These two checks needs to go after the ProcessAction, ServeResource or Render broadcast events.
            // The mode or state can change during the invocation and we need to be able to broadcast the change
            // event if this occurs.
            if (currentPortletMode != null && !currentPortletMode.equals(uicomponent.getCurrentPortletMode())) {
                context.setAttribute(UIPortletActionListener.CHANGE_PORTLET_MODE_EVENT, uicomponent.getCurrentPortletMode()
                        .toString());
                Event<UIComponent> event = uicomponent.createEvent("ChangePortletMode", Event.Phase.PROCESS, context);
                if (event != null)
                    event.broadcast();
                context.setAttribute(UIPortletActionListener.CHANGE_PORTLET_MODE_EVENT, null);
            }
            if (currentWindowState != null && !currentWindowState.equals(uicomponent.getCurrentWindowState())) {
                context.setAttribute(UIPortletActionListener.CHANGE_WINDOW_STATE_EVENT, uicomponent.getCurrentWindowState()
                        .toString());
                Event<UIComponent> event = uicomponent.createEvent("ChangeWindowState", Event.Phase.PROCESS, context);
                if (event != null)
                    event.broadcast();
View Full Code Here

             * Update the portlet window state according to the action output information
             *
             * If the current node is displaying a usual layout page, also tells the page which portlet to render or not when
             * the state is maximized
             */
            WindowState state = new WindowState(getWindowStateOrDefault(navResponse));
            setNextState(uiPortlet, state);

            // update the portlet with the next mode to display
            PortletMode mode = new PortletMode(getPortletModeOrDefault(navResponse));
            setNextMode(uiPortlet, mode);
View Full Code Here

             * the state is maximized
             */
            // Note: we should only update the WindowState if the UpdateNavigationalStateResponse.getWindowState is not null,
            // otherwise it means the WindowState has not changed and we should use the current value.
            if (navStateResponse.getWindowState() != null) {
                WindowState state = new WindowState(getWindowStateOrDefault(navStateResponse));
                setNextState(uiPortlet, state);
            }

            // update the portlet with the next mode to display
            // Note: we should only update the Mode if the UpdateNavigationalStateResponse.getMode is not null,
View Full Code Here

  {
    String modeDefaultViewId = getDefaultViewId(request, request.getPortletMode());
   
    if (modeDefaultViewId != null)
    {
      WindowState state = request.getWindowState();
      if (!state.equals(WindowState.MINIMIZED))
      {
        doBridgeDispatch(request, response, modeDefaultViewId);
      }
      return true;
    }
View Full Code Here

        }
        else if (param.equals(Bridge.PORTLET_WINDOWSTATE_PARAMETER))
        {
          try
          {
            actionURL.setWindowState(new WindowState(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            ; // do nothing -- just ignore
          }
        }
        else if (param.equals(Bridge.PORTLET_SECURE_PARAMETER))
        {
          try
          {
            actionURL.setSecure(Boolean.getBoolean(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            ; // do nothing -- just ignore
          }
        }
        else
        {
          actionURL.setParameter(param, queryStr.getParameter(param));
        }
      }

      // TODO hack to workaround double encoding problem
      url = actionURL.toString();
      url = url.replaceAll("\\&amp\\;", "&");
    }
    else
    { // action - write the viewId to navigational state
      ActionResponse actionResponse = (ActionResponse) getResponse();

      // set request params into navigational states
      Enumeration<String> list = queryStr.getParameterNames();
      while (list.hasMoreElements())
      {
        String param = list.nextElement();
        if (param.equals(Bridge.PORTLET_MODE_PARAMETER))
        {
          try
          {
            actionResponse.setPortletMode(new PortletMode(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            //TODO: Ignoring is probably dangerous here as it means that we are
            //      EITHER using exceptions for flow control (which is extreemly
            //      inefficient) or we should log a message saying what the issue
            //      is.  According to the Javadocs an exception is thrown here if the
            //      portlet mode is not allowed or if sendRedirect has already been
            //      called.  In either case we should log an information type message
            //      here.
            ; // do nothing -- just ignore
          }
        }
        else if (param.equals(Bridge.PORTLET_WINDOWSTATE_PARAMETER))
        {
          try
          {
            actionResponse.setWindowState(new WindowState(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            ; // do nothing -- just ignore
          }
View Full Code Here

     * @return The WindowState that mathces the <tt>windowState</tt> String, or if
     * the Sring is blank, the current WindowState.
     */
    private static WindowState getWindowState(RenderRequest portletReq,
            String windowState) {
        WindowState state = portletReq.getWindowState();
        if (TextUtils.stringSet(windowState)) {
            state = portletReq.getWindowState();
            if ("maximized".equalsIgnoreCase(windowState)) {
                state = WindowState.MAXIMIZED;
            } else if ("normal".equalsIgnoreCase(windowState)) {
View Full Code Here

        requiredWindowStates.add(WindowState.MAXIMIZED);
        requiredWindowStates.add(WindowState.NORMAL);
       
        for (Enumeration en = request.getPortalContext().getSupportedWindowStates();
            en.hasMoreElements(); ) {
            WindowState windowState = (WindowState) en.nextElement();
            requiredWindowStates.remove(windowState);
        }
       
        if (requiredWindowStates.isEmpty()) {
          result.setReturnCode(TestResult.PASSED);
View Full Code Here

TOP

Related Classes of javax.portlet.WindowState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.