Author: amarkhel
Date: 2010-09-21 13:34:26 -0400 (Tue, 21 Sep 2010)
New Revision: 19292
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteDivLayoutStrategy.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteEncodeStrategy.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteListLayoutStrategy.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteTableLayoutStrategy.java
Log:
RF-9313
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteDivLayoutStrategy.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteDivLayoutStrategy.java 2010-09-21
17:31:29 UTC (rev 19291)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteDivLayoutStrategy.java 2010-09-21
17:34:26 UTC (rev 19292)
@@ -61,4 +61,15 @@
writer.endElement(HtmlConstants.DIV_ELEM);
}
+ public void encodeItem(FacesContext facesContext, UIComponent component) throws
IOException {
+ ResponseWriter writer = facesContext.getResponseWriter();
+ encodeItemBegin(facesContext, component);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-au-option
rf-au-font rf-au-input", null);
+ for (UIComponent child : component.getChildren()) {
+ child.encodeAll(facesContext);
+ }
+ encodeItemEnd(facesContext, component);
+
+ }
+
}
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteEncodeStrategy.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteEncodeStrategy.java 2010-09-21
17:31:29 UTC (rev 19291)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteEncodeStrategy.java 2010-09-21
17:34:26 UTC (rev 19292)
@@ -15,6 +15,8 @@
void encodeItemBegin(FacesContext facesContext, UIComponent component) throws
IOException ;
void encodeItemEnd(FacesContext facesContext, UIComponent component) throws
IOException ;
+
+ void encodeItem(FacesContext facesContext, UIComponent component) throws IOException
;
void encodeFakeItem(FacesContext facesContext, UIComponent component) throws
IOException ;
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteListLayoutStrategy.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteListLayoutStrategy.java 2010-09-21
17:31:29 UTC (rev 19291)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteListLayoutStrategy.java 2010-09-21
17:34:26 UTC (rev 19292)
@@ -39,5 +39,16 @@
ResponseWriter writer = facesContext.getResponseWriter();
writer.endElement(HtmlConstants.LI_ELEMENT);
}
+
+ public void encodeItem(FacesContext facesContext, UIComponent component) throws
IOException {
+ ResponseWriter writer = facesContext.getResponseWriter();
+ encodeItemBegin(facesContext, component);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-au-option
rf-au-font rf-au-input", null);
+ for (UIComponent child : component.getChildren()) {
+ child.encodeAll(facesContext);
+ }
+ encodeItemEnd(facesContext, component);
+
+ }
}
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2010-09-21
17:31:29 UTC (rev 19291)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2010-09-21
17:34:26 UTC (rev 19292)
@@ -250,17 +250,13 @@
public void encodeItem(FacesContext facesContext, AbstractAutocomplete comboBox,
Object item,
AutocompleteEncodeStrategy strategy) throws IOException {
- strategy.encodeItemBegin(facesContext, comboBox);
- ResponseWriter writer = facesContext.getResponseWriter();
-
- writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-au-option
rf-au-font rf-au-input", null);
-
+ ResponseWriter writer = facesContext.getResponseWriter();
if (comboBox.getChildCount() > 0) {
- for (UIComponent child : comboBox.getChildren()) {
- child.encodeAll(facesContext);
- }
+ strategy.encodeItem(facesContext, comboBox);
} else {
if (item != null) {
+ strategy.encodeItemBegin(facesContext, comboBox);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-au-option
rf-au-font rf-au-input", null);
// TODO nick - use converter
String value = null;
if (comboBox.getItemConverter() != null) {
@@ -270,9 +266,10 @@
writer.writeText(value, null);
}
writer.writeText(item, null);
+ strategy.encodeItemEnd(facesContext, comboBox);
}
}
- strategy.encodeItemEnd(facesContext, comboBox);
+
}
private AutocompleteEncodeStrategy getStrategy(UIComponent component) {
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteTableLayoutStrategy.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteTableLayoutStrategy.java 2010-09-21
17:31:29 UTC (rev 19291)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteTableLayoutStrategy.java 2010-09-21
17:34:26 UTC (rev 19292)
@@ -2,6 +2,7 @@
import java.io.IOException;
+import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
@@ -39,10 +40,33 @@
writer.startElement(HtmlConstants.TD_ELEM, component);
}
+ private void encodeItemChildBegin(FacesContext facesContext, UIComponent component)
throws IOException {
+ ResponseWriter writer = facesContext.getResponseWriter();
+ writer.startElement(HtmlConstants.TD_ELEM, component);
+ }
+
+ private void encodeItemChildEnd(FacesContext facesContext, UIComponent component)
throws IOException {
+ ResponseWriter writer = facesContext.getResponseWriter();
+ writer.endElement(HtmlConstants.TD_ELEM);
+ }
+
public void encodeItemEnd(FacesContext facesContext, UIComponent component) throws
IOException {
ResponseWriter writer = facesContext.getResponseWriter();
writer.endElement(HtmlConstants.TD_ELEM);
writer.endElement(HtmlConstants.TR_ELEMENT);
}
+ public void encodeItem(FacesContext facesContext, UIComponent component) throws
IOException {
+ ResponseWriter writer = facesContext.getResponseWriter();
+ writer.startElement(HtmlConstants.TR_ELEMENT, component);
+ for (UIComponent child : component.getChildren()) {
+ if (child instanceof UIColumn) {
+ encodeItemChildBegin(facesContext, component);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-au-option
rf-au-font rf-au-input", null);
+ child.encodeAll(facesContext);
+ encodeItemChildEnd(facesContext, component);
+ }
+ }
+ writer.endElement(HtmlConstants.TR_ELEMENT);
+ }
}