myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r1197652 - in /myfaces/core/branches/2.0.x/impl: pom.xml src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFunction.java src/main/resources/META-INF/myfaces_facelet_html20.vm
Date Fri, 04 Nov 2011 16:53:18 GMT
Author: lu4242
Date: Fri Nov  4 16:53:18 2011
New Revision: 1197652

URL: http://svn.apache.org/viewvc?rev=1197652&view=rev
Log:
MYFACES-3381 Add @JSFFaceletFunction annotation

Modified:
    myfaces/core/branches/2.0.x/impl/pom.xml
    myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFunction.java
    myfaces/core/branches/2.0.x/impl/src/main/resources/META-INF/myfaces_facelet_html20.vm

Modified: myfaces/core/branches/2.0.x/impl/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/pom.xml?rev=1197652&r1=1197651&r2=1197652&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/impl/pom.xml (original)
+++ myfaces/core/branches/2.0.x/impl/pom.xml Fri Nov  4 16:53:18 2011
@@ -290,29 +290,32 @@
                             <goal>make-config</goal>
                         </goals>
                     </execution>
-                </executions>
-            </plugin>
-
-            <!-- copy src/main/conf using ant -->
-            <plugin>
-                <artifactId>maven-antrun-plugin</artifactId>
-                <executions>
+                    
                     <execution>
-                        <id>copy_fn_tld</id>
-                        <phase>process-resources</phase>
+                        <id>make_fn_facelet_tld</id>
                         <configuration>
-                            <tasks>
-                                <copy todir="${project.build.directory}/tlddoc-facelets"
flatten="true" overwrite="true" verbose="true" failonerror="true">
-                                    <fileset dir="${basedir}/src/main/conf/META-INF" includes="myfaces_facelet_fn.tld"
/>
-                                </copy>
-                            </tasks>
+                            <outputDirectory>${project.build.directory}/tlddoc-facelets</outputDirectory>
+                            <xmlFile>myfaces_facelet_fn.tld</xmlFile>
+                            <templateFile>myfaces_facelet_html20.vm</templateFile>
+                            <modelIds>
+                                <modelId>myfaces-api</modelId>
+                                <modelId>myfaces-impl</modelId>
+                                <modelId>myfaces-impl-shared</modelId>
+                            </modelIds>
+                            <params>
+                               <shortname>fn</shortname>
+                               <uri>http://java.sun.com/jsp/jstl/functions</uri>
+                               <displayname>JSTL Facelets Function Library.</displayname>
+                               <description>JSTL Facelets Function Library.</description>
+                            </params>
                         </configuration>
                         <goals>
-                            <goal>run</goal>
+                            <goal>make-config</goal>
                         </goals>
                     </execution>
                 </executions>
             </plugin>
+
             
             <!-- generate a -tests.jar too -->
             <plugin>
@@ -638,6 +641,9 @@
                                     <taglibs>
                                         <f>http://java.sun.com/jsf/core</f>
                                         <h>http://java.sun.com/jsf/html</h>
+                                        <ui>http://java.sun.com/jsf/facelets</ui>
+                                        <c>http://java.sun.com/jsp/jstl/core</c>
+                                        <fn>http://java.sun.com/jsp/jstl/functions</fn>
                                     </taglibs>
                                 </configuration>
                                 <goals>
@@ -735,6 +741,9 @@
                                     <taglibs>
                                         <f>http://java.sun.com/jsf/core</f>
                                         <h>http://java.sun.com/jsf/html</h>
+                                        <ui>http://java.sun.com/jsf/facelets</ui>
+                                        <c>http://java.sun.com/jsp/jstl/core</c>
+                                        <fn>http://java.sun.com/jsp/jstl/functions</fn>
                                     </taglibs>
                                 </configuration>
                                 <reports>

Modified: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFunction.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFunction.java?rev=1197652&r1=1197651&r2=1197652&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFunction.java
(original)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFunction.java
Fri Nov  4 16:53:18 2011
@@ -23,6 +23,8 @@ import java.util.Collection;
 import java.util.Map;
 import java.util.StringTokenizer;
 
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletFunction;
+
 /**
  * Implementations of JSTL Functions
  * 
@@ -35,6 +37,7 @@ public final class JstlFunction
     {
     }
 
+    @JSFFaceletFunction(name="fn:contains")
     public static boolean contains(String name, String searchString)
     {
         if (name == null || searchString == null)
@@ -45,6 +48,7 @@ public final class JstlFunction
         return -1 != name.indexOf(searchString);
     }
 
+    @JSFFaceletFunction(name="fn:containsIgnoreCase")
     public static boolean containsIgnoreCase(String name, String searchString)
     {
         if (name == null || searchString == null)
@@ -55,6 +59,7 @@ public final class JstlFunction
         return -1 != name.toUpperCase().indexOf(searchString.toUpperCase());
     }
 
+    @JSFFaceletFunction(name="fn:endsWith")
     public static boolean endsWith(String name, String searchString)
     {
         if (name == null || searchString == null)
@@ -65,6 +70,7 @@ public final class JstlFunction
         return name.endsWith(searchString);
     }
 
+    @JSFFaceletFunction(name="fn:escapeXml")
     public static String escapeXml(String value)
     {
         if (value == null)
@@ -113,6 +119,7 @@ public final class JstlFunction
                             app = "&amp;";
                         }
                         break;
+                    default: // all fine
                 }
             } 
             if (app != null)
@@ -122,7 +129,9 @@ public final class JstlFunction
                     sb = new StringBuilder(value.substring(0, i));
                 }
                 sb.append(app);
-            } else {
+            }
+            else
+            {
                 if (sb != null)
                 {
                     sb.append(c);
@@ -140,6 +149,7 @@ public final class JstlFunction
         }
     }
 
+    @JSFFaceletFunction(name="fn:indexOf")
     public static int indexOf(String name, String searchString)
     {
         if (name == null || searchString == null)
@@ -150,6 +160,7 @@ public final class JstlFunction
         return name.indexOf(searchString);
     }
 
+    @JSFFaceletFunction(name="fn:join")
     public static String join(String[] a, String delim)
     {
         if (a == null || delim == null)
@@ -175,6 +186,7 @@ public final class JstlFunction
         return sb.toString();
     }
 
+    @JSFFaceletFunction(name="fn:length")
     public static int length(Object obj)
     {
         if (obj == null)
@@ -205,6 +217,7 @@ public final class JstlFunction
         throw new IllegalArgumentException("Object type not supported: " + obj.getClass().getName());
     }
 
+    @JSFFaceletFunction(name="fn:replace")
     public static String replace(String value, String a, String b)
     {
         if (value == null)
@@ -231,6 +244,7 @@ public final class JstlFunction
         return value.replaceAll(a, b);
     }
 
+    @JSFFaceletFunction(name="fn:split")
     public static String[] split(String value, String d)
     {
         if (value == null)
@@ -258,13 +272,15 @@ public final class JstlFunction
         }
         String[] array = new String[numTokens];
         int i = 0;
-        while (st.hasMoreTokens()){
+        while (st.hasMoreTokens())
+        {
             array[i] = st.nextToken();
             i++;
         }
         return array;
     }
 
+    @JSFFaceletFunction(name="fn:startsWith")
     public static boolean startsWith(String value, String p)
     {
         if (value == null || p == null)
@@ -275,6 +291,7 @@ public final class JstlFunction
         return value.startsWith(p);
     }
 
+    @JSFFaceletFunction(name="fn:substring")
     public static String substring(String v, int s, int e)
     {
         if (v == null)
@@ -305,6 +322,7 @@ public final class JstlFunction
         return v.substring(s, e);
     }
 
+    @JSFFaceletFunction(name="fn:substringAfter")
     public static String substringAfter(String v, String p)
     {
         if (v == null)
@@ -325,6 +343,7 @@ public final class JstlFunction
         return "";
     }
 
+    @JSFFaceletFunction(name="fn:substringBefore")
     public static String substringBefore(String v, String s)
     {
         if (v == null)
@@ -345,6 +364,7 @@ public final class JstlFunction
         return "";
     }
 
+    @JSFFaceletFunction(name="fn:toLowerCase")
     public static String toLowerCase(String v)
     {
         if (v == null)
@@ -359,6 +379,7 @@ public final class JstlFunction
         return v.toLowerCase();
     }
 
+    @JSFFaceletFunction(name="fn:toUpperCase")
     public static String toUpperCase(String v)
     {
         if (v == null)
@@ -373,6 +394,7 @@ public final class JstlFunction
         return v.toUpperCase();
     }
 
+    @JSFFaceletFunction(name="fn:trim")
     public static String trim(String v)
     {
         if (v == null)

Modified: myfaces/core/branches/2.0.x/impl/src/main/resources/META-INF/myfaces_facelet_html20.vm
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/resources/META-INF/myfaces_facelet_html20.vm?rev=1197652&r1=1197651&r2=1197652&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/resources/META-INF/myfaces_facelet_html20.vm
(original)
+++ myfaces/core/branches/2.0.x/impl/src/main/resources/META-INF/myfaces_facelet_html20.vm
Fri Nov  4 16:53:18 2011
@@ -316,4 +316,25 @@ $baseContent
 #end
 #end
 #end
+
+   <!-- Facelets Functions -->
+#set ($functionList = $model.getFaceletFunctions())
+#foreach( $faceletFunction in $functionList )
+#if ($modelIds.contains($faceletFunction.modelId) && ($faceletFunction.name))
+#if ($utils.getTagPrefix($faceletFunction.name) == $shortname)
+   <function>
+#if ($faceletFunction.longDescription)
+       <description><![CDATA[$faceletFunction.longDescription]]></description>
+#elseif ($faceletFunction.description)
+       <description><![CDATA[$faceletFunction.description]]></description>
+#else
+       <description><![CDATA[]]></description>
+#end
+       <name>$utils.getTagName($faceletFunction.name)</name>
+       <function-class>$faceletFunction.sourceClassName</function-class>
+       <function-signature>$faceletFunction.declaredSignature</function-signature>
+   </function>   
+#end
+#end
+#end   
 </taglib>



Mime
View raw message