MenuSeparator.java :  » GWT » gwtoolbox » org » gwtoolbox » widget » client » menu » Java Open Source

Java Open Source » GWT » gwtoolbox 
gwtoolbox » org » gwtoolbox » widget » client » menu » MenuSeparator.java
package org.gwtoolbox.widget.client.menu;

import com.google.gwt.user.client.ui.UIObject;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;

/**
 * @author Uri Boness
 */
public class MenuSeparator extends UIObject {

    private static final String STYLENAME_DEFAULT = "MenuSeparator";

    private Menu parentMenu;

    private String category;

    /**
     * Constructs a new {@link MenuSeparator}.
     */
    public MenuSeparator() {
        setElement(DOM.createTD());        
        DOM.setStyleAttribute(getElement(), "padding", "0");
        setStyleName(STYLENAME_DEFAULT);

        // Add an inner element for styling purposes
        Element div = DOM.createDiv();
        DOM.appendChild(getElement(), div);
        setStyleName(div, "MenuSeparator-inner");
    }

    /**
     * Gets the menu that contains this item.
     *
     * @return the parent menu, or <code>null</code> if none exists.
     */
    public Menu getParentMenu() {
        return parentMenu;
    }

    void setParentMenu(Menu parentMenu) {
        this.parentMenu = parentMenu;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.