NAME

yEd::Node - Base class for Nodes

DESCRIPTION

This is the base class for Nodes. It may not be instanciated, instead use one of the specialized types as described in the SUPPORTED FEATURES section.

SUPPORTED FEATURES

The following Node types are currently supported:

The following types and features are currently not supported (and it's not sure they'll ever be):

  • Group/Folder type Nodes (e.g. group 'Group Nodes')

  • Table type Nodes (e.g. group "Swimlane Nodes and Tables")

  • SVG type Nodes (e.g. group "People")

  • Adding meta data to Nodes or edit the present ones (e.g. URL, description)

All other basic features of Nodes (yEd Version 3.13) are supported.

Support beyond yEd:

  • You may specify Nodes to be relative to other Nodes (see relative property)

  • You may add multiple Labels to a single Node (yEd will handle it properly)

PROPERTIES

layer

Type: uint

Default: 0

The drawing pane layer this Node is on.

relative

Type: yEd::Node or 0 to erase relation

Default: 0

If a Node reference is set here, this Nodes x and y properties will be interpreted as being relative to the given Node.

Beware of creating loops !

id

This property is read only and returns the Nodes ID.

x

Type: float

Default: 0

The x position (upper left corner).

y

Type: float

Default: 0

The y position (upper left corner).

height

Type: ufloat

Default: 30

The height of the Node.

width

Type: ufloat

Default: 30

The width of the Node.

fillColor

Type: '#0000fa' (rgb) or '#000000cc' (rgb + transparency) java.awt.Color hex form or 'none'

Default: '#ffcc00'

The background color.

fillColor2

Type: '#0000fa' (rgb) or '#000000cc' (rgb + transparency) java.awt.Color hex form or 'none'

Default: 'none'

The second background color (will be ignored if fillColor is 'none').

borderColor

Type: '#0000fa' (rgb) or '#000000cc' (rgb + transparency) java.awt.Color hex form or 'none'

Default: '#000000'

The color for the border line.

borderType

Type: descrete values ( line | dotted | dashed | dashed_dotted )

Default: 'line'

Linetype of the border.

borderWidth

Type: ufloat

Default: 1

The width of the border.

SUBROUTINES/METHODS

new

Creates a new instance of a Node.

An ID must be provided as first parameter. This value may be any string or number but must be unique among the whole yEd::Document. If you don't want to bother with IDs use the addNewNode function of yEd::Document instead, it will take care of the IDs.

Further parameters to set properties are optional (property => value, ...).

copy

Creates a copy of this Node and returns it.

Also copies all attached Labels.

An ID must be given as first parameter as described in the Node classes constructors, it will be applied to the copy.

You may optionally specify properties in the form 'property => value, ...' to change these properties for the returned copy.

If this Node is relative to another one you will want to set a new relation partner for the copy or make it absolute.

absX

Returns the absolute x value for this Node which equals $node->x() unless $node->relative($node2) was set. In this case $node->absX() is $node2->absX() + $node->x().

absY

Returns the absolute y value for this Node which equals $node->y() unless $node->relative($node2) was set. In this case $node->absY() is $node2->absY() + $node->y().

absCenter

Returns the absolute (x,y) values for this Node's center (as an array of 2 elements: x and y). Note that normal coords indicate the upper left corner of a Node or better its surrounding rectangle (circles, ...). So it is better to say: This returns the center of the surrounding rectangle.

getEdges

Returns an array of all Edges (as references) connected to this Node.

addNewLabel

Takes a value for the text property of Labels followed by optional Label properties ('property' => 'value', ...) and creates and adds a new Label from it.

Returns a ref to the Label object.

addLabel

Takes yEd::Label::NodeLabel object and adds it.

labels

Acts as a getter with no parameters provided and returns an array of all Labels attached to this Node.

If an array of yEd::Label::NodeLabel objects is provided, this nodes Labels are replaced by the given Labels.

clearLabels

Removes all Labels from this Node.

getLabelsByProperties

Takes arguments of the form 'property1 => value, property2 => value2, ...'.

Returns a list of all Labels that matches the given filter.

setProperties getProperties hasProperties

As described at yEd::PropertyBasedObject

SEE ALSO

yEd::Document for further informations about the whole package

yEd::PropertyBasedObject for further basic information about properties and their additional functions

The specialized Nodes:

yEd::Node::ShapeNode

yEd::Node::GenericNode