com.allen_sauer.gwt.dnd.client.util
Class WidgetLocation

java.lang.Object
  extended by com.allen_sauer.gwt.dnd.client.util.AbstractLocation
      extended by com.allen_sauer.gwt.dnd.client.util.WidgetLocation
All Implemented Interfaces:
Location

public class WidgetLocation
extends AbstractLocation


Constructor Summary
WidgetLocation(com.google.gwt.user.client.ui.Widget widget, com.google.gwt.user.client.ui.Widget reference)
          Determine location of widget relative to reference, such that referencePanel.add(widget, location.getLeft(), location.getTop()) leaves the widget in the exact same location on the screen.
 
Method Summary
 void constrain(int minLeft, int minTop, int maxLeft, int maxTop)
          Constrain the widget location to the provided minimum and maximum values.
 int getLeft()
          Get x coordinate.
 int getTop()
          Get the y coordinate.
 java.lang.String toString()
          Textual representation of this location formatted as (x, y).
 
Methods inherited from class com.allen_sauer.gwt.dnd.client.util.AbstractLocation
newLocationSnappedToGrid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WidgetLocation

public WidgetLocation(com.google.gwt.user.client.ui.Widget widget,
                      com.google.gwt.user.client.ui.Widget reference)
Determine location of widget relative to reference, such that referencePanel.add(widget, location.getLeft(), location.getTop()) leaves the widget in the exact same location on the screen. Note that reference need not be the parent node, or even an ancestor of widget. Therefore coordinates returned may be negative or may exceed the dimensions of reference.

Parameters:
widget - the widget whose coordinates we seek
reference - the widget relative to which we seek our coordinates
Method Detail

constrain

public void constrain(int minLeft,
                      int minTop,
                      int maxLeft,
                      int maxTop)
Constrain the widget location to the provided minimum and maximum values.

Parameters:
minLeft - the minimum left value
minTop - the minimum top value
maxLeft - the maximum left value
maxTop - the maximum top value

getLeft

public int getLeft()
Description copied from interface: Location
Get x coordinate.

Returns:
the left offset in pixels

getTop

public int getTop()
Description copied from interface: Location
Get the y coordinate.

Returns:
the top offset in pixels

toString

public java.lang.String toString()
Description copied from class: AbstractLocation
Textual representation of this location formatted as (x, y).

Overrides:
toString in class AbstractLocation
Returns:
a string representation of this location


Copyright © 2011 Sage Software, Inc. All rights reserved.