Index: code/run-time/avatar/src/main/java/com/sun/faces/extensions/avatar/lifecycle/ExtensionsLifecycleFactoryImpl.java
===================================================================
--- code/run-time/avatar/src/main/java/com/sun/faces/extensions/avatar/lifecycle/ExtensionsLifecycleFactoryImpl.java (revision 331)
+++ code/run-time/avatar/src/main/java/com/sun/faces/extensions/avatar/lifecycle/ExtensionsLifecycleFactoryImpl.java (working copy)
@@ -24,6 +24,10 @@
/** Creates a new instance of ExtensionsLifecycleFactoryImpl */
public ExtensionsLifecycleFactoryImpl(LifecycleFactory parent) {
this.parent = parent;
+ //check whether the lifecycleId already exists
+ if (alreadyCreated("com.sun.faces.lifecycle.PARTIAL")) {
+ return;
+ }
this.parent.addLifecycle("com.sun.faces.lifecycle.PARTIAL",
new PartialTraversalLifecycle(this.parent.getLifecycle("DEFAULT")));
}
@@ -33,6 +37,10 @@
}
public void addLifecycle(String string, Lifecycle lifecycle) {
+ //check whether the lifecycleId already exists
+ if (alreadyCreated(string)) {
+ return;
+ }
parent.addLifecycle(string, lifecycle);
}
@@ -40,5 +48,14 @@
return parent.getLifecycleIds();
}
-
+ boolean alreadyCreated(String lifecycleId) {
+ Iterator<String> iter = this.getLifecycleIds();
+ while(iter.hasNext()) {
+ String existingId = iter.next();
+ if (existingId.equals(lifecycleId)) { //let NPE be thrown
+ return true;
+ }
+ }
+ return false;
+ }
}
Index: code/run-time/avatar/src/main/java/com/sun/faces/extensions/avatar/taglib/AjaxZoneTag.java
===================================================================
--- code/run-time/avatar/src/main/java/com/sun/faces/extensions/avatar/taglib/AjaxZoneTag.java (revision 331)
+++ code/run-time/avatar/src/main/java/com/sun/faces/extensions/avatar/taglib/AjaxZoneTag.java (working copy)
@@ -26,11 +26,16 @@
}
private ValueExpression style = null;
+ private ValueExpression styleClass = null;
public void setStyle(ValueExpression ve) {
style = ve;
}
+ public void setStyleClass(ValueExpression ve) {
+ styleClass = ve;
+ }
+
protected void setProperties(UIComponent comp) {
super.setProperties(comp);
@@ -44,6 +49,14 @@
component.setValueExpression("style", style);
}
}
+ if (null != styleClass) {
+ if (styleClass.isLiteralText()) {
+ component.getAttributes().put("styleClass", styleClass.getValue(getFacesContext().getELContext()));
+ }
+ else {
+ component.setValueExpression("styleClass", styleClass);
+ }
+ }
if (null != collectPostData) {
if (collectPostData.isLiteralText()) {
component.getAttributes().put("collectPostData", collectPostData.getValue(getFacesContext().getELContext()));
Index: code/run-time/avatar/src/main/java/com/sun/faces/extensions/avatar/components/AjaxZone.java
===================================================================
--- code/run-time/avatar/src/main/java/com/sun/faces/extensions/avatar/components/AjaxZone.java (revision 331)
+++ code/run-time/avatar/src/main/java/com/sun/faces/extensions/avatar/components/AjaxZone.java (working copy)
@@ -11,11 +11,13 @@
import javax.el.MethodExpression;
import javax.el.MethodInfo;
import javax.faces.context.FacesContext;
+import javax.el.ValueExpression;
+import javax.faces.component.NamingContainer;
/**
*
*/
-public class AjaxZone extends UICommand implements Serializable {
+public class AjaxZone extends UICommand implements Serializable, NamingContainer {
public AjaxZone() {
super();
setRendererType("com.sun.faces.AjaxZone");
@@ -130,4 +132,88 @@
private static final String ZONE_LIST = AsyncResponse.FACES_PREFIX + "AJAX_ZONE_LIST";
+ /* --------------- style and styleClass ------------- */
+
+ /**
+ * <p>CSS style(s) to be applied to the outermost HTML element when this
+ * component is rendered.</p>
+ */
+ private String style = null;
+
+ /**
+ * <p>CSS style(s) to be applied to the outermost HTML element when this
+ * component is rendered.</p>
+ */
+ public String getStyle() {
+ if (this.style != null) {
+ return this.style;
+ }
+ ValueExpression ve = getValueExpression("style");
+ if (ve != null) {
+ return (String) ve.getValue(getFacesContext().getELContext());
+ }
+ return null;
+ }
+
+ /**
+ * <p>CSS style(s) to be applied to the outermost HTML element when this
+ * component is rendered.</p>
+ * @see #getStyle()
+ */
+ public void setStyle(String style) {
+ this.style = style;
+ }
+
+ /**
+ * <p>CSS style class(es) to be applied to the outermost HTML element when this
+ * component is rendered.</p>
+ */
+
+ private String styleClass = null;
+
+ /**
+ * <p>CSS style class(es) to be applied to the outermost HTML element when this
+ * component is rendered.</p>
+ */
+ public String getStyleClass() {
+ if (this.styleClass != null) {
+ return this.styleClass;
+ }
+ ValueExpression ve = getValueExpression("styleClass");
+ if (ve != null) {
+ return (String) ve.getValue(getFacesContext().getELContext());
+ }
+ return null;
+ }
+
+ /**
+ * <p>CSS style class(es) to be applied to the outermost HTML element when this
+ * component is rendered.</p>
+ * @see #getStyleClass()
+ */
+ public void setStyleClass(String styleClass) {
+ this.styleClass = styleClass;
+ }
+
+ /**
+ * <p>Restore the state of this component.</p>
+ */
+ public void restoreState(FacesContext context, Object state) {
+ Object values[] = (Object[]) state;
+ super.restoreState(context, values[0]);
+ this.style = (String) values[1];
+ this.styleClass = (String) values[2];
+ }
+
+ /**
+ * <p>Save the state of this component.</p>
+ */
+ public Object saveState(FacesContext context) {
+ Object values[] = new Object[3];
+ values[0] = super.saveState(context);
+ values[1] = this.style;
+ values[2] = this.styleClass;
+ return values;
+ }
+
}
Index: code/run-time/avatar/src/main/java/com/sun/faces/extensions/avatar/renderkit/AjaxZoneRenderer.java
===================================================================
--- code/run-time/avatar/src/main/java/com/sun/faces/extensions/avatar/renderkit/AjaxZoneRenderer.java (revision 331)
+++ code/run-time/avatar/src/main/java/com/sun/faces/extensions/avatar/renderkit/AjaxZoneRenderer.java (working copy)
@@ -123,21 +123,23 @@
String id = component.getClientId(FacesContext.getCurrentInstance());
writer.startElement("div", component);
writer.writeAttribute("id", id, null);
- writeStyle(context, writer, component);
+ writeStyle(context, writer, component, false);
+ writeStyle(context, writer, component, true);
}
- private void writeStyle(FacesContext context, ResponseWriter writer, UIComponent comp) throws IOException {
- String style = null;
+ private void writeStyle(FacesContext context, ResponseWriter writer, UIComponent comp, boolean isStyleClass) throws IOException {
+ String styleValue = null;
ValueExpression styleExp = null;
+ String styleProperty = isStyleClass ? "styleClass" : "style";
- if (null == (style = (String) comp.getAttributes().get("style"))) {
- if (null != (styleExp = comp.getValueExpression("style"))) {
- style = (String) styleExp.getValue(context.getELContext());
+ if (null == (styleValue = (String) comp.getAttributes().get(styleProperty))) {
+ if (null != (styleExp = comp.getValueExpression(styleProperty))) {
+ styleValue = (String) styleExp.getValue(context.getELContext());
}
}
- if (null != style) {
- writer.writeAttribute("style", style, "style");
+ if (null != styleValue) {
+ writer.writeAttribute(styleProperty, styleValue, styleProperty);
}
}
Index: code/run-time/avatar/src/main/resources/jsf-ext-dynafaces.tld
===================================================================
--- code/run-time/avatar/src/main/resources/jsf-ext-dynafaces.tld (revision 331)
+++ code/run-time/avatar/src/main/resources/jsf-ext-dynafaces.tld (working copy)
@@ -72,6 +72,18 @@
</description>
<name>id</name>
</attribute>
+ <attribute>
+ <name>binding</name>
+ <required>false</required>
+ <deferred-value>
+ <type>com.sun.faces.extensions.avatar.components.AjaxZone</type>
+ </deferred-value>
+ <description>
+ A ValueExpression that resolves to the UIComponent that corresponds
+ to this tag. This binding allows the Java bean that contains the UIComponent
+ to manipulate the UIComponent, its properties, and its children.
+ </description>
+ </attribute>
<attribute>
<description>
<![CDATA[
@@ -91,6 +103,21 @@
<description>
<![CDATA[
+ <p>Convey CSS style information to the renderer</p>
+
+ ]]>
+
+ </description>
+ <name>styleClass</name>
+ <required>false</required>
+ <deferred-value>
+ <type>java.lang.String</type>
+ </deferred-value>
+ </attribute>
+ <attribute>
+ <description>
+ <![CDATA[
+
<p>This optional attribute is a <code>MethodExpression</code> to
invoke when the request processing lifecycle in which this zone
is being processed encounters its invokeApplication phase.</p>