Package org.jboss.seam.contexts

Examples of org.jboss.seam.contexts.Context


    private void testEquivalence(ContextCreator creator) {
       //Creates a new context for each action to better simulate these operations
       //happening in different call contexts.
        { //Test Adding
            Context ctx = creator.createContext();
            ctx.set("foo", "bar");
            ctx.flush();
        }
        { //Is Added?
            Context ctx = creator.createContext();
            assert ctx.get("foo").equals("bar");
        }
        { // Test Removing
            Context ctx = creator.createContext();
            ctx.remove("foo");
            ctx.flush();
        }
        { // Is Removed?
            Context ctx = creator.createContext();
            assert !ctx.isSet("foo");
        }
    }
View Full Code Here


   protected void setUp()
   {
      MockServletContext servletContext = new MockServletContext();
      ServletLifecycle.beginApplication(servletContext);
      MockExternalContext externalContext = new MockExternalContext(servletContext);
      Context appContext = new ApplicationContext(externalContext.getApplicationMap());
      installComponent(appContext, Manager.class);
      for (Class c : getComponentsToInstall())
      {
         installComponent(appContext, c);
      }
      appContext.set(Seam.getComponentName(Init.class), new Init());
      Lifecycle.beginCall();
   }
View Full Code Here

   *
   */
  public static void updateMasterDetailPath(String thisBeanName, String label, Object id)
  {
    // Context session = Contexts.getSessionContext();
    Context conversation = Contexts.getConversationContext();

    if (!conversation.isSet("path"))
    {
      // Non esiste ancora

      Stack<PathItem> path = new Stack<PathItem>();

      path.push(new PathItem(thisBeanName, label, id));

      conversation.set("path", path);
    }
    else
    {
      // Esiste

      Stack<PathItem> path = (Stack<PathItem>) conversation.get("path");

      if (path.contains(new PathItem(thisBeanName, label, null)))
      {
        PathItem item = path.peek();

        while (!path.peek().getBeanName().equals(thisBeanName))
        {
          path.pop();
        }

        path.pop();
        path.push(new PathItem(thisBeanName, label, id));
      }
      else
      {
        path.push(new PathItem(thisBeanName, label, id));
      }

      conversation.set("path", path);
    }
  }
View Full Code Here

  /**
   * Elimina l'ultimo item del path se corrispnde al bean indicato
   */
  public static void removeLastPathItem(String thisBeanName)
  {
    Context conversation = Contexts.getConversationContext();
    Stack<PathItem> path = (Stack<PathItem>) conversation.get("path");

    if (path == null)
      return;

    PathItem lastItem = path.peek();

    if (lastItem.getBeanName().equals(thisBeanName))
    {
      path.pop();
      conversation.set("path", path);
    }
  }
View Full Code Here

   * Restituisce il riferimento al master
   */
  public static PathItem getReferenceToMaster()
  {
    // Context session = Contexts.getSessionContext();
    Context conversation = Contexts.getConversationContext();
    Stack<PathItem> path = (Stack<PathItem>) conversation.get("path");
    PathItem ret;

    if ((path != null) && (path.size() >= 1))
    {
      /** Se la lunghezza del path è maggiore di 2 significa che il path è composto almeno da master -> detail **/
 
View Full Code Here

  
   */
  public static PathItem getPathReference(int pos)
  {
    // Context session = Contexts.getSessionContext();
    Context conversation = Contexts.getConversationContext();
    Stack<PathItem> path = (Stack<PathItem>) conversation.get("path");
    PathItem ret;

    if ((path != null) && (path.size() >= 1))
    {
      /** Se la lunghezza del path è maggiore di 2 significa che il path è composto almeno da master -> detail **/
 
View Full Code Here

   * Resetta il path
   */
  public static void resetPath()
  {
    //Context session = Contexts.getSessionContext();
    Context session = Contexts.getConversationContext();

    session.remove("path");
  }
View Full Code Here

  {
    String ret = "";

    // Context session = Contexts.getSessionContext();

    Context session = Contexts.getConversationContext();

    Stack<PathItem> path = (Stack<PathItem>) session.get("path");

    for (int i = 0; i < path.size(); i++)
    {
      //if (i>=1 && i<path.size()-1)
      if (i >= 1 && i <= path.size())
View Full Code Here

   }

   private void installComponents(Init init)
   {
      log.info("Installing components...");
      Context context = Contexts.getApplicationContext();

      DependencyManager manager = new DependencyManager(componentDescriptors);

      Set<ComponentDescriptor> installable = manager.installedSet();     
      for (ComponentDescriptor componentDescriptor: installable)
      {
          String compName = componentDescriptor.getName() + COMPONENT_SUFFIX;

          if ( !context.isSet(compName) )
          {
              addComponent(componentDescriptor, context);

              if ( componentDescriptor.isAutoCreate() )
              {
View Full Code Here

   protected void beforeRenderResponse(FacesContext facesContext)
   { 
     
      if ( Contexts.isPageContextActive() )
      {
         Context pageContext = Contexts.getPageContext();
         //after every time that the view may have changed,
         //we need to flush the page context, since the
         //attribute map is being discarder
         pageContext.flush();
         //force refresh of the conversation lists (they are kept in PAGE context)
         pageContext.remove(Seam.getComponentName(Switcher.class));
         pageContext.remove("org.jboss.seam.core.conversationList");
         pageContext.remove("org.jboss.seam.core.conversationStack");
      }
     
      preRenderPage(facesContext);
     
      if ( facesContext.getResponseComplete() )
View Full Code Here

TOP

Related Classes of org.jboss.seam.contexts.Context

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.