[seam-commits] Seam SVN: r7446 - branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/facelet.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Feb 19 09:38:13 EST 2008


Author: pete.muir at jboss.org
Date: 2008-02-19 09:38:13 -0500 (Tue, 19 Feb 2008)
New Revision: 7446

Added:
   branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/facelet/FaceletCompiler.java
Modified:
   branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/facelet/FaceletsRenderer.java
Log:
Backport JBSEAM-2625 r7434 to 2.0

Added: branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/facelet/FaceletCompiler.java
===================================================================
--- branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/facelet/FaceletCompiler.java	                        (rev 0)
+++ branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/facelet/FaceletCompiler.java	2008-02-19 14:38:13 UTC (rev 7446)
@@ -0,0 +1,50 @@
+package org.jboss.seam.ui.facelet;
+
+import static org.jboss.seam.ScopeType.APPLICATION;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Unwrap;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.contexts.Contexts;
+
+import com.sun.facelets.compiler.Compiler;
+import com.sun.facelets.compiler.SAXCompiler;
+
+ at Name("org.jboss.seam.ui.facelet.faceletCompiler")
+ at Scope(APPLICATION)
+ at BypassInterceptors
+ at AutoCreate
+ at Install(value = true, precedence = Install.BUILT_IN, classDependencies="com.sun.facelets.Facelet")
+public class FaceletCompiler
+{
+
+   private Compiler compiler;
+   
+   @Create
+   public void create()
+   {
+      compiler = new SAXCompiler();
+   }
+   
+   @Unwrap
+   public Compiler unwrap()
+   {
+      return compiler;
+   }
+   
+   public static Compiler instance()
+   {
+      if ( !Contexts.isApplicationContextActive() )
+      {
+         throw new IllegalStateException("No active application scope");
+      }
+      return (Compiler) Component.getInstance(FaceletCompiler.class, ScopeType.APPLICATION);
+   }
+   
+}

Property changes on: branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/facelet/FaceletCompiler.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/facelet/FaceletsRenderer.java
===================================================================
--- branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/facelet/FaceletsRenderer.java	2008-02-19 14:04:22 UTC (rev 7445)
+++ branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/facelet/FaceletsRenderer.java	2008-02-19 14:38:13 UTC (rev 7446)
@@ -192,7 +192,7 @@
     */
    protected Facelet faceletForURL(URL url) throws IOException
    {
-      return new DefaultFaceletFactory(new SAXCompiler(), new DefaultResourceResolver())
+      return new DefaultFaceletFactory(FaceletCompiler.instance(), new DefaultResourceResolver())
                .getFacelet(url);
    }
 




More information about the seam-commits mailing list