Author: ppitonak(a)redhat.com
Date: 2010-10-22 09:29:52 -0400 (Fri, 22 Oct 2010)
New Revision: 19649
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Attribute.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Attributes.java
Log:
* class Attributes fixed to find more RichFaces components
* method Attribute.isHidden() fixed
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Attribute.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Attribute.java 2010-10-22
13:24:41 UTC (rev 19648)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Attribute.java 2010-10-22
13:29:52 UTC (rev 19649)
@@ -121,6 +121,9 @@
}
public boolean isHidden() {
+ if (extensions == null) {
+ return false;
+ }
return extensions.getHidden();
}
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Attributes.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Attributes.java 2010-10-22
13:24:41 UTC (rev 19648)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Attributes.java 2010-10-22
13:29:52 UTC (rev 19649)
@@ -600,43 +600,48 @@
private void loadRichFacesComponents() {
richfacesAttributes = new HashMap<Class<?>,
List<Attribute>>();
- try {
- ClassLoader cl = UIStatus.class.getClassLoader();
- Enumeration<URL> fileUrls =
cl.getResources("META-INF/faces-config.xml");
- URL configFile = null;
+ final String[] files = {"META-INF/faces-config.xml",
"META-INF/pn.faces-config.xml"};
- while (fileUrls.hasMoreElements()) {
- URL url = fileUrls.nextElement();
- if (url.getPath().contains("richfaces-components-ui")) {
- configFile = url;
+ for (String file : files) {
+ try {
+ ClassLoader cl = UIStatus.class.getClassLoader();
+ Enumeration<URL> fileUrls = cl.getResources(file);
+ URL configFile = null;
+
+ while (fileUrls.hasMoreElements()) {
+ URL url = fileUrls.nextElement();
+ if (url.getPath().contains("richfaces-components-ui")) {
+ configFile = url;
+ }
}
- }
- JAXBContext context = JAXBContext.newInstance(FacesConfigHolder.class);
- FacesConfigHolder facesConfigHolder = (FacesConfigHolder)
context.createUnmarshaller().unmarshal(configFile);
- List<Component> components = facesConfigHolder.getComponents();
+ JAXBContext context = JAXBContext.newInstance(FacesConfigHolder.class);
+ FacesConfigHolder facesConfigHolder = (FacesConfigHolder)
context.createUnmarshaller().unmarshal(configFile);
+ List<Component> components = facesConfigHolder.getComponents();
- for (Component c : components) {
- if (c.getAttributes() == null) {
- continue;
- }
+ for (Component c : components) {
+ if (c.getAttributes() == null) {
+ continue;
+ }
- // remove hidden attributes
- Iterator<Attribute> i = c.getAttributes().iterator();
- while (i.hasNext()) {
- Attribute a = i.next();
- if (a.isHidden() || "id".equals(a.getName()) ||
"binding".equals(a.getName())) {
- i.remove();
+ // remove hidden attributes
+ Iterator<Attribute> i = c.getAttributes().iterator();
+ while (i.hasNext()) {
+ Attribute a = i.next();
+ if (a.isHidden() || "id".equals(a.getName()) ||
"binding".equals(a.getName())) {
+ i.remove();
+ }
}
+
+ richfacesAttributes.put(c.getComponentClass(), c.getAttributes());
+ logger.info("attributes for component " +
c.getComponentClass().getName() + " loaded");
}
- richfacesAttributes.put(c.getComponentClass(), c.getAttributes());
+ } catch (IOException ex) {
+ logger.error("Input/output error.", ex);
+ } catch (JAXBException ex) {
+ logger.error("XML reading error.", ex);
}
-
- } catch (IOException ex) {
- logger.error("Input/output error.", ex);
- } catch (JAXBException ex) {
- logger.error("XML reading error.", ex);
}
}