myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r1522130 - /myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/util/ResourceUtils.java
Date Thu, 12 Sep 2013 02:18:23 GMT
Author: lu4242
Date: Thu Sep 12 02:18:22 2013
New Revision: 1522130

URL: http://svn.apache.org/r1522130
Log:
small improvement add getContractName(...) method

Modified:
    myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/util/ResourceUtils.java

Modified: myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/util/ResourceUtils.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/util/ResourceUtils.java?rev=1522130&r1=1522129&r2=1522130&view=diff
==============================================================================
--- myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/util/ResourceUtils.java
(original)
+++ myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/util/ResourceUtils.java
Thu Sep 12 02:18:22 2013
@@ -21,6 +21,7 @@ package org.apache.myfaces.shared.render
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
+import javax.faces.FacesWrapper;
 
 import javax.faces.application.Resource;
 import javax.faces.component.UIComponent;
@@ -30,6 +31,7 @@ import javax.faces.context.ResponseWrite
 import org.apache.myfaces.shared.config.MyfacesConfig;
 import org.apache.myfaces.shared.renderkit.JSFAttr;
 import org.apache.myfaces.shared.renderkit.html.HTML;
+import org.apache.myfaces.shared.resource.ContractResource;
 
 /**
  * @author Leonardo Uribe (latest modification by $Author$)
@@ -303,4 +305,23 @@ public class ResourceUtils
         return;
     }
 
+    public static String getContractName(Resource resource)
+    {
+        while (resource != null)
+        {
+            if (resource instanceof ContractResource)
+            {
+                return ((ContractResource)resource).getContractName();
+            }
+            else if (resource instanceof FacesWrapper)
+            {
+                resource = (Resource)((FacesWrapper)resource).getWrapped();
+            }
+            else
+            {
+                resource = null;
+            }
+        }
+        return null;
+    }
 }



Mime
View raw message