Author: sergeyhalipov
Date: 2007-06-15 08:35:29 -0400 (Fri, 15 Jun 2007)
New Revision: 1200
Modified:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java
trunk/sandbox/panelmenu/src/main/resources/org/richfaces/renderkit/html/css/panelMenu.xcss
trunk/sandbox/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js
trunk/sandbox/panelmenu/src/main/templates/org/richfaces/htmlPanelMenu.jspx
trunk/sandbox/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx
trunk/sandbox/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx
trunk/sandbox/panelmenu/src/test/java/org/richfaces/component/PanelMenuComponentTest.java
Log:
Change panel-menu L&F to be compatible with design prototype.
Modified:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java 2007-06-15
11:59:47 UTC (rev 1199)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java 2007-06-15
12:35:29 UTC (rev 1200)
@@ -55,7 +55,7 @@
public final static String PANEL_MENU_SPACER_ICON_NAME = "spacer";
- public void insertTDs(FacesContext context , UIComponent component) throws IOException
{
+ public void insertSpacerImages(FacesContext context , UIComponent component) throws
IOException {
ResponseWriter writer = context.getResponseWriter();
int level = calculateLevel(component);
//StringBuffer buffer = new StringBuffer();
@@ -63,7 +63,6 @@
int w = 16; //width(context);
for (int i=0;i<level;i++){
- writer.startElement(HTML.td_ELEM, component);
writer.startElement("img", component);
writer.writeAttribute("src", src, null);
writer.writeAttribute("alt", "", null);
@@ -71,9 +70,7 @@
writer.writeAttribute("vspace", "0", null);
writer.writeAttribute("height", String.valueOf(w), null);
writer.writeAttribute("width", String.valueOf(w), null);
- writer.writeAttribute("style", "display:block; ", null);
writer.endElement("img");
- writer.endElement(HTML.td_ELEM);
}
}
@@ -112,7 +109,7 @@
color = (String) skin.getParameter(context,"panelmenu.itemBulletColor");
}
if(iconType != null && !iconType.equals("none")){
- if (iconType.equals("custom")){
+ if (iconType.equals("custom") || "".equals(iconType)){
source = getResource(PanelMenuIconSpacer.class.getName()).getUri(context, color);
} else if (iconType.equals("spacer")){
source = getResource(PanelMenuIconSpacer.class.getName()).getUri(context, color);
@@ -275,7 +272,7 @@
* @param component
* @throws IOException
*/
- public void drawIcon(ResponseWriter writer, String iconType, String imageSrc,
UIComponent component) throws IOException{
+ public void drawIcon(ResponseWriter writer, String iconType, String imageSrc,
UIComponent component, String id) throws IOException{
if (iconType != null && !iconType.equals("") &&
!iconType.equals("none")){
int h = 16; //width(context);
writer.startElement("img", component);
@@ -283,9 +280,9 @@
writer.writeAttribute("alt", "", null);
writer.writeAttribute("vspace", "0", null);
writer.writeAttribute("hspace", "0", null);
- writer.writeAttribute("style", "display:block; ", null);
writer.writeAttribute("width", String.valueOf(h), null);
writer.writeAttribute("height", String.valueOf(h), null);
+ writer.writeAttribute("id", id, null);
writer.endElement("img");
}
Modified:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2007-06-15
11:59:47 UTC (rev 1199)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2007-06-15
12:35:29 UTC (rev 1200)
@@ -78,15 +78,15 @@
}
if (align.equalsIgnoreCase(from)){
- image(context,component);
+ image(context,component, from + "Icon" + component.getClientId(context));
} else {
String iconType = PANEL_MENU_SPACER_ICON_NAME;
String imageSrc = getIconByType(iconType, isTopLevel, context, component);
- drawIcon(context.getResponseWriter(), iconType, imageSrc, component);
+ drawIcon(context.getResponseWriter(), iconType, imageSrc, component, from +
"Icon" + component.getClientId(context));
}
}
- private void image(FacesContext context, UIComponent component )throws IOException {
+ private void image(FacesContext context, UIComponent component, String id )throws
IOException {
ResponseWriter writer = context.getResponseWriter();
UIPanelMenu panelMenu = findMenu(component);
@@ -160,8 +160,11 @@
icon = defaultIconNodeClosed;
}
}
+
+ if ("".equals(icon))
+ icon = "custom";
String source = getIconByType(icon, isTopLevel, context, component);
- drawIcon(writer, icon, source, component);
+ drawIcon(writer, icon, source, component, id);
}
public String getFullStyleClass(FacesContext context, UIComponent component) {
@@ -259,5 +262,19 @@
return "";
}
+ public String getDivClass(FacesContext context, UIComponent component) {
+ String result = "";
+ if (isTopLevel(component))
+ result = "dr-pmenu-group-div";
+ return result;
+ }
+ public String getTableClass(FacesContext context, UIComponent component) {
+ String result;
+ if (isTopLevel(component))
+ result = "dr-pmenu-top-group";
+ else
+ result = "dr-pmenu-group";
+ return result;
+ }
}
Modified:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2007-06-15
11:59:47 UTC (rev 1199)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2007-06-15
12:35:29 UTC (rev 1200)
@@ -78,15 +78,15 @@
}
if (align.equalsIgnoreCase(from)){
- image(context,component);
+ image(context,component, from);
} else {
String iconType = PANEL_MENU_SPACER_ICON_NAME;
String imageSrc = getIconByType(iconType, isTopLevel, context, component);
- drawIcon(context.getResponseWriter(), iconType, imageSrc, component);
+ drawIcon(context.getResponseWriter(), iconType, imageSrc, component, from +
"Icon" + component.getClientId(context));
}
}
- private void image(FacesContext context, UIComponent component)
+ private void image(FacesContext context, UIComponent component, String from)
throws IOException{
UIPanelMenu panelMenu = findMenu(component);
@@ -130,7 +130,7 @@
} else iconType = customItemIcon;
source = getIconByType(iconType, isTopLevel, context, component);
- drawIcon(writer, iconType, source, component);
+ drawIcon(writer, iconType, source, component, from + "Icon" +
component.getClientId(context));
}
Modified:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java 2007-06-15
11:59:47 UTC (rev 1199)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java 2007-06-15
12:35:29 UTC (rev 1200)
@@ -74,6 +74,7 @@
protected Object getDataToStore(FacesContext context, Object data) {
Object[] stored = new Object[5];
Skin skin = SkinFactory.getInstance().getSkin(context);
+ Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
stored[0] = new Integer(HtmlDimensions.decode("16px").intValue());
@@ -82,7 +83,11 @@
if (data!=null){
col = HtmlColor.decode(data.toString());
} else {
- col = HtmlColor.decode(skin.getParameter(context,
"headerTextColor").toString());
+ String skinParameter = "headerTextColor";
+ String headerTextColor = (String) skin.getParameter(context, skinParameter);
+ if (null == headerTextColor || "".equals(headerTextColor))
+ headerTextColor = (String) defaultSkin.getParameter(context, skinParameter);
+ col = HtmlColor.decode(headerTextColor);
}
stored[1]= col;
return stored;
Modified:
trunk/sandbox/panelmenu/src/main/resources/org/richfaces/renderkit/html/css/panelMenu.xcss
===================================================================
---
trunk/sandbox/panelmenu/src/main/resources/org/richfaces/renderkit/html/css/panelMenu.xcss 2007-06-15
11:59:47 UTC (rev 1199)
+++
trunk/sandbox/panelmenu/src/main/resources/org/richfaces/renderkit/html/css/panelMenu.xcss 2007-06-15
12:35:29 UTC (rev 1200)
@@ -5,78 +5,88 @@
xmlns="http://www.w3.org/1999/xhtml">
<f:verbatim>
- .dr-pmenu-group {
+ .dr-pmenu-top-group {
height: 20px;
background-repeat: repeat-x;
background-position: left top;
+ padding: 2px 1px 2px 2px;
+ cursor: pointer;
}
+ .dr-pmenu-group {
+ padding: 2px 1px 1px;
+ margin-top:1px;
+ cursor:pointer;
+ border-top: 1px solid;
+ }
+
.dr-pmenu-item {
height: 20px;
background-repeat: repeat-x;
background-position: left top;
+ border-top: 1px solid;
+ cursor: pointer;
+ padding: 2px 1px 1px;
+ margin-top: 1px;
}
+ .dr-pmenu-group-div {
+ border: 1px solid;
+ margin-bottom: 3px;
+ padding: 1px;
+ }
+
+ .dr-pmenu-group-self-label {
+ padding-left: 5px;
+ width: 100%;
+ }
+
</f:verbatim>
- <u:selector name=".dr-pmenu-group">
- <u:style name="width" value="100%"/>
- <u:style name="padding" value="0px"/>
- <u:style name="vertical-align" value="middle"/>
- <u:style name="cursor" value="pointer"/>
- <u:style name="text-align" value="left"/>
+ <u:selector name=".dr-pmenu-top-group">
<u:style name="font-weight" skin="headerWeightFont"/>
<u:style name="font-family" skin="headerFamilyFont"/>
<u:style name="font-size" skin="headerSizeFont"/>
<u:style name="color" skin="headerTextColor"/>
- <u:style name="border-style" value="none"/>
- <u:style name="border-color" skin="panelBorderColor"/>
<u:style name="background-color"
skin="headerBackgroundColor"/>
<u:style name="background-image" >
<f:resource
f:key="org.richfaces.renderkit.html.gradientimages.PanelMenuGroupGradient"
/>
</u:style>
</u:selector>
+ <u:selector name=".dr-pmenu-group">
+ <u:style name="font-weight" skin="headerWeightFont"/>
+ <u:style name="font-family" skin="headerFamilyFont"/>
+ <u:style name="font-size" skin="headerSizeFont"/>
+ <u:style name="color" skin="generalTextColor"/>
+ <u:style name="border-top-color" skin="tableBorderColor"/>
+ </u:selector>
+
<u:selector name=".dr-pmenu-item">
- <u:style name="width" value="100%"/>
- <u:style name="padding" value="0px"/>
- <u:style name="vertical-align" value="middle"/>
- <u:style name="cursor" value="pointer"/>
- <u:style name="text-align" value="left"/>
<u:style name="font-family" skin="generalFamilyFont"/>
<u:style name="font-weight" skin="generalWeightFont"/>
<u:style name="font-size" skin="generalSizeFont"/>
<u:style name="color" skin="generalTextColor"/>
- <u:style name="border-style" value="none"/>
- <u:style name="border-top-style" value="solid"/>
- <u:style name="border-color" skin="subBorderColor"/>
- <u:style name="background-image" >
- <f:resource
f:key="org.richfaces.renderkit.html.gradientimages.PanelMenuItemGradient" />
- </u:style>
+ <u:style name="border-top-color" skin="tableBorderColor"/>
</u:selector>
- <u:selector name=".dr-pmenu-group-tr">
- <u:style name="background-image" >
- <f:resource
f:key="org.richfaces.renderkit.html.gradientimages.PanelMenuGroupGradient"
/>
- </u:style>
+ <u:selector name=".dr-pmenu-group-div" >
+ <u:style name="border-color" skin="tableBorderColor"/>
</u:selector>
- <u:selector name=".dr-pmenu-item-tr">
- <u:style name="background-image" >
- <f:resource
f:key="org.richfaces.renderkit.html.gradientimages.PanelMenuItemGradient" />
- </u:style>
+ <u:selector name=".dr-pmenu-disabled-element" >
+ <u:style name="color" skin="tabDisabledTextColor"/>
</u:selector>
+ <u:selector name=".dr-pmenu-hovered-element" >
+ <u:style name="background-color"
skin="tabDisabledTextColor"/>
+ </u:selector>
+
<f:verbatim>
.dr-pmenu-disabled-element {
cursor: default;
- color: #c0c0c0;
}
- .dr-pmenu-hovered-element {
- background-color : #c0c0c0;
- }
-
</f:verbatim>
</f:template>
\ No newline at end of file
Modified:
trunk/sandbox/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js
===================================================================
---
trunk/sandbox/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js 2007-06-15
11:59:47 UTC (rev 1199)
+++
trunk/sandbox/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js 2007-06-15
12:35:29 UTC (rev 1200)
@@ -58,11 +58,11 @@
}
parent = parent.parentObj;
}
- this.obj = $(ids.myId);
+ this.obj = $("tdhide" + ids.myId);
this.leftIcon = $('leftIcon' + ids.myId);
this.rightIcon = $('rightIcon' + ids.myId);
this.labelArea = $('icon' + ids.myId);
- this.content = this._getDirectChildrenByTag(this.obj,"TD")[level+1];
+ this.content = document.getElementsByClassName("dr-pmenu-group-self-label",
this.obj)[0];
this.iconAlign = iconAlign;
/*
if (level == 0){
@@ -114,11 +114,11 @@
if
(this.childObj[i]._getDirectChildrenByTag(this.childObj[i].content,"INPUT")[0]!=null){
this.childObj[i]._getDirectChildrenByTag(this.childObj[i].content,"INPUT")[0].value="";}
if (this.haveDynamicIcon){
- var img = null
+ var img = null;
if (this.iconAlign=="right"){
- img =
this._getDirectChildrenByTag(this.iconswitcher.nextSibling,"IMG")[0];
+ img = this.rightIcon;
} else {
- img =
this._getDirectChildrenByTag(this.iconswitcher.previousSibling,"IMG")[0];
+ img = this.leftIcon;
}
if (img!=null){
if (this.iconCollapsed!="none"){
@@ -132,8 +132,8 @@
}
this.childObj[i].collapse();
this.childObj[i].hide();
- this.childObj[i].tdhider.style.display="none";
- this.childObj[i].tablehider.style.display="none";
+ //this.childObj[i].tdhider.style.display="none";
+ //this.childObj[i].tablehider.style.display="none";
}
}
this.expanded = false;
@@ -156,9 +156,9 @@
if (this.haveDynamicIcon){
var img = null
if (this.iconAlign=="right"){
- img =
this._getDirectChildrenByTag(this.iconswitcher.nextSibling,"IMG")[0];
+ img = this.rightIcon;
} else {
- img =
this._getDirectChildrenByTag(this.iconswitcher.previousSibling,"IMG")[0];
+ img = this.leftIcon;
}
if (img!=null){
if (this.iconExpanded!="none"){
@@ -285,33 +285,27 @@
addHoverStyles: function(e) {
if(!this.hasInitialSylesChecked){
- this.initialStyles = this.obj.style.cssText;
+ this.initialStyles = this.tablehider.style.cssText;
this.hasInitialSylesChecked = true;
}
if (this.hoveredStyles) {
- Element.setStyle(this.obj, this.hoveredStyles);
+ Element.setStyle(this.tablehider, this.hoveredStyles);
}
if (this.hoveredClasses)
for (i = 0; i < this.hoveredClasses.length; i++) {
- this.obj.addClassName(this.hoveredClasses[i]);
- this.leftIcon.addClassName(this.hoveredClasses[i]);
- this.rightIcon.addClassName(this.hoveredClasses[i]);
- this.labelArea.addClassName(this.hoveredClasses[i]);
+ this.tablehider.addClassName(this.hoveredClasses[i]);
}
},
removeHoverStyles: function(e) {
if (this.hoveredStyles && this.hasInitialSylesChecked) {
- this.obj.style.cssText = this.initialStyles;
+ this.tablehider.style.cssText = this.initialStyles;
}
if (this.hoveredClasses)
for (var i = 0; i < this.hoveredClasses.length; i++){
- this.obj.removeClassName(this.hoveredClasses[i]);
- this.leftIcon.removeClassName(this.hoveredClasses[i]);
- this.rightIcon.removeClassName(this.hoveredClasses[i]);
- this.labelArea.removeClassName(this.hoveredClasses[i]);
+ this.tablehider.removeClassName(this.hoveredClasses[i]);
}
},
@@ -346,21 +340,15 @@
_attachBehaviors: function() {
if (!this.disabled) {
if (this.event)
- Event.observe(this.obj, this.event, this.itemClicked.bindAsEventListener(this),
false);
+ Event.observe(this.tablehider, this.event,
this.itemClicked.bindAsEventListener(this), false);
else
- Event.observe(this.obj, "click",
this.itemClicked.bindAsEventListener(this), false);
+ Event.observe(this.tablehider, "click",
this.itemClicked.bindAsEventListener(this), false);
Event.observe(this.obj, "mouseover",
this.hoverItem.bindAsEventListener(this), false);
- Event.observe(this.obj, "mouseover",
this.addHoverStyles.bindAsEventListener(this), false);
- Event.observe(this.obj, "mouseout",
this.removeHoverStyles.bindAsEventListener(this), false);
+ Event.observe(this.tablehider, "mouseover",
this.addHoverStyles.bindAsEventListener(this), false);
+ Event.observe(this.tablehider, "mouseout",
this.removeHoverStyles.bindAsEventListener(this), false);
- Event.observe(this.leftIcon, "mouseover",
this.addHoverStyles.bindAsEventListener(this), false);
- Event.observe(this.rightIcon, "mouseover",
this.addHoverStyles.bindAsEventListener(this), false);
- Event.observe(this.labelArea, "mouseover",
this.addHoverStyles.bindAsEventListener(this), false);
- Event.observe(this.leftIcon, "mouseout",
this.removeHoverStyles.bindAsEventListener(this), false);
- Event.observe(this.rightIcon, "mouseout",
this.removeHoverStyles.bindAsEventListener(this), false);
- Event.observe(this.labelArea, "mouseout",
this.removeHoverStyles.bindAsEventListener(this), false);
}
}
};
Modified: trunk/sandbox/panelmenu/src/main/templates/org/richfaces/htmlPanelMenu.jspx
===================================================================
--- trunk/sandbox/panelmenu/src/main/templates/org/richfaces/htmlPanelMenu.jspx 2007-06-15
11:59:47 UTC (rev 1199)
+++ trunk/sandbox/panelmenu/src/main/templates/org/richfaces/htmlPanelMenu.jspx 2007-06-15
12:35:29 UTC (rev 1200)
@@ -24,25 +24,20 @@
<f:clientid var="clientId"/>
<f:call name="utils.encodeBeginFormIfNessesary"/>
- <table cellpadding="0" cellspacing="0"
- style="#{component.style};" class="#{component.styleClass}"
- id="#{clientId}" width="#{component.width}"
- onclick="#{component.onclick}"
- ondblclick="#{component.ondblclick}"
- onmousemove="#{component.onmousemove}"
- onmouseout="#{component.onmouseout}"
- onmouseover="#{component.onmouseover}">
+ <div style="#{component.style};"
class="#{component.styleClass}"
+ id="#{clientId}" width="#{component.width}"
+ onclick="#{component.onclick}"
+ ondblclick="#{component.ondblclick}"
+ onmousemove="#{component.onmousemove}"
+ onmouseout="#{component.onmouseout}"
+ onmouseover="#{component.onmouseover}" >
- <tbody>
- <vcp:body>
- <f:call name="renderChildren"/>
- </vcp:body>
- <tr style="display:none">
- <td>
- <f:call name="insertScript"/>
- </td>
- </tr>
- </tbody>
- </table>
+ <vcp:body>
+ <f:call name="renderChildren" />
+ </vcp:body>
+ <div style="display:none">
+ <f:call name="insertScript"/>
+ </div>
+ </div>
<f:call name="utils.encodeEndFormIfNessesary"/>
</f:root>
Modified:
trunk/sandbox/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx
===================================================================
---
trunk/sandbox/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx 2007-06-15
11:59:47 UTC (rev 1199)
+++
trunk/sandbox/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx 2007-06-15
12:35:29 UTC (rev 1200)
@@ -12,47 +12,45 @@
<f:clientid var="clientId"/>
- <tr id="tdhide#{clientId}" style="#{this:getHideStyle(context,
component)}" >
- <td>
- <jsp:scriptlet>
- <![CDATA[
- String isNodeOpened = isOpened(context, component) ?
"opened" : "closed";
- ]]>
- </jsp:scriptlet>
- <table cellpadding="0" cellspacing="0" border="0"
width="100%"
- id="tablehide#{clientId}"
- class="dr-pmenu-group rich-pmenu-group #{this:getFullStyleClass( context,
component )} "
- style="#{this:getFullStyle( context, component )}" >
-
- <f:call name="utils.encodePassThru" />
- <tr id="#{clientId}">
- <f:call name="insertTDs" />
- <td id="leftIcon#{clientId}" class="#{this:getIconClass( context,
component )}">
- <f:call name="insertImage">
- <f:parameter value="left" />
- </f:call>
- </td>
- <td style="width:100%" id="icon#{clientId}"
class="#{this:getLabelClass( context, component )}">
- <input type="hidden" name="panelMenuState#{clientId}"
- value="#{isNodeOpened}" >
- </input>
+
+ <div id="tdhide#{clientId}" style="#{this:getHideStyle(context,
component)}"
+ class="#{this:getDivClass(context, component)}" >
+ <jsp:scriptlet>
+ <![CDATA[
+ String isNodeOpened = isOpened(context, component) ? "opened" :
"closed";
+ ]]>
+ </jsp:scriptlet>
+ <table cellspacing="0" cellpadding="0" border="0"
+ id="tablehide#{clientId}"
+ class="#{this:getTableClass(context, component)} rich-pmenu-group
#{this:getFullStyleClass( context, component )} "
+ style="#{this:getFullStyle( context, component )}" >
+
+ <f:call name="utils.encodePassThru" />
+
+ <tr>
+ <td>
+ <f:call name="insertSpacerImages" />
+ <f:call name="insertImage">
+ <f:parameter value="left" />
+ </f:call>
+ </td>
+ <td style="width:100%" id="icon#{clientId}"
class="dr-pmenu-group-self-label #{this:getLabelClass( context, component )}"
>
+ <input type="hidden" name="panelMenuState#{clientId}"
+ value="#{isNodeOpened}" />
- <input type="hidden" name="panelMenuAction#{clientId}"
- value="" >
- </input>
- <f:call name="insertLabel"/>
-
- </td>
- <td id="rightIcon#{clientId}" class="#{this:getIconClass( context,
component )}">
- <f:call name="insertImage">
- <f:parameter value="right" />
- </f:call>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <vcp:body>
- <f:call name="renderChildren" />
- </vcp:body>
+ <input type="hidden" name="panelMenuAction#{clientId}"
+ value="" />
+ <f:call name="insertLabel"/>
+ </td>
+ <td>
+ <f:call name="insertImage">
+ <f:parameter value="right" />
+ </f:call>
+ </td>
+ </tr>
+ </table>
+ <vcp:body>
+ <f:call name="renderChildren" />
+ </vcp:body>
+ </div>
</f:root>
\ No newline at end of file
Modified: trunk/sandbox/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx
===================================================================
---
trunk/sandbox/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx 2007-06-15
11:59:47 UTC (rev 1199)
+++
trunk/sandbox/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx 2007-06-15
12:35:29 UTC (rev 1200)
@@ -12,38 +12,38 @@
<f:clientid var="clientId"/>
- <tr id="tdhide#{clientId}" style="#{this:getHideStyle(context,
component)}" >
- <td>
- <table cellpadding="0" cellspacing="0" border="0"
width="100%"
- class="rich-pmenu-item dr-pmenu-item #{this:getFullStyleClass( context,
component )} "
- style="#{this:getFullStyle( context, component )}"
- id="tablehide#{clientId}" >
+
+ <div id="tdhide#{clientId}" style="#{this:getHideStyle(context,
component)}" >
+ <table cellspacing="0" cellpadding="0" border="0"
+ id="tablehide#{clientId}"
+ class="dr-pmenu-item rich-pmenu-item #{this:getFullStyleClass( context,
component )} "
+ style="#{this:getFullStyle( context, component )}" >
+
<f:call name="utils.encodeAttributes">
<f:parameter value="onclick,onmousedown,onmouseup,onmousemove" />
</f:call>
- <tr>
- <f:call name="utils.encodeId"/>
- <f:call name="insertTDs"/>
- <td id="leftIcon#{clientId}" class="#{this:getIconClass( context,
component )}">
- <f:call name="insertImage">
- <f:parameter value="left"/>
- </f:call>
- </td>
- <td id="icon#{clientId}" class="#{this:getLabelClass( context,
component )}" style="width:100%">
+
+ <tr>
+ <f:call name="utils.encodeId"/>
+ <td>
+ <f:call name="insertSpacerImages" />
+ <f:call name="insertImage">
+ <f:parameter value="left" />
+ </f:call>
+ </td>
+ <td style="width:100%" id="icon#{clientId}"
class="dr-pmenu-group-self-label #{this:getLabelClass( context, component )}"
>
<input type="hidden" name="panelMenuAction#{clientId}"
value=""/>
<f:call name="insertValue"/>
<vcp:body>
<f:call name="renderChildren" />
- </vcp:body>
- <f:clientid var="clientId"/>
- </td>
- <td id="rightIcon#{clientId}" class="#{this:getIconClass( context,
component )}">
- <f:call name="insertImage">
- <f:parameter value="right"/>
- </f:call>
- </td>
- </tr>
- </table>
- </td>
- </tr>
+ </vcp:body>
+ </td>
+ <td>
+ <f:call name="insertImage">
+ <f:parameter value="right" />
+ </f:call>
+ </td>
+ </tr>
+ </table>
+ </div>
</f:root>
\ No newline at end of file
Modified:
trunk/sandbox/panelmenu/src/test/java/org/richfaces/component/PanelMenuComponentTest.java
===================================================================
---
trunk/sandbox/panelmenu/src/test/java/org/richfaces/component/PanelMenuComponentTest.java 2007-06-15
11:59:47 UTC (rev 1199)
+++
trunk/sandbox/panelmenu/src/test/java/org/richfaces/component/PanelMenuComponentTest.java 2007-06-15
12:35:29 UTC (rev 1200)
@@ -84,6 +84,7 @@
private UIPanelMenu panelMenu;
private UIPanelMenuGroup group1;
private UIPanelMenuGroup group2;
+ private UIPanelMenuGroup group3;
private UIPanelMenuItem item1;
private UIPanelMenuItem item2;
@@ -115,6 +116,10 @@
item1.setId("item1");
group1.getChildren().add(item1);
+ group3 =
(UIPanelMenuGroup)application.createComponent("org.richfaces.panelMenuGroup");
+ group3.setId("subgroup");
+ group2.getChildren().add(group3);
+
item2 =
(UIPanelMenuItem)application.createComponent("org.richfaces.panelMenuItem");
item2.setId("item2");
item2.setDisabled(true);
@@ -179,26 +184,46 @@
assertNotNull(page);
System.out.println(page.asXml());
- HtmlElement table =
page.getHtmlElementById(panelMenu.getClientId(facesContext));
- assertNotNull(table);
- assertEquals("table", table.getNodeName());
+ HtmlElement div = page.getHtmlElementById(panelMenu.getClientId(facesContext));
+ assertNotNull(div);
+ assertEquals("div", div.getNodeName());
+ HtmlElement firstGroupDiv = page.getHtmlElementById("tdhide" +
group1.getClientId(facesContext));
+ assertNotNull(firstGroupDiv);
+ assertEquals("div", firstGroupDiv.getNodeName());
+
+ String styleClass = firstGroupDiv.getAttributeValue("class");
+ assertTrue(styleClass.contains("dr-pmenu-group-div"));
+
HtmlElement firstGroupHide = page.getHtmlElementById("tablehide" +
group1.getClientId(facesContext));
assertNotNull(firstGroupHide);
assertEquals("table", firstGroupHide.getNodeName());
- String styleClass = firstGroupHide.getAttributeValue("class");
- assertTrue(styleClass.contains("dr-pmenu-group"));
+ styleClass = firstGroupHide.getAttributeValue("class");
+ assertTrue(styleClass.contains("dr-pmenu-top-group"));
assertTrue(styleClass.contains("rich-pmenu-group"));
assertTrue(styleClass.contains("rich-pmenu-disabled-element"));
+ assertTrue(styleClass.contains("dr-pmenu-disabled-element"));
+ HtmlElement subGroupDiv = page.getHtmlElementById("tdhide" +
group3.getClientId(facesContext));
+ assertNotNull(subGroupDiv);
+ assertEquals("div", subGroupDiv.getNodeName());
+
+ HtmlElement subGroupHide = page.getHtmlElementById("tablehide" +
group3.getClientId(facesContext));
+ assertNotNull(subGroupHide);
+ assertEquals("table", subGroupHide.getNodeName());
+
+ styleClass = subGroupHide.getAttributeValue("class");
+ assertTrue(styleClass.contains("dr-pmenu-group"));
+ assertTrue(styleClass.contains("rich-pmenu-group"));
+
HtmlElement leftIcon = page.getHtmlElementById("leftIcon" +
group1.getClientId(facesContext));
assertNotNull(leftIcon);
- assertEquals("td", leftIcon.getNodeName());
+ assertEquals("img", leftIcon.getNodeName());
HtmlElement rightIcon = page.getHtmlElementById("rightIcon" +
group1.getClientId(facesContext));
assertNotNull(rightIcon);
- assertEquals("td", rightIcon.getNodeName());
+ assertEquals("img", rightIcon.getNodeName());
HtmlElement firstItemHide = page.getHtmlElementById("tablehide" +
item1.getClientId(facesContext));
assertNotNull(firstItemHide);
@@ -210,11 +235,11 @@
leftIcon = page.getHtmlElementById("leftIcon" +
item1.getClientId(facesContext));
assertNotNull(leftIcon);
- assertEquals("td", leftIcon.getNodeName());
+ assertEquals("img", leftIcon.getNodeName());
rightIcon = page.getHtmlElementById("rightIcon" +
item1.getClientId(facesContext));
assertNotNull(rightIcon);
- assertEquals("td", rightIcon.getNodeName());
+ assertEquals("img", rightIcon.getNodeName());
HtmlElement secondItemHide = page.getHtmlElementById("tablehide" +
item2.getClientId(facesContext));
assertNotNull(secondItemHide);