[richfaces-svn-commits] JBoss Rich Faces SVN: r12053 - trunk/ui/message/src/main/java/org/richfaces/component.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Mon Dec 29 18:35:58 EST 2008
Author: alexsmirnov
Date: 2008-12-29 18:35:58 -0500 (Mon, 29 Dec 2008)
New Revision: 12053
Modified:
trunk/ui/message/src/main/java/org/richfaces/component/UIRichMessages.java
Log:
https://jira.jboss.org/jira/browse/RF-5482
Modified: trunk/ui/message/src/main/java/org/richfaces/component/UIRichMessages.java
===================================================================
--- trunk/ui/message/src/main/java/org/richfaces/component/UIRichMessages.java 2008-12-29 19:24:34 UTC (rev 12052)
+++ trunk/ui/message/src/main/java/org/richfaces/component/UIRichMessages.java 2008-12-29 23:35:58 UTC (rev 12053)
@@ -48,9 +48,9 @@
*/
public abstract class UIRichMessages extends UIMessages implements AjaxOutput {
- public static final String COMPONENT_TYPE = "org.richfaces.component.RichMessages";
+ public static final String COMPONENT_TYPE = "org.richfaces.component.RichMessages";
- private String forVal = null;
+ private String forVal = null;
private boolean updated = false;
private List<FacesMessageWithId> renderedMessages;
@@ -127,8 +127,8 @@
}
}
;
- final Iterator<FacesMessageWithId> iterator = this
- .renderedMessages.iterator();
+ final Iterator<FacesMessageWithId> iterator = this.renderedMessages
+ .iterator();
return new Iterator<FacesMessage>() {
public boolean hasNext() {
@@ -153,7 +153,8 @@
.iterator();
while (renderedMessageIterator.hasNext()) {
String clientId = renderedMessageIterator.next().getClientId();
- if ((null == forId && null == clientId) || (null != forId && forId.equals(clientId))) {
+ if ((null == forId && null == clientId)
+ || (null != forId && forId.equals(clientId))) {
renderedMessageIterator.remove();
}
}
@@ -174,8 +175,7 @@
FacesMessage message = messages.next();
if (severenities.size() == 0 || severenities.contains("ALL")
|| isApplicableMessage(severenities, message)) {
- renderedMessages.add(
- new FacesMessageWithId(forId, message));
+ renderedMessages.add(new FacesMessageWithId(forId, message));
}
}
}
@@ -193,7 +193,7 @@
Severity severity = message.getSeverity();
for (Object key : FacesMessage.VALUES_MAP.keySet()) {
Severity sev = (Severity) FacesMessage.VALUES_MAP.get(key);
- if(0 == sev.compareTo(severity)){
+ if (0 == sev.compareTo(severity)) {
return severenities.contains(key);
}
}
@@ -264,11 +264,10 @@
*
*/
@SuppressWarnings("serial")
- public static class FacesMessageWithId implements
- Serializable {
+ public static class FacesMessageWithId implements Serializable {
private FacesMessage message;
- private final String clientId;
+ private String clientId;
/**
* @param clientId
@@ -292,10 +291,39 @@
public String getClientId() {
return clientId;
}
-
-
-
+ /**
+ * <p>
+ * Persist {@link FacesMessageWithId} artifacts,
+ * including the non serializable <code>Severity</code>.
+ * </p>
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.writeUTF(clientId);
+ out.writeInt(message.getSeverity().getOrdinal());
+ out.writeUTF(message.getSummary());
+ out.writeUTF(message.getDetail());
+ }
+
+ /**
+ * <p>
+ * Reconstruct {@link FacesMessageWithId} from
+ * serialized artifacts.
+ * </p>
+ */
+ private void readObject(ObjectInputStream in) throws IOException,
+ ClassNotFoundException {
+ clientId = in.readUTF();
+ Severity severity = FacesMessage.SEVERITY_INFO;
+ int ordinal = in.readInt();
+ if (ordinal >= 0 && ordinal < FacesMessage.VALUES.size()) {
+ severity = (Severity) FacesMessage.VALUES.get(ordinal);
+ }
+ String summary = in.readUTF();
+ String detail = in.readUTF();
+ message = new FacesMessage(severity, summary, detail);
+ }
+
}
/**
More information about the richfaces-svn-commits
mailing list