[jboss-cvs] jboss-seam/src/ui/org/jboss/seam/ui ...

Peter Muir peter at bleepbleep.org.uk
Mon Apr 30 14:49:30 EDT 2007


  User: pmuir   
  Date: 07/04/30 14:49:30

  Modified:    src/ui/org/jboss/seam/ui  UILoadStyle.java
  Log:
  Add support for putting styles into naming containers
  
  Revision  Changes    Path
  1.2       +44 -1     jboss-seam/src/ui/org/jboss/seam/ui/UILoadStyle.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: UILoadStyle.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/ui/org/jboss/seam/ui/UILoadStyle.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- UILoadStyle.java	17 Apr 2007 15:14:53 -0000	1.1
  +++ UILoadStyle.java	30 Apr 2007 18:49:30 -0000	1.2
  @@ -3,16 +3,20 @@
   import java.io.UnsupportedEncodingException;
   import java.net.URLEncoder;
   
  +import javax.faces.component.NamingContainer;
  +import javax.faces.component.UIComponent;
   import javax.faces.component.UIParameter;
   
   import org.ajax4jsf.ajax.html.HtmlLoadStyle;
  -import org.jboss.seam.core.Conversation;
   import org.jboss.seam.core.Pages;
   import org.jboss.seam.ui.resource.StyleResource;
   
   public class UILoadStyle extends HtmlLoadStyle
   {
   
  +   // TODO Come up with better name for this
  +   private boolean isolated;
  +
      @Override
      public Object getSrc()
      {
  @@ -23,6 +27,19 @@
         try
         {
            src += getParameterString(getFacesContext().getResponseWriter().getCharacterEncoding(), uiConversationId, true);
  +         if (isIsolated())
  +         {
  +            UIComponent namingContainer = getParentNamingContainer(this);
  +            if (namingContainer != null)
  +            {
  +               UIParameter idPrefix = new UIParameter();
  +               idPrefix.setName("idPrefix");
  +               idPrefix.setValue(namingContainer.getClientId(getFacesContext()));
  +               src += getParameterString(getFacesContext().getResponseWriter().getCharacterEncoding(), idPrefix, false);
  +            }
  +         }
  +         
  +         
         }
         catch (UnsupportedEncodingException e)
         {
  @@ -43,4 +60,30 @@
         return (first ? '?' : '&') + param.getName() + '=' + encoded;
      }
   
  +   public boolean isIsolated()
  +   {
  +      return isolated;
  +   }
  +   
  +   public void setIsolated(boolean isolated)
  +   {
  +      this.isolated = isolated;
  +   }
  +   
  +   private UIComponent getParentNamingContainer(UIComponent cmp)
  +   {
  +      if (cmp == null)
  +      {
  +         return null;
  +      }
  +      else if (cmp instanceof NamingContainer)
  +      {
  +         return cmp;
  +      }
  +      else
  +      {
  +         return getParentNamingContainer(cmp.getParent());
  +      }
  +   }
  +
   }
  \ No newline at end of file
  
  
  



More information about the jboss-cvs-commits mailing list