summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/ui/MenuBar.java
diff options
context:
space:
mode:
authorJouni Koivuviita <jouni.koivuviita@itmill.com>2009-11-08 20:17:30 +0000
committerJouni Koivuviita <jouni.koivuviita@itmill.com>2009-11-08 20:17:30 +0000
commit2b8e8c3f8f0853753fa904a53bb8e38a7aa5736a (patch)
tree054591e03d8ebbfbfe8cf03fb65e72e2bdf07ecd /src/com/vaadin/ui/MenuBar.java
parentb3261ba509f9b0ca2c4f7fa422e48225a6e033df (diff)
downloadvaadin-framework-2b8e8c3f8f0853753fa904a53bb8e38a7aa5736a.tar.gz
vaadin-framework-2b8e8c3f8f0853753fa904a53bb8e38a7aa5736a.zip
MenuBar fixes:
* Fixes #2849: Deprecate MenuBar.setSubmenuIcon method, and provide the same functionality via CSS * Fixes #2821: Sumbenu icon is not aligned with the menu item's text * Fixes #3482: MenuItem: Subitem is wrongly marked as selected Deprecated setCollapse method at the same time, redundant method (the feature should always be enabled). svn changeset:9675/svn branch:6.2
Diffstat (limited to 'src/com/vaadin/ui/MenuBar.java')
-rw-r--r--src/com/vaadin/ui/MenuBar.java44
1 files changed, 31 insertions, 13 deletions
diff --git a/src/com/vaadin/ui/MenuBar.java b/src/com/vaadin/ui/MenuBar.java
index 30049431d3..c0939d23ed 100644
--- a/src/com/vaadin/ui/MenuBar.java
+++ b/src/com/vaadin/ui/MenuBar.java
@@ -29,8 +29,20 @@ public class MenuBar extends AbstractComponent {
// Number of items in this menu
private static int numberOfItems = 0;
+ /**
+ * @deprecated
+ * @see #setCollapse(boolean)
+ */
+ @Deprecated
private boolean collapseItems;
+
+ /**
+ * @deprecated
+ * @see #setSubmenuIcon(Resource)
+ */
+ @Deprecated
private Resource submenuIcon;
+
private MenuItem moreItem;
/** Paint (serialise) the component for the client. */
@@ -49,9 +61,7 @@ public class MenuBar extends AbstractComponent {
target.addAttribute("submenuIcon", submenuIcon);
}
- target.addAttribute("collapseItems", collapseItems);
-
- if (collapseItems) {
+ if (getWidth() > -1) {
target.startTag("moreItem");
target.addAttribute("text", moreItem.getText());
if (moreItem.getIcon() != null) {
@@ -270,40 +280,46 @@ public class MenuBar extends AbstractComponent {
* Set the icon to be used if a sub-menu has children. Defaults to null;
*
* @param icon
+ * @deprecated (since 6.2, will be removed in 7.0) Icon is set in theme, no
+ * need to worry about the visual representation here.
*/
+ @Deprecated
public void setSubmenuIcon(Resource icon) {
submenuIcon = icon;
requestRepaint();
}
/**
- * Get the icon used for sub-menus. Returns null if no icon is set.
- *
- * @return
+ * @deprecated
+ * @see #setSubmenuIcon(Resource)
*/
+ @Deprecated
public Resource getSubmenuIcon() {
return submenuIcon;
}
/**
* Enable or disable collapsing top-level items. Top-level items will
- * collapse to if there is not enough room for them. Items that don't fit
- * will be placed under the "More" menu item.
+ * collapse together if there is not enough room for them. Items that don't
+ * fit will be placed under the "More" menu item.
*
* Collapsing is enabled by default.
*
* @param collapse
+ * @deprecated (since 6.2, will be removed in 7.0) Collapsing is always
+ * enabled if the MenuBar has a specified width.
*/
+ @Deprecated
public void setCollapse(boolean collapse) {
collapseItems = collapse;
requestRepaint();
}
/**
- * Collapsing is enabled by default.
- *
- * @return true if the top-level items will be collapsed
+ * @see #setCollapse(boolean)
+ * @deprecated
*/
+ @Deprecated
public boolean getCollapse() {
return collapseItems;
}
@@ -311,16 +327,18 @@ 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
+ * ignored. If set to null, the default item with the "More..." text is be
* used.
*
+ * The item command (if specified) is ignored.
+ *
* @param item
*/
public void setMoreMenuItem(MenuItem item) {
if (item != null) {
moreItem = item;
} else {
- moreItem = new MenuItem("More", null, null);
+ moreItem = new MenuItem("More...", null, null);
}
requestRepaint();
}