Author: sergeyhalipov
Date: 2008-03-31 10:26:50 -0400 (Mon, 31 Mar 2008)
New Revision: 7467
Modified:
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java
Log:
http://jira.jboss.com/jira/browse/RF-2372
Modified:
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java
===================================================================
---
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java 2008-03-31
13:24:37 UTC (rev 7466)
+++
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java 2008-03-31
14:26:50 UTC (rev 7467)
@@ -34,6 +34,7 @@
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.resource.InternetResource;
import org.richfaces.component.UIMenuGroup;
import org.richfaces.component.UIMenuItem;
@@ -141,35 +142,45 @@
public void processLayer(FacesContext context, UIComponent layer, String width) throws
IOException {
String clientId = layer.getClientId(context);
+
+ Object style = layer.getAttributes().get(HTML.style_ATTRIBUTE);
+ Object styleClass = layer.getAttributes().get(HTML.STYLE_CLASS_ATTR);
+
+ if (null == style) {
+ style = "";
+ }
+ if (null == styleClass) {
+ styleClass = "";
+ }
ResponseWriter writer = context.getResponseWriter();
- writer.startElement("div", layer);
- writer.writeAttribute("id", clientId+"_menu", null);
- writer.writeAttribute("class", "dr-menu-list-border
rich-menu-list-border", null);
- writer.writeAttribute("style", "visibility: hidden; z-index: 2; ",
null);
- writer.startElement("div", layer);
- writer.writeAttribute("class", "dr-menu-list-bg rich-menu-list-bg",
null);
+ writer.startElement(HTML.DIV_ELEM, layer);
+ writer.writeAttribute(HTML.id_ATTRIBUTE, clientId+"_menu", null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-menu-list-border
rich-menu-list-border " + styleClass, null);
+ writer.writeAttribute(HTML.style_ATTRIBUTE, "visibility: hidden; z-index: 2;
" + style, null);
+ writer.startElement(HTML.DIV_ELEM, layer);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-menu-list-bg
rich-menu-list-bg", null);
encodeItems(context, layer);
- writer.startElement("div", layer);
- writer.writeAttribute("class", "dr-menu-list-strut
rich-menu-list-strut", null);
- writer.startElement("div", layer);
- writer.writeAttribute("class", "dr-menu-list-strut
rich-menu-list-strut", null);
- writer.writeAttribute("width", "1", null);
- writer.writeAttribute("height", "1", null);
- writer.writeAttribute("style", width!=null && width.length() > 0 ?
"width: " + HtmlUtil.qualifySize(width) : "", null);
+ writer.startElement(HTML.DIV_ELEM, layer);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-menu-list-strut
rich-menu-list-strut", null);
+ writer.startElement(HTML.DIV_ELEM, layer);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-menu-list-strut
rich-menu-list-strut", null);
+ writer.writeAttribute(HTML.width_ATTRIBUTE, "1", null);
+ writer.writeAttribute(HTML.height_ATTRIBUTE, "1", null);
+ writer.writeAttribute(HTML.style_ATTRIBUTE, width!=null && width.length() >
0 ? "width: " + HtmlUtil.qualifySize(width) : "", null);
writer.write(" ");
- writer.endElement("div");
- writer.endElement("div");
+ writer.endElement(HTML.DIV_ELEM);
+ writer.endElement(HTML.DIV_ELEM);
- writer.endElement("div");
- writer.endElement("div");
+ writer.endElement(HTML.DIV_ELEM);
+ writer.endElement(HTML.DIV_ELEM);
- writer.startElement("script", layer);
- writer.writeAttribute("id", clientId+"_menu_script", null);
- writer.writeAttribute("type", "text/javascript", null);
+ writer.startElement(HTML.SCRIPT_ELEM, layer);
+ writer.writeAttribute(HTML.id_ATTRIBUTE, clientId+"_menu_script", null);
+ writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
encodeScript(context, layer);
- writer.endElement("script");
+ writer.endElement(HTML.SCRIPT_ELEM);
AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
Set renderedAreas = ajaxContext.getAjaxRenderedAreas();