You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2010/10/12 05:08:12 UTC

svn commit: r1021604 - in /myfaces/commons/trunk/myfaces-commons-components/src/main: conf/ conf/META-INF/ conf/META-INF/facelets-taglib-base.xml java/org/apache/myfaces/commons/util/FaceletsFunctionLibrary.java

Author: lu4242
Date: Tue Oct 12 03:08:11 2010
New Revision: 1021604

URL: http://svn.apache.org/viewvc?rev=1021604&view=rev
Log:
MFCOMMONS-17 Add facelet function findComponent

Added:
    myfaces/commons/trunk/myfaces-commons-components/src/main/conf/
    myfaces/commons/trunk/myfaces-commons-components/src/main/conf/META-INF/
    myfaces/commons/trunk/myfaces-commons-components/src/main/conf/META-INF/facelets-taglib-base.xml
    myfaces/commons/trunk/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/util/FaceletsFunctionLibrary.java

Added: myfaces/commons/trunk/myfaces-commons-components/src/main/conf/META-INF/facelets-taglib-base.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-components/src/main/conf/META-INF/facelets-taglib-base.xml?rev=1021604&view=auto
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-components/src/main/conf/META-INF/facelets-taglib-base.xml (added)
+++ myfaces/commons/trunk/myfaces-commons-components/src/main/conf/META-INF/facelets-taglib-base.xml Tue Oct 12 03:08:11 2010
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!DOCTYPE facelet-taglib
+  PUBLIC "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN" "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
+<facelet-taglib xmlns="http://java.sun.com/JSF/Facelet">
+
+    <function>
+        <function-name>findComponent</function-name>
+        <function-class>org.apache.myfaces.commons.util.FaceletsFunctionLibrary</function-class>
+        <function-signature>javax.faces.component.UIComponent findComponent(java.lang.String)</function-signature>
+    </function>
+
+</facelet-taglib>
\ No newline at end of file

Added: myfaces/commons/trunk/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/util/FaceletsFunctionLibrary.java
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/util/FaceletsFunctionLibrary.java?rev=1021604&view=auto
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/util/FaceletsFunctionLibrary.java (added)
+++ myfaces/commons/trunk/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/util/FaceletsFunctionLibrary.java Tue Oct 12 03:08:11 2010
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.commons.util;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+public final class FaceletsFunctionLibrary
+{
+
+    public FaceletsFunctionLibrary()
+    {
+        super();
+    }
+
+    public static UIComponent findComponent(String expr)
+    {
+        return FacesContext.getCurrentInstance().
+            getViewRoot().findComponent(expr);
+    }
+}