Java Code Examples for com.google.gwt.user.client.ui.Widget.getAbsoluteLeft()

The following are Jave code examples for showing how to use getAbsoluteLeft() of the com.google.gwt.user.client.ui.Widget class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: empiria.player   File: WidgetSizeHelper.java   Source Code and License Vote up 4 votes
private Rectangle toRectangle(Widget widget) {
    return new Rectangle(widget.getAbsoluteLeft(), widget.getAbsoluteTop(), widget.getOffsetWidth(), widget.getOffsetHeight());
}
 
Example 2
Project: appinventor-extensions   File: DragSourceSupport.java   Source Code and License Vote up 3 votes
/**
 * Returns whether the specified widget contains a position given
 * by the absolute coordinates.
 *
 * @param w  widget to test
 * @param absX  absolute x coordinate of position
 * @param absY  absolute y coordinate of position
 * @return  {@code true} if the position is within the widget, {@code false}
 *          otherwise
 */
private static boolean isInside(Widget w, int absX, int absY) {
  int wx = w.getAbsoluteLeft();
  int wy = w.getAbsoluteTop();
  int ww = w.getOffsetWidth();
  int wh = w.getOffsetHeight();

  return (wx <= absX) && (absX < wx + ww) && (wy <= absY) && (absY < wy + wh);
}