Author: abelevich
Date: 2008-07-07 13:35:57 -0400 (Mon, 07 Jul 2008)
New Revision: 9433
Modified:
trunk/ui/toolBar/src/main/java/org/richfaces/renderkit/html/ToolBarRendererBase.java
Log:
http://jira.jboss.com/jira/browse/RF-3811
Modified:
trunk/ui/toolBar/src/main/java/org/richfaces/renderkit/html/ToolBarRendererBase.java
===================================================================
---
trunk/ui/toolBar/src/main/java/org/richfaces/renderkit/html/ToolBarRendererBase.java 2008-07-07
15:39:11 UTC (rev 9432)
+++
trunk/ui/toolBar/src/main/java/org/richfaces/renderkit/html/ToolBarRendererBase.java 2008-07-07
17:35:57 UTC (rev 9433)
@@ -23,12 +23,10 @@
import java.io.IOException;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -69,7 +67,7 @@
contentClass = "";
}
if (null == contentStyle) {
- contentClass = "";
+ contentStyle = "";
}
if (children != null) {
@@ -95,12 +93,13 @@
ResponseWriter writer = facesContext.getResponseWriter();
for (Iterator<UIComponent> it = childrenToTheLeft.iterator(); it.hasNext();)
{
UIComponent child = it.next();
+
if (! (child instanceof UIToolBarGroup)) {
writer.startElement(HTML.td_ELEM, component);
writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-toolbar-int rich-toolbar-item
" + contentClass, null);
getUtils().writeAttribute(writer, HTML.style_ATTRIBUTE, contentStyle);
- encodeEventsAttributes(facesContext, child, writer);
- }
+ encodeEventsAttributes(facesContext, toolBar, writer);
+ }
renderChild(facesContext, child);
if (! (child instanceof UIToolBarGroup)) {
writer.endElement(HTML.td_ELEM);
@@ -195,24 +194,17 @@
protected void encodeEventsAttributes(FacesContext facesContext, UIComponent component,
ResponseWriter writer)
throws IOException {
- Map<String, Object> attributes = getParentToolBar(component).getAttributes();
- Set<String> encodedAttributes = new HashSet<String>();
-
+
+ UIToolBar toolbar = getParentToolBar(component);
+ Map<String, Object> attributes = toolbar.getAttributes();
+
for (int i = 0; i < ON_ITEM_EVENTS.length; i++) {
Object value = attributes.get(ON_ITEM_EVENTS[i]);
if (null != value && !"".equals(value)) {
String eventName = ON_ITEM_EVENTS[i].replace("item", "");
- encodedAttributes.add(eventName);
- Object selfEvent = component.getAttributes().get(eventName);
- if (null == selfEvent) {
- selfEvent = "";
- }
- writer.writeAttribute(eventName, selfEvent + ";" + value, null);
+ getUtils().writeAttribute(writer, eventName, value);
}
}
- encodedAttributes.add(HTML.class_ATTRIBUTE);
- encodedAttributes.add(HTML.style_ATTRIBUTE);
- getUtils().encodePassThruWithExclusionsArray(facesContext, component,
encodedAttributes.toArray());
}
public UIToolBar getParentToolBar(UIComponent component) {