Author: ppitonak(a)redhat.com
Date: 2010-10-12 08:50:47 -0400 (Tue, 12 Oct 2010)
New Revision: 19537
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/bean/UiRepeatBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/uiRepeat/simple.xhtml
Log:
* class Attributes fixed to work for Mojarra and Myfaces implementation of Facelets
* page with ui:repeat fixed to work with Myfaces
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-12
09:30:07 UTC (rev 19536)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Attributes.java 2010-10-12
12:50:47 UTC (rev 19537)
@@ -63,7 +63,7 @@
public final class Attributes implements Map<String, Attribute>, Serializable {
private static final long serialVersionUID = -1L;
- private Logger logger;
+ private static Logger logger = LoggerFactory.getLogger(Attributes.class);
// K - name of a component attribute, V - value of the component attribute
private Map<String, Attribute> attributes;
// class object of managed bean
@@ -78,7 +78,6 @@
* class object of a managed bean
*/
private Attributes(Class<?> componentClass, Class<?> beanClass) {
- logger = LoggerFactory.getLogger(Attributes.class);
logger.debug("creating attributes map for " + componentClass);
this.beanClass = beanClass;
@@ -113,7 +112,7 @@
}
/**
- * Constructor for class Attributes.
+ * Factory method for creating instances of class Attributes.
*
* @param componentClass
* class object of a JSF component whose attributes will be stored
@@ -125,7 +124,7 @@
}
/**
- * Constructor for class Attributes.
+ * Factory method for creating instances of class Attributes.
*
* @param behaviorClass
* class object of a JSF behavior whose attributes will be stored
@@ -137,6 +136,34 @@
}
/**
+ * Factory method for creating instances of class Attributes.
+ *
+ * @param behaviorClass
+ * class object of a JSF behavior whose attributes will be stored
+ * @param beanClass
+ * class object of a managed bean
+ */
+ public static Attributes getFaceletsComponentAttributes(String componentClass,
Class<?> beanClass) {
+ Class<?> faceletsClass = null;
+
+ try {
+ faceletsClass = Class.forName(componentClass);
+ } catch (ClassNotFoundException cnfe1) {
+ try {
+ if (componentClass.startsWith("com.sun.faces.facelets")) {
+ faceletsClass =
Class.forName(componentClass.replace("com.sun.faces.facelets",
"org.apache.myfaces.view.facelets"));
+ } else {
+ faceletsClass =
Class.forName(componentClass.replace("org.apache.myfaces.view.facelets",
"com.sun.faces.facelets"));
+ }
+ } catch (ClassNotFoundException cnfe2) {
+ logger.error(cnfe2.getMessage());
+ }
+ }
+
+ return new Attributes(faceletsClass, beanClass);
+ }
+
+ /**
* Loads help strings from property file.
*/
private void loadHelp() {
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/UiRepeatBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/UiRepeatBean.java 2010-10-12
09:30:07 UTC (rev 19536)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/UiRepeatBean.java 2010-10-12
12:50:47 UTC (rev 19537)
@@ -70,7 +70,7 @@
}
// initialize attributes
- attributes =
Attributes.getUIComponentAttributes(com.sun.faces.facelets.component.UIRepeat.class,
getClass());
+ attributes =
Attributes.getFaceletsComponentAttributes("org.apache.myfaces.view.facelets.component.UIRepeat",
getClass());
attributes.setAttribute("rendered", true);
attributes.setAttribute("step", 1);
attributes.setAttribute("end", 20);
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/uiRepeat/simple.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/uiRepeat/simple.xhtml 2010-10-12
09:30:07 UTC (rev 19536)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/uiRepeat/simple.xhtml 2010-10-12
12:50:47 UTC (rev 19537)
@@ -63,12 +63,17 @@
<f:setPropertyActionListener
target="#{uiRepeatBean.selectedDataItem}" value="#{item}" />
</h:commandLink>
+
+ <!--
http://myfaces.apache.org/core20/myfaces-impl/apidocs/org/apache/myfaces/...
-->
<a4j:outputPanel id="statusPanel"
styleClass="statuses">
<h:outputText id="statusIndex"
value="index=#{status.index}, "/>
- <h:outputText id="statusCount"
value="count=#{status.count}, "/>
<h:outputText id="statusFirst"
value="first=#{status.first}, "/>
<h:outputText id="statusLast"
value="last=#{status.last}, "/>
<h:outputText id="statusEven"
value="even=#{status.even}, "/>
+ <h:outputText id="statusOdd"
value="odd=#{status.odd}, "/>
+ <h:outputText id="statusStep"
value="step=#{status.step}, "/>
+ <h:outputText id="statusBegin"
value="begin=#{status.begin}, "/>
+ <h:outputText id="statusEnd"
value="end=#{status.end}, "/>
</a4j:outputPanel>
</li>
</ui:repeat>