Author: abelevich
Date: 2007-08-31 07:18:53 -0400 (Fri, 31 Aug 2007)
New Revision: 2643
Modified:
trunk/ui/message/src/main/java/org/richfaces/component/UIRichMessage.java
trunk/ui/message/src/main/java/org/richfaces/renderkit/html/HtmlRichMessageRenderer.java
trunk/ui/message/src/main/java/org/richfaces/renderkit/html/HtmlRichMessagesRenderer.java
Log:
remove layout iterator
Modified: trunk/ui/message/src/main/java/org/richfaces/component/UIRichMessage.java
===================================================================
--- trunk/ui/message/src/main/java/org/richfaces/component/UIRichMessage.java 2007-08-31
11:16:20 UTC (rev 2642)
+++ trunk/ui/message/src/main/java/org/richfaces/component/UIRichMessage.java 2007-08-31
11:18:53 UTC (rev 2643)
@@ -1,5 +1,7 @@
package org.richfaces.component;
+import java.io.IOException;
+
import javax.faces.component.UIMessage;
import javax.faces.context.FacesContext;
@@ -17,7 +19,7 @@
public boolean isPassed() {
return isPassed;
}
-
+
public abstract String getPassedLabel();
public abstract void setPassedLabel(String passedLabel);
@@ -36,4 +38,10 @@
isPassed = true;
super.decode(context);
}
+
+ public void encodeEnd(FacesContext context) throws IOException {
+ super.encodeEnd(context);
+ isPassed = false;
+ }
+
}
\ No newline at end of file
Modified:
trunk/ui/message/src/main/java/org/richfaces/renderkit/html/HtmlRichMessageRenderer.java
===================================================================
---
trunk/ui/message/src/main/java/org/richfaces/renderkit/html/HtmlRichMessageRenderer.java 2007-08-31
11:16:20 UTC (rev 2642)
+++
trunk/ui/message/src/main/java/org/richfaces/renderkit/html/HtmlRichMessageRenderer.java 2007-08-31
11:18:53 UTC (rev 2643)
@@ -87,7 +87,7 @@
getUtils().writeAttribute(writer, HTML.id_ATTRIBUTE,
msgComponent.getClientId(context));
if(!msgIter.hasNext() && msgComponent.isPassed()){
-
+
encodingUIContent(msgComponent, context, null);
}else if(msgIter.hasNext() ){
Modified:
trunk/ui/message/src/main/java/org/richfaces/renderkit/html/HtmlRichMessagesRenderer.java
===================================================================
---
trunk/ui/message/src/main/java/org/richfaces/renderkit/html/HtmlRichMessagesRenderer.java 2007-08-31
11:16:20 UTC (rev 2642)
+++
trunk/ui/message/src/main/java/org/richfaces/renderkit/html/HtmlRichMessagesRenderer.java 2007-08-31
11:18:53 UTC (rev 2643)
@@ -5,10 +5,8 @@
import java.io.IOException;
import java.util.Iterator;
-import java.util.Map;
import java.util.Set;
-import javax.faces.FacesException;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.component.UIMessages;
@@ -28,8 +26,6 @@
private boolean isWroteTable = false;
- private boolean isIteratorLayout = false;
-
private final InternetResource[] styles =
{getResource("/org/richfaces/renderkit/html/css/msgs.css")};
private InternetResource[] stylesAll = null;
@@ -82,7 +78,6 @@
protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException {
String forIds = null;
-
Iterator messagesIter = null;
@@ -101,10 +96,7 @@
String layout = null;
- String var = null;
-
-
UIRichMessages uiMessages = (UIRichMessages)component;
layout = (String)uiMessages.getAttributes().get("layout");
@@ -122,28 +114,10 @@
writer.startElement("tbody", uiMessages);
isWroteTable = true;
- isIteratorLayout = false;
-
- }else if((layout != null) && (layout.equals("iterator"))){
-
- var = (String)uiMessages.getAttributes().get("var");
- if(var == null){
- FacesException e = new FacesException(new IllegalArgumentException("var
attribute is not defined"));
- throw e;
- }
-
- writer.startElement(HTML.SPAN_ELEM, uiMessages);
- getUtils().writeAttribute(writer,HTML.id_ATTRIBUTE ,uiMessages.getClientId(context));
-
- renderComponentOuterStyles(uiMessages, context, writer);
-
- isIteratorLayout = true;
- isWroteTable = false;
-
+
}else if((layout != null) && (layout.equals("list"))){
isWroteTable = false;
- isIteratorLayout = false;
writer.startElement("dl", uiMessages);
@@ -154,54 +128,23 @@
}
if(!messagesIter.hasNext()){
-
renderBody(uiMessages, context, writer, null);
-
}else{
while(messagesIter.hasNext()){
-
FacesMessage facesMsg = (FacesMessage)(messagesIter.next());
-
- if(!isIteratorLayout){
-
- renderBody(uiMessages, context, writer, facesMsg);
-
- }else{
-
- Map requestMap = context.getExternalContext().getRequestMap();
- Object value = requestMap.get(var);
- requestMap.put(var, facesMsg);
-
- try {
- renderChildren(context, uiMessages);
- } finally {
-
- if(value != null){
- requestMap.put(var, value);
- }
-
- }
-
- }
-
+ renderBody(uiMessages, context, writer, facesMsg);
}
}
- if(!isIteratorLayout){
-
- if(isWroteTable){
- writer.endElement("tbody");
- writer.endElement("table");
- }else{
- writer.endElement("dl");
- }
-
+ if(isWroteTable){
+ writer.endElement("tbody");
+ writer.endElement("table");
}else{
- writer.endElement(HTML.SPAN_ELEM);
+ writer.endElement("dl");
}
-
+
}
public void renderLabelHtml(UIComponent component, FacesContext context, ResponseWriter
writer,
@@ -353,7 +296,7 @@
if(isWroteTable){
writer.startElement(HTML.TR_ELEMENT, uiMessages);
- }else if(!isIteratorLayout){
+ }else{
writer.startElement("dt", uiMessages);
}
@@ -363,12 +306,12 @@
if(isWroteTable){
writer.endElement(HTML.TR_ELEMENT);
- }else if(!isIteratorLayout){
+ }else{
writer.endElement("dt");
}
}
-
+
}
protected Class getComponentClass() {