List of usage examples for com.google.gwt.user.client.ui FocusWidget addMouseOverHandler
public HandlerRegistration addMouseOverHandler(MouseOverHandler handler)
From source file:org.pepstock.jem.gwt.client.commons.Tooltip.java
License:Open Source License
/** * Build a tooltip and adds it to a {@link FocusWidget} * @param widget the widget that will show this tooltip * @param tooltipText the tooltip text/*from w w w. j a v a 2 s .c om*/ */ public Tooltip(FocusWidget widget, String tooltipText) { super(true, false); this.widget = widget; setStyleName(Styles.INSTANCE.tooltip().tooltipBox()); Grid content = new Grid(2, 1); content.setBorderWidth(0); content.setCellPadding(0); content.setCellSpacing(0); content.setStyleName(Styles.INSTANCE.tooltip().tooltipBox()); Image arrow = new Image(Images.INSTANCE.tooltipArrow()); content.getRowFormatter().setStyleName(0, Styles.INSTANCE.tooltip().tooltipArrow()); HTML text = new HTML(tooltipText); text.setStyleName(Styles.INSTANCE.tooltip().tooltipText()); content.setWidget(0, 0, arrow); content.setWidget(1, 0, text); setWidget(content); // add mouse handlers widget.addMouseOverHandler(new OnMouseOver()); widget.addMouseOutHandler(new OnMouseOut()); // enable animation setAnimationEnabled(true); animation = new FadeAnimation(this.getElement()); }