From 3b2d8b3cc7b732a83f6584275c48b82f54bd06b6 Mon Sep 17 00:00:00 2001 From: Johann Werner Date: Thu, 12 Jul 2012 17:46:14 +0200 Subject: [PATCH] add utility method to append all associations as HTML attributes except those for given keys --- .../components/ERXComponentUtilities.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Frameworks/Core/ERExtensions/Sources/er/extensions/components/ERXComponentUtilities.java b/Frameworks/Core/ERExtensions/Sources/er/extensions/components/ERXComponentUtilities.java index daabc0818cb..b57d18a803e 100644 --- a/Frameworks/Core/ERExtensions/Sources/er/extensions/components/ERXComponentUtilities.java +++ b/Frameworks/Core/ERExtensions/Sources/er/extensions/components/ERXComponentUtilities.java @@ -335,6 +335,30 @@ public static void appendHtmlAttributes(NSDictionary asso ERXComponentUtilities.appendHtmlAttribute(key, association, response, component); } } + + /** + * Appends a dictionary of associations as HTML attributes. + * + * @param associations + * the associations dictionary + * @param excludeKeys + * the associations to ignore + * @param response + * the response to write to + * @param component + * the component to evaluate the associations within + */ + public static void appendHtmlAttributes(NSDictionary associations, NSArray excludeKeys, WOResponse response, WOComponent component) { + if (excludeKeys == null) { + excludeKeys = NSArray.EmptyArray; + } + for (String key : associations.allKeys()) { + if (!excludeKeys.contains(key)) { + WOAssociation association = associations.objectForKey(key); + ERXComponentUtilities.appendHtmlAttribute(key, association, response, component); + } + } + } /** * Appends an association as an HTML attribute.