Author: abelevich
Date: 2007-08-03 08:38:23 -0400 (Fri, 03 Aug 2007)
New Revision: 2044
Modified:
trunk/samples/rich-message-demo/src/main/java/org/richfaces/demo/SelectValidator.java
trunk/samples/rich-message-demo/src/main/webapp/pages/message-demo.xhtml
Log:
fix demo
Modified:
trunk/samples/rich-message-demo/src/main/java/org/richfaces/demo/SelectValidator.java
===================================================================
---
trunk/samples/rich-message-demo/src/main/java/org/richfaces/demo/SelectValidator.java 2007-08-03
08:14:27 UTC (rev 2043)
+++
trunk/samples/rich-message-demo/src/main/java/org/richfaces/demo/SelectValidator.java 2007-08-03
12:38:23 UTC (rev 2044)
@@ -16,12 +16,12 @@
String selectedValue = (String) value;
String clientId = component.getClientId(context);
-
+ int componentNum = componentNum(component.getId());
if(selectedValue.equals("warn")){
FacesMessage message = new FacesMessage();
- message.setSummary("warning SUMMARY");
- message.setDetail("warning DETAIL");
+ message.setSummary("warning SUMMARY for: " + componentNum + "
input");
+ message.setDetail("warning DETAIL for: " + componentNum + "
input");
message.setSeverity(FacesMessage.SEVERITY_WARN);
context.addMessage(clientId, message);
@@ -29,8 +29,8 @@
}else if(selectedValue.equals("error")){
FacesMessage message = new FacesMessage();
- message.setSummary("error SUMMARY");
- message.setDetail("error DETAIL");
+ message.setSummary("error SUMMARY for: " + componentNum + "
input");
+ message.setDetail("error DETAIL for: " + componentNum + "
input");
message.setSeverity(FacesMessage.SEVERITY_ERROR);
context.addMessage(clientId, message);
@@ -38,8 +38,8 @@
}else if(selectedValue.equals("info")){
FacesMessage message = new FacesMessage();
- message.setSummary("info SUMMARY");
- message.setDetail("info DETAIL");
+ message.setSummary("info SUMMARY for: " + componentNum + "
input");
+ message.setDetail("info DETAIL for: " + componentNum + " input");
message.setSeverity(FacesMessage.SEVERITY_INFO);
context.addMessage(clientId, message);
@@ -47,12 +47,26 @@
}else if(selectedValue.equals("fatal")){
FacesMessage message = new FacesMessage();
- message.setSummary("fatal SUMMARY");
- message.setDetail("fatal DETAIL");
+ message.setSummary("fatal SUMMARY for: " + componentNum + "
input");
+ message.setDetail("fatal DETAIL for:" + componentNum + " input");
message.setSeverity(FacesMessage.SEVERITY_FATAL);
context.addMessage(clientId, message);
}
}
-
+
+ public int componentNum(String baseId){
+
+ if(baseId.endsWith("1")){
+ return 1;
+ }else if(baseId.endsWith("2")){
+ return 2;
+ }else if (baseId.endsWith("3")){
+ return 3;
+ }else if(baseId.endsWith("4")){
+ return 4;
+ }
+
+ return -1;
+ }
}
Modified: trunk/samples/rich-message-demo/src/main/webapp/pages/message-demo.xhtml
===================================================================
--- trunk/samples/rich-message-demo/src/main/webapp/pages/message-demo.xhtml 2007-08-03
08:14:27 UTC (rev 2043)
+++ trunk/samples/rich-message-demo/src/main/webapp/pages/message-demo.xhtml 2007-08-03
12:38:23 UTC (rev 2044)
@@ -12,9 +12,9 @@
<h:form>
- <table>
- <tbody>
- <tr>
+ <table cellpadding="2" cellspacing="2">
+ <tr>
+ <td> <h:outputText value="1."/> </td>
<td>
<h:selectOneMenu id="select1" value="">
<f:selectItem itemValue="error"
itemLabel="error"/>
@@ -27,6 +27,7 @@
</td>
</tr>
<tr>
+ <td> <h:outputText value="2."/> </td>
<td>
<h:selectOneMenu id="select2" value="">
<f:selectItem itemValue="error"
itemLabel="error"/>
@@ -40,6 +41,7 @@
</tr>
<tr>
+ <td> <h:outputText value="3."/> </td>
<td>
<h:selectOneMenu id="select3" value="">
<f:selectItem itemValue="error"
itemLabel="error"/>
@@ -51,8 +53,9 @@
</h:selectOneMenu>
</td>
</tr>
-
+
<tr>
+ <td> <h:outputText value="4."/> </td>
<td>
<h:selectOneMenu id="select4" value="">
<f:selectItem itemValue="error"
itemLabel="error"/>
@@ -64,11 +67,13 @@
</h:selectOneMenu>
</td>
</tr>
-
- <tr>
- <td> <h:outputText value="Rich Message Demo"/>
</td>
- </tr>
-
+ </table>
+
+ <table>
+ <tr>
+ <td> <h:outputText value="Rich Message Demo"/>
</td>
+ </tr>
+
<tr>
<td>
<r:message for="select1"
@@ -106,44 +111,42 @@
</r:message>
</td>
</tr>
-
- </tbody>
- </table>
+ </table>
<table>
<tr>
- <td>
- <h:outputText value="Rich Messages Demo"/>
- </td>
- </tr>
-
- <tr>
- <td>
- <r:messages layout="list"
- tooltip="true"
- showDetail="false"
- showSummary="true"
- passedLabel="No Error"
- errorLabelClass="errorLabel"
- fatalLabelClass="warnLabel"
- infoLabelClass="infoLabel"
- warnLabelClass="fatalLabel"
- warnMarkerClass="markerWarn"
- infoMarkerClass="markerInfo"
- errorMarkerClass="markerError"
- fatalMarkerClass="markerFatal"
- errorClass="errorClass"
- fatalClass="fatalClass"
- warnClass="warnClass"
- infoClass="infoClass"
- labelClass="labelClass"
- var="messages"
- styleClass="class"
- >
- <f:facet name="errorMarker">
- <h:graphicImage url="/image/error.gif"/>
- </f:facet>
+ <td>
+ <h:outputText value="Rich Messages Demo"/>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <r:messages layout="table"
+ tooltip="true"
+ showDetail="false"
+ showSummary="true"
+ passedLabel="No Error"
+ errorLabelClass="errorLabel"
+ fatalLabelClass="warnLabel"
+ infoLabelClass="infoLabel"
+ warnLabelClass="fatalLabel"
+ warnMarkerClass="markerWarn"
+ infoMarkerClass="markerInfo"
+ errorMarkerClass="markerError"
+ fatalMarkerClass="markerFatal"
+ errorClass="errorClass"
+ fatalClass="fatalClass"
+ warnClass="warnClass"
+ infoClass="infoClass"
+ labelClass="labelClass"
+ var="messages"
+ styleClass="class"
+ >
+ <f:facet name="errorMarker">
+ <h:graphicImage url="/image/error.gif"/>
+ </f:facet>
<f:facet name="fatalMarker">
<h:graphicImage url="/image/fatal.gif"/>
</f:facet>
@@ -157,9 +160,9 @@
<h:graphicImage url="/image/passed.gif"/>
</f:facet>
<h:outputText value="#{messages.summary}">
</h:outputText>
- </r:messages>
- </td>
- </tr>
+ </r:messages>
+ </td>
+ </tr>
</table>
<div>
Show replies by date