Package org.jboss.seam.ui

Source Code of org.jboss.seam.ui.UIConversationId

package org.jboss.seam.ui;
import javax.faces.component.UIParameter;

import org.jboss.seam.core.Conversation;
import org.jboss.seam.core.Manager;
import org.jboss.seam.core.Pages;
import org.jboss.seam.pages.Page;
public class UIConversationId extends UIParameter
{
   private String viewId;
   public static final String COMPONENT_TYPE = "org.jboss.seam.ui.UIConversationId";
  
   @Override
   public String getName()
   {
      Conversation conversation = Conversation.instance();
      if (viewId!=null && ( !conversation.isNested() || conversation.isLongRunning() ) )
      {
         return Pages.instance().getPage(viewId)
                     .getConversationIdParameter()
                     .getParameterName();
      }
      else
      {
         return Manager.instance().getConversationIdParameter();
      }
   }
  
   @Override
   public Object getValue()
   {
      Conversation conversation = Conversation.instance();
      if ( !conversation.isNested() || conversation.isLongRunning() )
      {
         if (viewId!=null)
         {
            Page page = Pages.instance().getPage(viewId);
            return page.getConversationIdParameter().getParameterValue();
         }
         else
         {
            return conversation.getId();
         }
      }
      else
      {
         return conversation.getParentId();
      }
   }

   public String getViewId()
   {
      return viewId;
   }

   public void setViewId(String viewId)
   {
      this.viewId = viewId;
   }
}
TOP

Related Classes of org.jboss.seam.ui.UIConversationId

TOP
Copyright © 2018 www.massapi.com. 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.