Author: Alex.Kolonitsky
Date: 2010-12-03 09:06:43 -0500 (Fri, 03 Dec 2010)
New Revision: 20347
Modified:
trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml
trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance.xhtml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xhtml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xmlunit.xml
Log:
RF-9317 - panelMenu components
item label
Modified: trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml 2010-12-03 14:03:01
UTC (rev 20346)
+++ trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml 2010-12-03 14:06:43
UTC (rev 20347)
@@ -64,9 +64,9 @@
<pn:panelMenuGroup label="Group 1">
- <pn:panelMenuItem label="Item 1.1" />
- <pn:panelMenuItem label="Item 1.2" />
- <pn:panelMenuItem label="Item 1.3" />
+ <pn:panelMenuItem>Item 1.1</pn:panelMenuItem>
+ <pn:panelMenuItem>Item 1.2</pn:panelMenuItem>
+ <pn:panelMenuItem>Item 1.3</pn:panelMenuItem>
</pn:panelMenuGroup>
<pn:panelMenuGroup
label="Group 2"
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java 2010-12-03
14:03:01 UTC (rev 20346)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java 2010-12-03
14:06:43 UTC (rev 20347)
@@ -53,7 +53,7 @@
}
public String getLabel() {
- return (String) getStateHelper().eval(PropertyKeys.label, getName());
+ return (String) getStateHelper().eval(PropertyKeys.label);
}
public void setLabel(String label) {
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2010-12-03
14:03:01 UTC (rev 20346)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2010-12-03
14:06:43 UTC (rev 20347)
@@ -122,7 +122,7 @@
writer.startElement("td", null);
writer.writeAttribute("class", classPrefix + "-lbl", null);
- writer.writeText(menuItem.getLabel(), null);
+ writer.writeText(String.valueOf(menuItem.getLabel()), null);
writer.endElement("td");
encodeHeaderGroupIconRight(writer, context, menuItem, classPrefix);
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2010-12-03
14:03:01 UTC (rev 20346)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2010-12-03
14:06:43 UTC (rev 20347)
@@ -57,10 +57,10 @@
super.doEncodeBegin(writer, context, component);
HtmlPanelMenuItem menuItem = (HtmlPanelMenuItem) component;
- encodeHeaderGroup(writer, context, menuItem, menuItem.isTopItem() ?
TOP_CSS_CLASS_PREFIX : CSS_CLASS_PREFIX);
+ encodeHeaderGroupBegin(writer, context, menuItem, getCssClass(menuItem,
""));
}
- private void encodeHeaderGroup(ResponseWriter writer, FacesContext context,
HtmlPanelMenuItem menuItem, String classPrefix) throws IOException {
+ private void encodeHeaderGroupBegin(ResponseWriter writer, FacesContext context,
HtmlPanelMenuItem menuItem, String classPrefix) throws IOException {
writer.startElement("table", null);
writer.writeAttribute("class", classPrefix + "-gr", null);
writer.startElement("tr", null);
@@ -69,7 +69,14 @@
writer.startElement("td", null);
writer.writeAttribute("class", classPrefix + "-lbl", null);
- writer.writeText(menuItem.getLabel(), null);
+
+ String label = menuItem.getLabel();
+ if (label != null) {
+ writer.writeText(label, null);
+ }
+ }
+
+ private void encodeHeaderGroupEnd(ResponseWriter writer, FacesContext context,
HtmlPanelMenuItem menuItem, String classPrefix) throws IOException {
writer.endElement("td");
encodeHeaderGroupRightIcon(writer, context, menuItem, classPrefix);
@@ -148,6 +155,9 @@
@Override
protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException {
+ HtmlPanelMenuItem menuItem = (HtmlPanelMenuItem) component;
+ encodeHeaderGroupEnd(writer, context, menuItem, getCssClass(menuItem,
""));
+
super.doEncodeEnd(writer, context, component);
}
Modified:
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance.xhtml
===================================================================
---
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance.xhtml 2010-12-03
14:03:01 UTC (rev 20346)
+++
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance.xhtml 2010-12-03
14:06:43 UTC (rev 20347)
@@ -77,13 +77,13 @@
<pn:panelMenuGroup
id="panelMenuGroup-top"></pn:panelMenuGroup>
<pn:panelMenuGroup id="panelMenuGroup-topDis"
disabled="true"></pn:panelMenuGroup>
- <pn:panelMenuItem
id="panelMenuItem-top"></pn:panelMenuItem>
- <pn:panelMenuItem id="panelMenuItem-topDis"
disabled="true"></pn:panelMenuItem>
+ <pn:panelMenuItem
id="panelMenuItem-top">Hello</pn:panelMenuItem>
+ <pn:panelMenuItem id="panelMenuItem-topDis"
disabled="true">Hello</pn:panelMenuItem>
<pn:panelMenuGroup>
<pn:panelMenuGroup
id="panelMenuGroup"></pn:panelMenuGroup>
<pn:panelMenuGroup id="panelMenuGroup-dis"
disabled="true"></pn:panelMenuGroup>
- <pn:panelMenuItem
id="panelMenuItem"></pn:panelMenuItem>
- <pn:panelMenuItem id="panelMenuItem-dis"
disabled="true"></pn:panelMenuItem>
+ <pn:panelMenuItem
id="panelMenuItem">Hello</pn:panelMenuItem>
+ <pn:panelMenuItem id="panelMenuItem-dis"
disabled="true">Hello</pn:panelMenuItem>
</pn:panelMenuGroup>
</pn:panelMenu>
</h:form>
Modified:
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xhtml
===================================================================
---
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xhtml 2010-12-03
14:03:01 UTC (rev 20346)
+++
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xhtml 2010-12-03
14:06:43 UTC (rev 20347)
@@ -40,7 +40,7 @@
<pn:panelMenu>
<pn:panelMenuGroup>
<pn:panelMenuItem id="panelMenuItem">
- <!-- TODO -->
+ My MY Item
</pn:panelMenuItem>
</pn:panelMenuGroup>
</pn:panelMenu>
Modified:
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xmlunit.xml
===================================================================
---
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xmlunit.xml 2010-12-03
14:03:01 UTC (rev 20346)
+++
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xmlunit.xml 2010-12-03
14:06:43 UTC (rev 20347)
@@ -3,7 +3,7 @@
<tbody>
<tr>
<td class="rf-pm-itm-ico rf-pm-none"></td>
- <td class="rf-pm-itm-lbl">panelMenuItem</td>
+ <td class="rf-pm-itm-lbl">My MY Item</td>
<td class="rf-pm-itm-exp-ico rf-pm-none"></td>
</tr>
</tbody>