henrikerola / PopupButton

Vaadin Add-on
http://vaadin.com/addon/popupbutton
7 stars 24 forks source link

Button tool tip appears on popup content #17

Open mwolf9 opened 11 years ago

mwolf9 commented 11 years ago

When using the Vaadin 7 version of PopupButton the tool tip set on the button is propagated to the popup content causing mouse overs on the content to show the tool tip.

In order to fix this I modified the PopupButtonConnector class to override the getToolTipInfo(Element element) Method like so:

@Override
public TooltipInfo getTooltipInfo(Element element) {
    if (getWidget().isElementPartOfPopupButton(element)) {
        return super.getTooltipInfo(element);
    }

    return null;
}

I also modified the VPopupButton Class by changing the constructor and adding a new field and method:

public DivElement indicatorElement;

public VPopupButton() {
    super();
    indicatorElement = Document.get().createDivElement();
    indicatorElement.setClassName(POPUP_INDICATOR_CLASSNAME);
    getElement().getFirstChildElement().appendChild(indicatorElement);
}

public boolean isElementPartOfPopupButton(Element element) {
    return element.equals(getElement()) || element.equals(wrapper)
            || element.equals(captionElement)
            || element.equals(indicatorElement);
}