Package org.gatein.pc.controller.state

Examples of org.gatein.pc.controller.state.WindowNavigationalState


      {
         navigationalState = StateString.create(navigationalStateString);
      }

      //
      WindowNavigationalState windowNavigationalState = new WindowNavigationalState(navigationalState, mode, windowState);

      //
      String phase = queryParameters.get(ControllerRequestParameterNames.LIFECYCLE_PHASE);
      if (ControllerRequestParameterNames.RESOURCE_PHASE.equals(phase))
      {
View Full Code Here


      //
      data.writeInt(pageNavigationalState.getWindowIds().size());
      for (String windowId : pageNavigationalState.getWindowIds())
      {
         data.writeUTF(windowId);
         WindowNavigationalState windowNS = pageNavigationalState.getWindowNavigationalState(windowId);
         byte header = 0;
         int decision = 0;
         if (windowNS.getPortletNavigationalState() != null)
         {
            header |= 1;
            decision |= 1;
         }
         if (windowNS.getWindowState() != null)
         {
            Integer value = windowStateToCode.get(windowNS.getWindowState());
            if (value != null)
            {
               header |= value << 1;
            }
            else
            {
               header |= 4 << 1;
               decision |= 2;
            }
         }
         if (windowNS.getMode() != null)
         {
            Integer value = modeToCode.get(windowNS.getMode());
            if (value != null)
            {
               header |= value << 4;
            }
            else
            {
               header |= 4 << 4;
               decision |= 4;
            }
         }
         data.writeByte(header);
         if ((decision & 1) != 0)
         {
            windowNS.getPortletNavigationalState().writeTo(data);
         }
         if ((decision & 2) != 0)
         {
            data.writeUTF(windowNS.getWindowState().toString());
         }
         if ((decision & 4) != 0)
         {
            data.writeUTF(windowNS.getMode().toString());
         }
      }

      //
      Set<QName> publicNames = pageNavigationalState.getPublicNames();
View Full Code Here

               mode = Mode.create(data.readUTF());
               break;
            default:
               mode = codeToMode.get(modeStateHeader);
         }
         WindowNavigationalState windowNS = new WindowNavigationalState(portletNS, mode, windowState);
         pageNS.setWindowNavigationalState(windowId, windowNS);
      }

      //
      size = data.readInt();
View Full Code Here

      ControllerContext controllerContext,
      List<Cookie> cookies,
      PageNavigationalState pageNavigationalState,
      String windowId) throws PortletInvokerException
   {
      WindowNavigationalState windowNS = null;
      if (pageNavigationalState != null)
      {
         windowNS = pageNavigationalState.getWindowNavigationalState(windowId);
      }

      //
      Map<String, String[]> publicNS = null;
      if (pageNavigationalState != null)
      {
         publicNS = controllerContext.getStateControllerContext().getPublicWindowNavigationalState(controllerContext, pageNavigationalState, windowId);
      }

      //
      org.gatein.pc.api.Mode mode = Mode.VIEW;
      org.gatein.pc.api.WindowState windowState = org.gatein.pc.api.WindowState.NORMAL;
      StateString portletNS = null;

      //
      if (windowNS != null)
      {
         if (windowNS.getMode() != null)
         {
            mode = windowNS.getMode();
         }
         if (windowNS.getWindowState() != null)
         {
            windowState = windowNS.getWindowState();
         }
         if (windowNS.getPortletNavigationalState() != null)
         {
            portletNS = windowNS.getPortletNavigationalState();
         }
      }

      //
      PortletInvocationContext renderContext = controllerContext.createPortletInvocationContext(windowId, pageNavigationalState);
View Full Code Here

      ControllerContext context,
      WindowEvent event,
      PageNavigationalState pageNavigationalState,
      List<Cookie> requestCookies) throws PortletInvokerException
   {
      WindowNavigationalState windowNS = pageNavigationalState.getWindowNavigationalState(event.getWindowId());

      //
      if (windowNS == null)
      {
         windowNS = new WindowNavigationalState();
      }

      //
      Map<String, String[]> publicNS = context.getStateControllerContext().getPublicWindowNavigationalState(context, pageNavigationalState, event.getWindowId());

      //
      PortletInvocationContext portletInvocationContext = context.createPortletInvocationContext(event.getWindowId(), pageNavigationalState);
      EventInvocation eventInvocation = new EventInvocation(portletInvocationContext);

      //
      eventInvocation.setMode(windowNS.getMode());
      eventInvocation.setWindowState(windowNS.getWindowState());
      eventInvocation.setNavigationalState(windowNS.getPortletNavigationalState());
      eventInvocation.setPublicNavigationalState(publicNS);
      eventInvocation.setName(event.getName());
      eventInvocation.setPayload(event.getPayload());

      //
View Full Code Here

      String windowId,
      UpdateNavigationalStateResponse update,
      PageNavigationalState page)
      throws PortletInvokerException
   {
      WindowNavigationalState windowNS = page.getWindowNavigationalState(windowId);

      //
      if (windowNS == null)
      {
         windowNS = new WindowNavigationalState();
      }

      //
      Mode mode = windowNS.getMode();
      if (update.getMode() != null)
      {
         mode = update.getMode();
      }
      WindowState windowState = windowNS.getWindowState();
      if (update.getWindowState() != null)
      {
         windowState = update.getWindowState();
      }
      StateString portletNS = windowNS.getPortletNavigationalState();
      if (update.getNavigationalState() != null)
      {
         portletNS = update.getNavigationalState();
      }
      windowNS = new WindowNavigationalState(portletNS, mode, windowState);
      page.setWindowNavigationalState(windowId, windowNS);

      // Now update shared state scoped at page
      Map<String, String[]> publicNS = update.getPublicNavigationalStateUpdates();
      if (publicNS != null)
View Full Code Here

      CacheLevel cacheability;

      if (scope instanceof PortletResourceRequest.PortletScope)
      {
         PortletResourceRequest.PortletScope portletScope = (PortletResourceRequest.PortletScope)scope;
         WindowNavigationalState navigationalState = portletScope.getWindowNavigationalState();

         //
         if (navigationalState != null)
         {
            mode = navigationalState.getMode();
            windowState = navigationalState.getWindowState();
            portletNS = navigationalState.getPortletNavigationalState();
         }

         //
         if (scope instanceof PortletResourceRequest.PageScope)
         {
View Full Code Here

   }

   private void test(StateString portletNavigationalState, org.gatein.pc.api.Mode mode, WindowState windowState)
   {
      PageNavigationalState pageNS = new PageNavigationalState(true);
      pageNS.setWindowNavigationalState("foo", new WindowNavigationalState(portletNavigationalState, mode, windowState));
      assertMarshallable(pageNS);
   }
View Full Code Here

      byte[] bytes = IOTools.serialize(new PageNavigationalStateSerialization(cc), /*SerializationFilter.COMPRESSOR, */pageNS);
      PageNavigationalState expectedPageNS = IOTools.unserialize(new PageNavigationalStateSerialization(cc), /*SerializationFilter.COMPRESSOR, */bytes);
      assertEquals(expectedPageNS.getWindowIds(), pageNS.getWindowIds());
      for (String windowId : expectedPageNS.getWindowIds())
      {
         WindowNavigationalState windowNS = expectedPageNS.getWindowNavigationalState(windowId);
         WindowNavigationalState expectedWindowNS = pageNS.getWindowNavigationalState(windowId);
         assertEquals(windowNS.getPortletNavigationalState(), expectedWindowNS.getPortletNavigationalState());
         assertEquals(windowNS.getMode(), expectedWindowNS.getMode());
         assertEquals(windowNS.getWindowState(), expectedWindowNS.getWindowState());
      }
   }
View Full Code Here

TOP

Related Classes of org.gatein.pc.controller.state.WindowNavigationalState

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.