org.openmali.types.twodee
Class ExtRect2i

java.lang.Object
  extended by org.openmali.types.twodee.Rect2i
      extended by org.openmali.types.twodee.ExtRect2i
All Implemented Interfaces:
ExtPositioned2i, ExtSized2i, Positioned2i, Positioned2iRO, Sized2i, Sized2iRO

public class ExtRect2i
extends Rect2i
implements ExtPositioned2i, ExtSized2i

A basic 2-dimensional rectangle.


Field Summary
 
Fields inherited from class org.openmali.types.twodee.Rect2i
isDirty
 
Constructor Summary
ExtRect2i()
          Creates a new 2-dimensional rectangle with zero position and size.
ExtRect2i(ExtRect2i template)
          Creates a new 2-dimensional rectangle and copies the template's coordinates.
ExtRect2i(int left, int top, int width, int height)
          Creates a new 2-dimensional rectangle.
 
Method Summary
 void addRepositionListener(RepositionListener2i listener)
          Adds a new RepositionListener2i.
 void addResizeListener(ResizeListener2i listener)
          Adds a new ResizeListener2i.
protected  void fireRepositionEvent(int oldLeft, int oldTop, int newLeft, int newTop)
           
protected  void fireResizeEvent(int oldWidth, int oldHeight, int newWidth, int newHeight)
           
 void removeRepositionListener(RepositionListener2i listener)
          Removes the given RepositionListener2i from the List, if it was present.
 void removeResizeListener(ResizeListener2i listener)
          Removes the given ResizeListener2i from the List, if it was present.
 ExtRect2i setLocation(int left, int top)
          Sets the upper-left corner's coordinates.
 ExtRect2i setSize(int width, int height)
          Sets the size.
 
Methods inherited from class org.openmali.types.twodee.Rect2i
clamp, clamp, combine, combine, covers, covers, equals, equals, fromPool, fromPool, getArea, getAspect, getHeight, getLeft, getLocation, getMatchFactor, getMatchFactor, getTop, getWidth, intersects, intersects, isCoveredBy, isCoveredBy, isDirty, set, set, set, setClean, setHeight, setLocation, setSize, setSize, setWidth, toPool, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.openmali.types.twodee.Positioned2i
setLocation
 
Methods inherited from interface org.openmali.types.twodee.Positioned2iRO
getLeft, getLocation, getTop
 
Methods inherited from interface org.openmali.types.twodee.Sized2i
setHeight, setSize, setSize, setWidth
 
Methods inherited from interface org.openmali.types.twodee.Sized2iRO
getAspect, getHeight, getWidth
 

Constructor Detail

ExtRect2i

public ExtRect2i(int left,
                 int top,
                 int width,
                 int height)
Creates a new 2-dimensional rectangle.

Parameters:
left - the upper-left corner's x-coordinate
top - the upper-left corner's y-coordinate
width - the rectangle's width
height - the rectangle's height

ExtRect2i

public ExtRect2i(ExtRect2i template)
Creates a new 2-dimensional rectangle and copies the template's coordinates.

Parameters:
template -

ExtRect2i

public ExtRect2i()
Creates a new 2-dimensional rectangle with zero position and size.

Method Detail

addRepositionListener

public void addRepositionListener(RepositionListener2i listener)
Adds a new RepositionListener2i. The event is fired from the rendering thread, if necessary.

Specified by:
addRepositionListener in interface ExtPositioned2i

removeRepositionListener

public void removeRepositionListener(RepositionListener2i listener)
Removes the given RepositionListener2i from the List, if it was present.

Specified by:
removeRepositionListener in interface ExtPositioned2i

fireRepositionEvent

protected void fireRepositionEvent(int oldLeft,
                                   int oldTop,
                                   int newLeft,
                                   int newTop)

addResizeListener

public void addResizeListener(ResizeListener2i listener)
Adds a new ResizeListener2i. The event is fired from the rendering thread, if necessary.

Specified by:
addResizeListener in interface ExtSized2i

removeResizeListener

public void removeResizeListener(ResizeListener2i listener)
Removes the given ResizeListener2i from the List, if it was present.

Specified by:
removeResizeListener in interface ExtSized2i

fireResizeEvent

protected void fireResizeEvent(int oldWidth,
                               int oldHeight,
                               int newWidth,
                               int newHeight)

setLocation

public ExtRect2i setLocation(int left,
                             int top)
Sets the upper-left corner's coordinates.

Specified by:
setLocation in interface Positioned2i
Overrides:
setLocation in class Rect2i
Parameters:
left -
top -
Returns:
true, if the location actually has changed

setSize

public ExtRect2i setSize(int width,
                         int height)
Sets the size.

Specified by:
setSize in interface Sized2i
Overrides:
setSize in class Rect2i
Returns:
this instance back again.