kaapo.project
Class ElementWrapper

java.lang.Object
  extended by kaapo.Observable
      extended by kaapo.project.DiagramComponentWrapper
          extended by kaapo.project.ElementWrapper
All Implemented Interfaces:
Serializable, Cloneable

public class ElementWrapper
extends DiagramComponentWrapper

Wrapper class for elements. Element wrapper has information on the position and size of the elemenent.

Author:
hprajani, hkovaska
See Also:
Serialized Form

Field Summary
protected static double MIN_HEIGHT
           
protected static double MIN_WIDTH
           
 
Fields inherited from class kaapo.project.DiagramComponentWrapper
dcgraphics, dComponent, inConnections, outConnections
 
Constructor Summary
ElementWrapper(Element dc, double x, double y)
           
 
Method Summary
 double getCenterX()
          Returns the x coordinate of the center of the element wrapper.
 double getCenterY()
          Returns the y coordinate of the center of the element wrapper.
 double getHeight()
          Returns the height of the element wrapper.
 double getWidth()
          Returns the width of the element wrapper.
 double getX()
          Returns the x coordinate.
 double getY()
          Returns the y coordinate.
 void moveXY(double changeX, double changeY, Selection selection)
          Moves the element wrapper and the connected connection wrappers.
 void setHeight(double height)
          Sets the height of the element wrapper.
 void setSize(double width, double height)
          Sets the size of the element wrapper.
 void setWidth(double width)
          Sets the width of the element wrapper.
 void setX(double x)
          Sets the x coordinate.
 void setXY(double x, double y)
          Sets the location of the element wrapper.
 void setY(double y)
          Sets the y coordinate.
 
Methods inherited from class kaapo.project.DiagramComponentWrapper
addConnection, canMove, canResize, getDCGraphics, getDiagramComponent, getInConnections, getOutConnections, reinstateConnections, removeAllConnections, removeConnection
 
Methods inherited from class kaapo.Observable
addObserver, notifyObservers, notifyObservers, removeAllObservers, removeObserver, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_WIDTH

protected static final double MIN_WIDTH
See Also:
Constant Field Values

MIN_HEIGHT

protected static final double MIN_HEIGHT
See Also:
Constant Field Values
Constructor Detail

ElementWrapper

public ElementWrapper(Element dc,
                      double x,
                      double y)
Method Detail

getHeight

public double getHeight()
Returns the height of the element wrapper.


setHeight

public void setHeight(double height)
Sets the height of the element wrapper. Notifies observers.

Parameters:
height - The new height

getWidth

public double getWidth()
Returns the width of the element wrapper.


setWidth

public void setWidth(double width)
Sets the width of the element wrapper. Notifies observers.

Parameters:
width - The new width

getX

public double getX()
Returns the x coordinate.


setX

public void setX(double x)
Sets the x coordinate. Notifies observers.

Parameters:
x - New x coordinate

getY

public double getY()
Returns the y coordinate.


setY

public void setY(double y)
Sets the y coordinate. Notifies observers.

Parameters:
y - New y coordinate

setXY

public void setXY(double x,
                  double y)
Sets the location of the element wrapper. Notifies observers. Using this method is recommended over calls to setX and setY if you need to set both coordinates.

Parameters:
x - New x coordinate
y - New y coordinate

setSize

public void setSize(double width,
                    double height)
Sets the size of the element wrapper. Notifies observers. Using this method is recommended over calls to setWidth and setHeight if you need to set both values.

Parameters:
width - New width
height - New height

getCenterX

public double getCenterX()
Returns the x coordinate of the center of the element wrapper.


getCenterY

public double getCenterY()
Returns the y coordinate of the center of the element wrapper.


moveXY

public void moveXY(double changeX,
                   double changeY,
                   Selection selection)
Moves the element wrapper and the connected connection wrappers. Notifies the observers.

Specified by:
moveXY in class DiagramComponentWrapper
Parameters:
changeX - the value to add to the x coordinate
changeY - the value to add to the y coordinate
selection - all the moved DiagramComponents