[seam-commits] Seam SVN: r9147 - trunk/ui/src/main/java/org/jboss/seam/ui/renderkit.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Mon Sep 29 08:44:49 EDT 2008
Author: nickarls
Date: 2008-09-29 08:44:49 -0400 (Mon, 29 Sep 2008)
New Revision: 9147
Modified:
trunk/ui/src/main/java/org/jboss/seam/ui/renderkit/DecorateRendererBase.java
Log:
JBSEAM-3471, more generic context store/restore
Modified: trunk/ui/src/main/java/org/jboss/seam/ui/renderkit/DecorateRendererBase.java
===================================================================
--- trunk/ui/src/main/java/org/jboss/seam/ui/renderkit/DecorateRendererBase.java 2008-09-29 12:36:36 UTC (rev 9146)
+++ trunk/ui/src/main/java/org/jboss/seam/ui/renderkit/DecorateRendererBase.java 2008-09-29 12:44:49 UTC (rev 9147)
@@ -8,6 +8,7 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
+import org.jboss.seam.contexts.Context;
import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.ui.component.UIDecorate;
import org.jboss.seam.ui.util.Decoration;
@@ -31,14 +32,15 @@
* Store away the attribute from the event context (if it is set)
*
* @param names The list of context keys to store away
+ * @param context The context to target
*/
- private void storeOriginalValues(String[] names)
+ private void storeOriginalValues(String[] names, Context context)
{
for (String name : names)
{
- if (Contexts.getEventContext().isSet(name))
+ if (context.isSet(name))
{
- originalValues.put(name, Contexts.getEventContext().get(name));
+ originalValues.put(name, context.get(name));
}
}
}
@@ -49,13 +51,14 @@
* up what we have placed there during this run.
*
* @param names The list of context keys to restore
+ * @param context The context to target
*/
- private void restoreOriginalValues(String[] names) {
+ private void restoreOriginalValues(String[] names, Context context) {
for (String name : names) {
if (originalValues.containsKey(name)) {
- Contexts.getEventContext().set(name, originalValues.get(name));
+ context.set(name, originalValues.get(name));
} else {
- Contexts.getEventContext().remove(name);
+ context.remove(name);
}
}
}
@@ -65,7 +68,7 @@
{
UIDecorate decorate = (UIDecorate) component;
- storeOriginalValues(storeOriginals);
+ storeOriginalValues(storeOriginals, Contexts.getEventContext());
Contexts.getEventContext().set("invalid", Decoration.hasMessage(decorate, context));
Contexts.getEventContext().set("required", Decoration.hasRequired(component, context));
@@ -117,7 +120,7 @@
}
context.getResponseWriter().endElement("div");
- restoreOriginalValues(storeOriginals);
+ restoreOriginalValues(storeOriginals, Contexts.getEventContext());
}
@Override
More information about the seam-commits
mailing list