org.nakedobjects.plugins.dnd.viewer.drawing
Class Bounds

java.lang.Object
  extended by org.nakedobjects.plugins.dnd.viewer.drawing.Bounds

public class Bounds
extends java.lang.Object

Bounds represent a rectangular area on the screen. The top-left corner is represented by the location (available using getLocation(), and getX() and getY()). The extent of the bounds is specified by its height and width (available using getHeight() and getWidth()). The bottom-right point is the offset from the top-left point by width -1 and hieght - 1 pixels. For example a bounds created as follows new Bounds(5, 10, 10, 20) Would represent a rectangle at location (5, 10), with a width of 10 pixels and a height of 20. Note, hower that the lower-right corner would be at (14, 29), as there are 10 pixels between pixel 5 and pixel 14, and 20 between 10 and 29.


Constructor Summary
Bounds()
           
Bounds(Bounds bounds)
           
Bounds(int x, int y, int width, int height)
           
Bounds(Location location, Size size)
           
Bounds(Size size)
           
 
Method Summary
 boolean contains(Location location)
           
 void contract(int width, int height)
           
 void contract(Padding padding)
           
 void contract(Size size)
           
 void contractHeight(int height)
           
 void contractWidth(int width)
           
 void ensureHeight(int height)
           
 void ensureWidth(int width)
           
 boolean equals(java.lang.Object obj)
           
 void extend(int width, int height)
           
 void extend(Padding padding)
           
 void extend(Size size)
           
 void extendHeight(int height)
           
 void extendWidth(int width)
           
 int getHeight()
           
 Location getLocation()
           
 Size getSize()
           
 int getWidth()
           
 int getX()
           
 int getX2()
           
 int getY()
           
 int getY2()
           
 boolean intersects(Bounds bounds)
          Determines whether this bounds overlaps the specified bounds.
 boolean limitBounds(Bounds toLimit)
          Limits the specified bounds so that it fits within this bounds.
 void limitLocation(Size bounds)
           
 void setBounds(Bounds bounds)
           
 void setHeight(int height)
           
 void setWidth(int width)
           
 void setX(int x)
           
 void setY(int y)
           
 java.lang.String toString()
           
 void translate(int x, int y)
           
 void union(Bounds bounds)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Bounds

public Bounds()

Bounds

public Bounds(Bounds bounds)

Bounds

public Bounds(int x,
              int y,
              int width,
              int height)

Bounds

public Bounds(Location location,
              Size size)

Bounds

public Bounds(Size size)
Method Detail

contains

public boolean contains(Location location)

contract

public void contract(int width,
                     int height)

contract

public void contract(Padding padding)

contract

public void contract(Size size)

contractHeight

public void contractHeight(int height)

contractWidth

public void contractWidth(int width)

ensureHeight

public void ensureHeight(int height)

ensureWidth

public void ensureWidth(int width)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

extend

public void extend(int width,
                   int height)

extend

public void extend(Padding padding)

extend

public void extend(Size size)

extendHeight

public void extendHeight(int height)

extendWidth

public void extendWidth(int width)

getHeight

public int getHeight()

getLocation

public Location getLocation()

getSize

public Size getSize()

getWidth

public int getWidth()

getX

public int getX()

getX2

public int getX2()

getY

public int getY()

getY2

public int getY2()

intersects

public boolean intersects(Bounds bounds)
Determines whether this bounds overlaps the specified bounds. If any area is shared by the two bounds then this will return true. As the edges of the bounds are of a finite size the bounds overlap if any of the edges overlap.


limitLocation

public void limitLocation(Size bounds)

limitBounds

public boolean limitBounds(Bounds toLimit)
Limits the specified bounds so that it fits within this bounds.


setBounds

public void setBounds(Bounds bounds)

setHeight

public void setHeight(int height)

setWidth

public void setWidth(int width)

setX

public void setX(int x)

setY

public void setY(int y)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

translate

public void translate(int x,
                      int y)

union

public void union(Bounds bounds)


Copyright © 2001-2009 Naked Objects Group Ltd.. All Rights Reserved.