aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/ui/MenuBar.java
diff options
context:
space:
mode:
authorJouni Koivuviita <jouni.koivuviita@itmill.com>2009-11-09 14:36:28 +0000
committerJouni Koivuviita <jouni.koivuviita@itmill.com>2009-11-09 14:36:28 +0000
commitff991344bb16604fd60a1302c370edcaaf8f9cd1 (patch)
tree68be8a51d64b0b6f44dfccc7de78f5789b3dc94e /src/com/vaadin/ui/MenuBar.java
parent80dc4982a2483b141bd05fa7bc66b685744594df (diff)
downloadvaadin-framework-ff991344bb16604fd60a1302c370edcaaf8f9cd1.tar.gz
vaadin-framework-ff991344bb16604fd60a1302c370edcaaf8f9cd1.zip
MenuBar fixes & enhancements
* fixes #3507: Menubar.MenuItem needs setEnabled() * "More" menuitem now presented as an arrow * menu opening/closing now more intuitive * client side stylename for menuitems changed to v-menuitem svn changeset:9688/svn branch:6.2
Diffstat (limited to 'src/com/vaadin/ui/MenuBar.java')
-rw-r--r--src/com/vaadin/ui/MenuBar.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/com/vaadin/ui/MenuBar.java b/src/com/vaadin/ui/MenuBar.java
index c0939d23ed..77523f9680 100644
--- a/src/com/vaadin/ui/MenuBar.java
+++ b/src/com/vaadin/ui/MenuBar.java
@@ -97,6 +97,10 @@ public class MenuBar extends AbstractComponent {
target.addAttribute("icon", icon);
}
+ if (!item.isEnabled()) {
+ target.addAttribute("disabled", true);
+ }
+
if (item.hasChildren()) {
iteratorStack.push(itr); // For later use
@@ -148,7 +152,7 @@ public class MenuBar extends AbstractComponent {
}// while
// If we got the clicked item, launch the command.
- if (found) {
+ if (found && tmpItem.isEnabled()) {
tmpItem.getCommand().menuSelected(tmpItem);
}
}// if
@@ -327,8 +331,7 @@ public class MenuBar extends AbstractComponent {
/**
* Set the item that is used when collapsing the top level menu. All
* "overflowing" items will be added below this. The item command will be
- * ignored. If set to null, the default item with the "More..." text is be
- * used.
+ * ignored. If set to null, the default item with a downwards arrow is used.
*
* The item command (if specified) is ignored.
*
@@ -338,7 +341,7 @@ public class MenuBar extends AbstractComponent {
if (item != null) {
moreItem = item;
} else {
- moreItem = new MenuItem("More...", null, null);
+ moreItem = new MenuItem("", null, null);
}
requestRepaint();
}
@@ -378,6 +381,7 @@ public class MenuBar extends AbstractComponent {
private List<MenuItem> itsChildren;
private Resource itsIcon;
private MenuItem itsParent;
+ private boolean enabled = true;
/**
* Constructs a new menu item that can optionally have an icon and a
@@ -625,6 +629,15 @@ public class MenuBar extends AbstractComponent {
itsParent = parent;
}
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ requestRepaint();
+ }
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
}// class MenuItem
}// class MenuBar