protected ApplicationConnection client;
protected final VMenuBar hostReference = this;
- protected String submenuIcon = null;
protected CustomMenuItem moreItem = null;
// Only used by the root menu bar
UIDL options = uidl.getChildUIDL(0);
- // FIXME remove in version 7
- if (options.hasAttribute("submenuIcon")) {
- submenuIcon = client.translateVaadinUri(uidl.getChildUIDL(0)
- .getStringAttribute("submenuIcon"));
- } else {
- submenuIcon = null;
- }
-
if (uidl.hasAttribute("width")) {
UIDL moreItemUIDL = options.getChildUIDL(0);
StringBuffer itemHTML = new StringBuffer();
} else {
// Add submenu indicator
if (item.getChildCount() > 0) {
- // FIXME For compatibility reasons: remove in version 7
String bgStyle = "";
- if (submenuIcon != null) {
- bgStyle = " style=\"background-image: url("
- + Util.escapeAttribute(submenuIcon)
- + "); text-indent: -999px; width: 1em;\"";
- }
itemHTML.append("<span class=\"" + CLASSNAME
+ "-submenu-indicator\"" + bgStyle + ">►</span>");
}
// Number of items in this menu
private int numberOfItems = 0;
- /**
- * @deprecated
- * @see #setCollapse(boolean)
- */
- @Deprecated
- private boolean collapseItems;
-
- /**
- * @deprecated
- * @see #setSubmenuIcon(Resource)
- */
- @Deprecated
- private Resource submenuIcon;
-
private MenuItem moreItem;
private boolean openRootOnHover;
target.startTag("options");
- if (submenuIcon != null) {
- target.addAttribute("submenuIcon", submenuIcon);
- }
-
if (getWidth() > -1) {
target.startTag("moreItem");
target.addAttribute("text", moreItem.getText());
*/
public MenuBar() {
menuItems = new ArrayList<MenuItem>();
- setCollapse(true);
setMoreMenuItem(null);
}
return menuItems.size();
}
- /**
- * 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();
- }
-
- /**
- * @deprecated
- * @see #setSubmenuIcon(Resource)
- */
- @Deprecated
- public Resource getSubmenuIcon() {
- return submenuIcon;
- }
-
- /**
- * Enable or disable collapsing top-level items. Top-level items will
- * 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();
- }
-
- /**
- * @see #setCollapse(boolean)
- * @deprecated
- */
- @Deprecated
- public boolean getCollapse() {
- return collapseItems;
- }
-
/**
* 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