Author: abelevich
Date: 2007-07-20 11:06:10 -0400 (Fri, 20 Jul 2007)
New Revision: 1741
Modified:
trunk/sandbox/ui/message/src/main/java/org/richfaces/component/UIRichMessage.java
trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/RichMessageBaseRenderer.java
trunk/sandbox/ui/message/src/main/resources/org/richfaces/renderkit/html/css/msg.css
trunk/sandbox/ui/message/src/main/templates/org/richfaces/message.jspx
Log:
table based message component mockup
Modified:
trunk/sandbox/ui/message/src/main/java/org/richfaces/component/UIRichMessage.java
===================================================================
---
trunk/sandbox/ui/message/src/main/java/org/richfaces/component/UIRichMessage.java 2007-07-20
15:04:22 UTC (rev 1740)
+++
trunk/sandbox/ui/message/src/main/java/org/richfaces/component/UIRichMessage.java 2007-07-20
15:06:10 UTC (rev 1741)
@@ -15,12 +15,10 @@
public final String MARKER_LOCATION_RIGHT = "right";
- private String passedLabel = null;
+ private String passedLabel = "passed";
private String markerLocation = "left";
-
-
-
+
public abstract String getPassedLabel();
public abstract void setPassedLabel(String passedLabel);
Modified:
trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/RichMessageBaseRenderer.java
===================================================================
---
trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/RichMessageBaseRenderer.java 2007-07-20
15:04:22 UTC (rev 1740)
+++
trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/RichMessageBaseRenderer.java 2007-07-20
15:06:10 UTC (rev 1741)
@@ -35,6 +35,8 @@
public static final String COMPONENT_NOT_FOUND_IN_VIEW_WARN_MESSAGE = "component
not found in the view WARNING";
+ public boolean isError = false;
+
private RendererBase messageTemplate = null;
@@ -69,22 +71,51 @@
}
msgIter = getMessageIterator(context, forClientId, msgComponent);
- if(!msgIter.hasNext()){
- return;
+ ResponseWriter writer = context.getResponseWriter();
+
+ if(!msgIter.hasNext() && isError){
+
+ if(msgComponent.getFacets().containsKey("passedMarker")){
+
+ UIComponent facet = msgComponent.getFacet("passedMarker");
+
+ String markerClass = (String)
msgComponent.getAttributes().get("markerClass");
+ String markerStyle = (String)
msgComponent.getAttributes().get("markerStyle");
+
+ renderMarkerFacet(msgComponent, facet, context, writer, markerClass, markerStyle);
+ }
+
+ if(msgComponent.getPassedLabel() != null){
+
+ String passLabel = (String) msgComponent.getPassedLabel();
+ String labelClass = (String)
msgComponent.getAttributes().get("labelClass");
+ String labelStyle = (String)
msgComponent.getAttributes().get("labelStyle");
+
+ renderLabel(msgComponent, null, context, writer, labelClass,
+ labelStyle, false, false, false,passLabel,true);
+ }
+
+ }else if(msgIter.hasNext() ){
+
+ FacesMessage message = (FacesMessage)msgIter.next();
+ encodingUIContent(msgComponent, context, message);
+ isError = true;
}
- FacesMessage message = (FacesMessage)msgIter.next();
+ doEncodeEnd(writer, context, msgComponent);
- encodingUIContent(msgComponent, context, message);
-
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- Set ajaxRenderedAreas = ajaxContext.getAjaxRenderedAreas();
+ if(isError){
+
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+ Set ajaxRenderedAreas = ajaxContext.getAjaxRenderedAreas();
- if(null != ajaxRenderedAreas) {
- ajaxRenderedAreas.add(clientId);
- }
+ if(null != ajaxRenderedAreas) {
+ ajaxRenderedAreas.add(clientId);
+ }
+ }
}
+
protected void encodingUIContent(UIRichMessage uiMsg, FacesContext context, FacesMessage
facesMsg) throws IOException{
boolean showSummary = uiMsg.isShowSummary();
@@ -98,8 +129,8 @@
isTooltip = ((Boolean)tooltip).booleanValue();
}
- String divClass = null;
- String divStyle = null;
+ String tableClass = null;
+ String tableStyle = null;
String markerClass = null;
String markerStyle = null;
@@ -112,8 +143,8 @@
if(facesMsg.getSeverity() == FacesMessage.SEVERITY_ERROR){
- divClass = (String)uiMsg.getAttributes().get("errorClass");
- divStyle = (String)uiMsg.getAttributes().get("errorStyle");
+ tableClass = (String)uiMsg.getAttributes().get("errorClass");
+ tableStyle = (String)uiMsg.getAttributes().get("errorStyle");
markerClass = (String)uiMsg.getAttributes().get("errorMarkerClass");
markerStyle = (String)uiMsg.getAttributes().get("errorMarkerStyle");
@@ -125,8 +156,8 @@
}else if(facesMsg.getSeverity() == FacesMessage.SEVERITY_FATAL){
- divClass = (String)uiMsg.getAttributes().get("fatalClass");
- divStyle = (String)uiMsg.getAttributes().get("fatalStyle");
+ tableClass = (String)uiMsg.getAttributes().get("fatalClass");
+ tableStyle = (String)uiMsg.getAttributes().get("fatalStyle");
markerClass = (String)uiMsg.getAttributes().get("fatalMarkerClass");
markerStyle = (String)uiMsg.getAttributes().get("fatalMarkerStyle");
@@ -138,8 +169,8 @@
}else if(facesMsg.getSeverity() == FacesMessage.SEVERITY_WARN){
- divClass = (String)uiMsg.getAttributes().get("warnClass");
- divStyle = (String)uiMsg.getAttributes().get("warnStyle");
+ tableClass = (String)uiMsg.getAttributes().get("warnClass");
+ tableStyle = (String)uiMsg.getAttributes().get("warnStyle");
markerClass = (String)uiMsg.getAttributes().get("warnMarkerClass");
markerStyle = (String)uiMsg.getAttributes().get("warnMarkerStyle");
@@ -151,8 +182,8 @@
}else if(facesMsg.getSeverity() == FacesMessage.SEVERITY_INFO){
- divClass = (String)uiMsg.getAttributes().get("infoClass");
- divStyle = (String)uiMsg.getAttributes().get("infoStyle");
+ tableClass = (String)uiMsg.getAttributes().get("infoClass");
+ tableStyle = (String)uiMsg.getAttributes().get("infoStyle");
markerClass = (String)uiMsg.getAttributes().get("infoMarkerClass");
markerStyle = (String)uiMsg.getAttributes().get("infoMarkerStyle");
@@ -171,22 +202,20 @@
messageTemplate = getMessageTemplate();
ComponentVariables variables = ComponentsVariableResolver.getVariables(messageTemplate,
uiMsg);
- variables.setVariable("divClass", divClass);
- variables.setVariable("divStyle", divStyle);
+ variables.setVariable("divClass", tableClass);
+ variables.setVariable("divStyle", tableStyle);
if(markerLocation.equals(uiMsg.MARKER_LOCATION_LEFT)){
renderMarkerFacet(uiMsg,markerFacet,context, writer, markerClass, markerStyle);
renderLabel(uiMsg, facesMsg, context, writer, labelClass,
- labelStyle, isTooltip, showDetail,showSummary);
+ labelStyle, isTooltip, showDetail,showSummary,null,false);
}else if(markerLocation.equals(uiMsg.MARKER_LOCATION_RIGHT)){
renderLabel(uiMsg, facesMsg, context, writer, labelClass,
- labelStyle, isTooltip, showDetail, showSummary);
+ labelStyle, isTooltip, showDetail, showSummary,null,false);
renderMarkerFacet(uiMsg,markerFacet,context, writer, markerClass, markerStyle);
}
-
- doEncodeEnd(writer, context, uiMsg);
}
protected void renderMarkerFacet(UIRichMessage uiMsg, UIComponent marker, FacesContext
context, ResponseWriter writer, String markerClass, String markerStyle) throws
IOException{
@@ -195,27 +224,38 @@
return;
}
- writer.startElement(HTML.SPAN_ELEM, uiMsg);
+ writer.startElement(HTML.td_ELEM, uiMsg);
String classes = markerClass == null ? "rich-message-marker" :
"rich-message-marker " + markerClass;
getUtils().writeAttribute(writer, HTML.class_ATTRIBUTE, classes);
getUtils().writeAttribute(writer, HTML.style_ATTRIBUTE, markerStyle);
+
renderChild(context, marker);
- writer.endElement(HTML.SPAN_ELEM);
+
+ writer.endElement(HTML.td_ELEM);
}
protected void renderLabel(UIRichMessage uiMsg, FacesMessage msg, FacesContext context,
ResponseWriter writer, String labelClass, String labelStyle,
- boolean isTooltip, boolean showDetail, boolean showSummary) throws
IOException{
+ boolean isTooltip, boolean showDetail, boolean showSummary,
+ String passLabel, boolean isPassLabel) throws IOException{
- String summary = (null != (summary = msg.getSummary())) ? summary : "";
- String detail = (null != (detail = msg.getDetail())) ? detail : "";
+ String summary = null;
+
+ String detail = null;
+
+ if(msg != null){
+ summary = (null != (summary = msg.getSummary())) ? summary : "";
+ detail = (null != (detail = msg.getDetail())) ? detail : "";
+ }
String classes = labelClass == null ? "rich-message-label" :
"rich-message-label " + labelClass;
+ writer.startElement(HTML.td_ELEM, uiMsg);
writer.startElement(HTML.SPAN_ELEM, uiMsg);
+
getUtils().writeAttribute(writer, HTML.class_ATTRIBUTE,classes);
getUtils().writeAttribute(writer, HTML.style_ATTRIBUTE, labelStyle);
@@ -233,7 +273,14 @@
writer.writeText("\t", null);
}
- writer.endElement(HTML.SPAN_ELEM);
+ if(isPassLabel){
+ writer.writeText(passLabel, null);
+ writer.writeText("\t", null);
+ }
+
+ writer.endElement(HTML.SPAN_ELEM);
+ writer.endElement(HTML.td_ELEM);
+
}
protected Iterator getMessageIterator(FacesContext context, String forClientId,
UIComponent component){
Modified:
trunk/sandbox/ui/message/src/main/resources/org/richfaces/renderkit/html/css/msg.css
===================================================================
---
trunk/sandbox/ui/message/src/main/resources/org/richfaces/renderkit/html/css/msg.css 2007-07-20
15:04:22 UTC (rev 1740)
+++
trunk/sandbox/ui/message/src/main/resources/org/richfaces/renderkit/html/css/msg.css 2007-07-20
15:06:10 UTC (rev 1741)
@@ -1,18 +1,8 @@
.rich-message-marker{
- background-image : url(1.GIF);
- background-repeat: no-repeat;
- background-position: left center;
}
.rich-message{
-
}
.rich-message-label{
-
-
}
-
-.dr-msg-img{
- vertical-align: text-bottom;
-}
\ No newline at end of file
Modified: trunk/sandbox/ui/message/src/main/templates/org/richfaces/message.jspx
===================================================================
--- trunk/sandbox/ui/message/src/main/templates/org/richfaces/message.jspx 2007-07-20
15:04:22 UTC (rev 1740)
+++ trunk/sandbox/ui/message/src/main/templates/org/richfaces/message.jspx 2007-07-20
15:06:10 UTC (rev 1741)
@@ -16,11 +16,14 @@
</h:styles>
<f:clientId var="clientId" />
-
- <div id="#{clientId}" class="rich-message #{divClass}"
style="#{component.attributes['style']} #{divStyle}">
- <span class="dr-msg-img">
- <vcp:body/>
- </span>
- </div>
+
+ <table id="#{clientId}" border="0" cellpadding="0"
cellspacing="0" style="#{component.attributes['style']}
#{divStyle}" class="rich-message #{divClass}">
+ <tbody>
+ <tr>
+ <vcp:body/>
+ </tr>
+ </tbody>
+ </table>
+
</f:root>
\ No newline at end of file