Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Cannot Reproduce
-
Affects Version/s: 1.5.1
-
Component/s: ICE-Components
-
Labels:None
-
Environment:Operating System: Windows XP
Platform: PC
Description
If a MenuItem is disabled, it seems that the bound link attribute is still
rendered and clickable.
-
Hide
- simpleMenu.zip
- 29 kB
- Greg McCleary
-
- simpleMenu/build.properties 0.2 kB
- simpleMenu/build.xml 9 kB
- simpleMenu/tom.bat 0.0 kB
- simpleMenu/META-INF/context.xml 0.1 kB
- simpleMenu/src/.project 0.4 kB
- simpleMenu/src/.classpath 0.5 kB
- simpleMenu/src/test/MenuBarBean.java 5 kB
- simpleMenu/src/test/MenuBarBean.class 2 kB
- simpleMenu/src/test/TestBean.java 2 kB
- simpleMenu/.../DefaultCollectionItemsArray.java 0.8 kB
- simpleMenu/web/index.jsp 0.1 kB
- simpleMenu/web/menuBar.jspx 2 kB
- simpleMenu/web/menu.html 2 kB
- simpleMenu/web/WEB-INF/web.xml 4 kB
- simpleMenu/web/WEB-INF/faces-config.xml 1 kB
- simpleMenu/web/images/menu/zoomout.gif 0.6 kB
- simpleMenu/web/.../menu/actualsize.gif 0.6 kB
- simpleMenu/web/images/menu/arrow.gif 0.2 kB
- simpleMenu/web/images/menu/fitinpage.gif 0.4 kB
- simpleMenu/web/.../menu/fitinwindow.gif 0.4 kB
- simpleMenu/web/images/menu/open.gif 0.6 kB
- simpleMenu/web/images/menu/print.gif 0.6 kB
- simpleMenu/web/images/menu/recent.gif 0.6 kB
- simpleMenu/web/images/menu/save.gif 0.6 kB
- simpleMenu/web/images/menu/zoomin.gif 0.6 kB
- simpleMenu/web/css/showcase_style.css 18 kB
- simpleMenu/web/menuBar_full.jspx 7 kB
- simpleMenu/web/test.jspx 0.8 kB
- simpleMenu/web/menuBar_test.jspx 1 kB
- simpleMenu/web/menuBar_horizontal.jspx 7 kB
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
Created an attachment (id=139)
testcase for disabling individual menuItems and their sub-menus
Fixed in HEAD [ rev. 12990 ]
fix doesn't work for top level menu items.
suggested fix diffed to 1.5.3:
— C:\work\frameworks\ICEfaces-1.5.3-src\icefaces\component\src\com\icesoft\faces\component\menubar\MenuItemRenderer.java 2006-11-07 14:38:10.000000000 -0700
+++ C:\work\frameworks\ICEfaces-1.5.3-src-Inovis\icefaces\component\src\com\icesoft\faces\component\menubar\MenuItemRenderer.java 2007-02-21 13:54:29.000000000 -0700
@@ -145,21 +145,23 @@
Element topLevelDiv = domContext.createRootElement(HTML.DIV_ELEM);
topLevelDiv.setAttribute(HTML.ID_ATTR, clientId);
}
Element topLevelDiv = (Element) domContext.getRootNode();
topLevelDiv.setAttribute(HTML.NAME_ATTR, "TOP_LEVEL");
+ boolean isDisabled = ((MenuItem)uiComponent).isDisabled();
if (vertical)
else
{ - topLevelDiv.setAttribute(HTML.CLASS_ATTR, - CSS_DEFAULT.MENU_HORIZONTAL_STYLE); + topLevelDiv.setAttribute(HTML.CLASS_ATTR, + CSS_DEFAULT.MENU_HORIZONTAL_STYLE + (isDisabled ? "-dis" : "") ); }+
- if (uiComponent.getChildCount() > 0) {
+ if (uiComponent.getChildCount() > 0 && !isDisabled )Unknown macro: { String displayEvent = HTML.ONMOUSEOVER_ATTR; if (vertical) { topLevelDiv.setAttribute(displayEvent, "Ice.Menu.hideOrphanedMenusNotRelatedTo(this);" + expand("this", clientId + "_sub", KEYWORD_THIS)); @@ -254,13 +256,19 @@ div.appendChild(iconImg); } }
// create a span for text
Element span = domContext.createElement(HTML.SPAN_ELEM);
- span.setAttribute(HTML.CLASS_ATTR, "iceSubMenuRowLabel");
+ if (!menuItem.isDisabled()) { + span.setAttribute(HTML.CLASS_ATTR, "iceSubMenuRowLabel"); + anchor.setAttribute(HTML.STYLE_CLASS_ATTR, "iceLink"); + }else
{ + span.setAttribute(HTML.CLASS_ATTR, "iceSubMenuRowLabel-dis"); + anchor.setAttribute(HTML.STYLE_CLASS_ATTR, "iceLink-dis"); + }div.appendChild(span);
// create text
Node text = domContext.createTextNode(DOMUtils.escapeAnsi(menuItem.getValue().toString()));
span.appendChild(text);
return anchor;
@@ -303,13 +311,19 @@
iconImg.setAttribute(HTML.CLASS_ATTR, "iceSubMenuRowImage ");
div.appendChild(iconImg);
}
// create a span for text
Element span = domContext.createElement(HTML.SPAN_ELEM);
- span.setAttribute(HTML.CLASS_ATTR, "iceSubMenuRowLabel");
+ if (!menuItem.isDisabled()) { + span.setAttribute(HTML.CLASS_ATTR, "iceSubMenuRowLabel"); + anchor.setAttribute(HTML.STYLE_CLASS_ATTR,"iceLink"); + } else { + span.setAttribute(HTML.CLASS_ATTR, "iceSubMenuRowLabel-dis"); + anchor.setAttribute(HTML.STYLE_CLASS_ATTR,"iceLink-dis"); + }
div.appendChild(span);
// create text
Node text = domContext.createTextNode(DOMUtils.escapeAnsi(menuItem.getValue().toString()));
span.appendChild(text);
return anchor;
@@ -348,13 +362,19 @@
iconImg.setAttribute(HTML.CLASS_ATTR, "iceSubMenuRowImage ");
div.appendChild(iconImg);
}
// create a span for text
Element span = domContext.createElement(HTML.SPAN_ELEM);
- span.setAttribute(HTML.CLASS_ATTR, "iceSubMenuRowLabel");
+ if (!menuItem.isDisabled()) { + span.setAttribute(HTML.CLASS_ATTR, "iceSubMenuRowLabel"); + anchor.setAttribute(HTML.STYLE_CLASS_ATTR,"iceLink"); + }else
{ + span.setAttribute(HTML.CLASS_ATTR, "iceSubMenuRowLabel-dis"); + anchor.setAttribute(HTML.STYLE_CLASS_ATTR,"iceLink-dis"); + }div.appendChild(span);
// create text
Node text = domContext.createTextNode(DOMUtils.escapeAnsi(menuItem.getValue().toString()));
span.appendChild(text);
return anchor;
@@ -486,13 +506,13 @@
link.setValue(nextSubMenuItem.getValue());
link.setParent(nextSubMenuItem);
link.setId(LINK_SUFFIX);
if (nextSubMenuItem.isDisabled())
- link.setStyleClass("");
+ //link.setStyleClass("");
Node lastCursorParent = domContext.getCursorParent();
domContext.setCursorParent(subMenuItemDiv);
if (vertical) { addChildren(link, nextSubMenuItem, menuComponent); }else
{ addTopLevelChildren(link, nextSubMenuItem, menuComponent); @@ -575,13 +595,17 @@ image.setStyleClass("iceSubMenuRowImage"); div.getChildren().add(image); }
HtmlOutputText outputText = new HtmlOutputText();
outputText.setValue(link.getValue());
- outputText.setStyleClass("iceSubMenuRowLabel");
+ if (!nextSubMenuItem.isDisabled()) { + outputText.setStyleClass("iceSubMenuRowLabel"); + } else { + outputText.setStyleClass("iceSubMenuRowLabel-dis"); + }
link.setValue("");
div.getChildren().add(outputText);
link.getChildren().add(div);
}
@@ -607,13 +631,17 @@
image.setStyleClass("iceSubMenuRowImage");
div.getChildren().add(image);
}
HtmlOutputText outputText = new HtmlOutputText();
outputText.setValue(link.getValue());
- outputText.setStyleClass("iceSubMenuRowLabel");
+ if (!nextSubMenuItem.isDisabled()) { + outputText.setStyleClass("iceSubMenuRowLabel"); + }else
{ + outputText.setStyleClass("iceSubMenuRowLabel-dis"); + }link.setValue("");
div.getChildren().add(outputText);
link.getChildren().add(div);
}
— C:\work\frameworks\ICEfaces-1.5.3-src\icefaces\core\src\com\icesoft\faces\resources\css\royale\royale.css 2006-11-03 14:30:58.000000000 -0700
+++ C:\work\frameworks\ICEfaces-1.5.3-src-Inovis\icefaces\core\src\com\icesoft\faces\resources\css\royale\royale.css 2007-02-21 14:51:22.000000000 -0700
@@ -1431,12 +1431,127 @@
.iceSubMenuDividerVert
+/* submenu disabled style classes */
+.iceSubMenuRowLabel-dis
+
+.iceSubMenuRow-dis
+
+.iceSubMenuRow-dis a
+
+.iceSubMenuRow-dis a:hover
+.iceMenu-dis
{ + float: left; + padding: 0px; + color: #ABABAB; + text-decoration: none; + display: block; + white-space: nowrap; +}+
+.iceMenu-dis a
+
+.iceMenu-dis a:hover
+
+.iceMenu-dis hr, .subiceMenu-dis hr
+
+.iceMenu_verticalItem-dis
+
+.iceMenu_verticalItem-dis a
+
+.iceMenu_verticalItem a:hover
+
+
/*
----------- PanelPopup ----------
*/
.icePanelPopup
{ color: #666666; --- C:\work\frameworks\ICEfaces-1.5.3-src\icefaces\core\src\com\icesoft\faces\resources\css\xp\xp.css 2006-11-09 15:35:40.000000000 -0700 +++ C:\work\frameworks\ICEfaces-1.5.3-src-Inovis\icefaces\core\src\com\icesoft\faces\resources\css\xp\xp.css 2007-02-21 14:02:03.000000000 -0700 @@ -1357,12 +1357,60 @@ width: 100%; height: 1px; margin-top: 3px; padding: 0px; text-align: left; }+.iceMenu-dis
{ + float: left; + padding: 0px; + color: #ABABAB; + text-decoration: none; + display: block; + white-space: nowrap; +}+
+.iceMenu-dis a
+
+.iceMenu-dis a:hover
+
+.iceMenu-dis hr, .subiceMenu-dis hr
+
/* classes for the vertical version of the iceMenu*/
.iceMenu_vertical {
float: left;
padding: 0px;
white-space: nowrap;
@@ -1392,12 +1440,44 @@
.iceMenu_verticalItem a:hover
{ background-color: #2A6CC2; color: #FFFFFF; text-decoration: none; }+.iceMenu_verticalItem-dis
{ + width: 160px; + color: #ABABAB; + text-decoration: none; + display: block; +}+
+.iceMenu_verticalItem-dis a
+
+.iceMenu_verticalItem a:hover
+
.iceSubMenu {
position: absolute;
background-color: #EFEFEF;
width: 160px;
@@ -1486,12 +1566,47 @@
.iceSubMenuDividerVert
+/* submenu disabled style classes */
+.iceSubMenuRowLabel-dis
+
+.iceSubMenuRow-dis
+
+.iceSubMenuRow-dis a
+
+.iceSubMenuRow-dis a:hover
+
/*
----------- PanelPopup ----------
*/
.icePanelPopup {
color: #666666;
I have tested this issue and found that it has been already fixed in 1.6 DR#1. I can disable any level of menu including top level.
The disabled menuItem functionality has never been fully implemented.
The disabled functionality of MenuItems will work as follows;
1) Disabling a Top Level vertical or horizontal menu item will disable all of
it's child submenu items.
2) Hover behavior will still expand submenus but they will be disabled and the
hover will not hilite like a regular active menu item.
The disabled styleclasses for the MenuBar need to be created and added to our
xp.css and royale.css.
// disabled classes for top level horizontal
iceMenu-dis
iceMenu-dis a
// disabled classes for top level vertical
iceMenu_verticalItem-dis
iceMenu_verticalItem-dis a
// disabled classes for submenus in a vertical menubar
iceSubMenu_vertical-dis
iceSubMenu_vertical-dis a
// disabled classes for submenus in a horizontal menubar
iceSubMenu-dis
iceSubMenu-dis a