Search this API

y.layout
Class DefaultNodeLayout

java.lang.Object
  extended by y.layout.DefaultNodeLayout
All Implemented Interfaces:
NodeLayout

public class DefaultNodeLayout
extends java.lang.Object
implements NodeLayout

DefaultNodeLayout is the default implementation of the NodeLayout interface.

The layout information consists of the size and position of the node.

 

Field Summary
protected  double h
          Holds the height of the NodeLayout bounds.
protected  double w
          Holds the width of the NodeLayout bounds.
protected  double x
          Holds the minimum x-coordinates of the NodeLayout bounds.
protected  double y
          Holds the minimum y-coordinates of the NodeLayout bounds.
 
Constructor Summary
DefaultNodeLayout()
          Creates a new DefaultNodeLayout instance with default settings.
DefaultNodeLayout(double x, double y, double width, double height)
          Creates a new DefaultNodeLayout instance with the specified box.
DefaultNodeLayout(NodeLayout layout)
          Creates a new DefaultNodeLayout instance which copies the given NodeLayout.
DefaultNodeLayout(YPoint location, YDimension size)
          Creates a new DefaultNodeLayout instance with given location and size.
 
Method Summary
 double getHeight()
          Returns the height of the node.
 double getWidth()
          Returns the width of the node.
 double getX()
          Returns the x-coordinate of the upper-left corner of the node.
 double getY()
          Returns the y-coordinate of the upper-left corner of the node.
 void setCenter(double x, double y)
          Specifies the coordinates of the node's center.
 void setHeight(double height)
          Specifies the height of the node.
 void setLocation(double x, double y)
          Sets the coordinates of the upper-left corner of the node.
 void setSize(double width, double height)
          Sets the size of the node.
 void setWidth(double width)
          Specifies the width of the node.
 void setX(double x)
          Specifies the x-coordinate of the upper-left corner of the node.
 void setY(double y)
          Specifies the y-coordinate of the upper-left corner of the node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

protected double x
Holds the minimum x-coordinates of the NodeLayout bounds.


y

protected double y
Holds the minimum y-coordinates of the NodeLayout bounds.


w

protected double w
Holds the width of the NodeLayout bounds.


h

protected double h
Holds the height of the NodeLayout bounds.

Constructor Detail

DefaultNodeLayout

public DefaultNodeLayout()
Creates a new DefaultNodeLayout instance with default settings.


DefaultNodeLayout

public DefaultNodeLayout(NodeLayout layout)
Creates a new DefaultNodeLayout instance which copies the given NodeLayout.

Parameters:
layout - the NodeLayout that is copied

DefaultNodeLayout

public DefaultNodeLayout(double x,
                         double y,
                         double width,
                         double height)
Creates a new DefaultNodeLayout instance with the specified box.

Parameters:
x - the absolute x-coordinate of the upper-left corner of the NodeLayout
y - the absolute y-coordinate of the upper-left corner of the NodeLayout
width - the width of the NodeLayout
height - the height of the NodeLayout

DefaultNodeLayout

public DefaultNodeLayout(YPoint location,
                         YDimension size)
Creates a new DefaultNodeLayout instance with given location and size.

Parameters:
location - the coordinates of the upper-left corner of the NodeLayout
size - the size of the NodeLayout
Method Detail

setLocation

public void setLocation(double x,
                        double y)
Description copied from interface: NodeLayout
Sets the coordinates of the upper-left corner of the node.

Specified by:
setLocation in interface NodeLayout
Parameters:
x - the new x-coordinate of the node
y - the new y-coordinate of the node

setCenter

public void setCenter(double x,
                      double y)
Specifies the coordinates of the node's center.

Parameters:
x - the absolute x-coordinate of the center
y - the absolute y-coordinate of the center

setSize

public void setSize(double width,
                    double height)
Description copied from interface: NodeLayout
Sets the size of the node.

Specified by:
setSize in interface NodeLayout
Parameters:
width - the new width of the node
height - the new height of the node

setHeight

public void setHeight(double height)
Specifies the height of the node.

The height of the node is the vertical distance the node spans.

Parameters:
height - the height of the node

setWidth

public void setWidth(double width)
Specifies the width of the node.

The width of the node is the horizontal distance the node spans.

Parameters:
width - the width of the node

setX

public void setX(double x)
Specifies the x-coordinate of the upper-left corner of the node.

The location of the node is described by the coordinates of the upper-left corner of the node.

Parameters:
x - the x-coordinate of the node

setY

public void setY(double y)
Specifies the y-coordinate of the upper-left corner of the node.

The location of the node is described by the coordinates of the upper-left corner of the node.

Parameters:
y - the y-coordinate of the node

getHeight

public double getHeight()
Returns the height of the node.

The height of the node is the vertical distance the node spans.

Specified by:
getHeight in interface NodeLayout
Returns:
the height of the node
See Also:
setHeight(double)

getWidth

public double getWidth()
Returns the width of the node.

The width of the node is the horizontal distance the node spans.

Specified by:
getWidth in interface NodeLayout
Returns:
the width of the node
See Also:
setWidth(double)

getX

public double getX()
Returns the x-coordinate of the upper-left corner of the node.

The location of the node is described by the coordinates of the upper-left corner of the node.

Specified by:
getX in interface NodeLayout
Returns:
the x-coordinate of the node
See Also:
setX(double)

getY

public double getY()
Returns the y-coordinate of the upper-left corner of the node.

The location of the node is described by the coordinates of the upper-left corner of the node.

Specified by:
getY in interface NodeLayout
Returns:
the y-coordinate of the node
See Also:
setY(double)

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.