|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.ShapePortConfiguration
public class ShapePortConfiguration
Fallback implementations for NodePort
implementation
interfaces related to visual representation for the simplest case of
a rectangular port shape.
Constructor Summary | |
---|---|
ShapePortConfiguration()
Initializes a new ShapePortConfiguration instance. |
Method Summary | |
---|---|
void |
calcUnionRect(NodePort port,
java.awt.geom.Rectangle2D r)
Calculates the rectangular union of the specified rectangle and the specified port's bounds. |
boolean |
contains(NodePort port,
double x,
double y)
Returns true if the specified port contains the specified
point and false otherwise. |
boolean |
findIntersection(NodePort port,
double ix,
double iy,
double ox,
double oy,
java.awt.geom.Point2D result)
Returns true if the point i=(ix,iy) lies inside
and the point o=(ox,oy) lies outside the specified port
and false< otherwise. |
YRectangle |
getBounds(NodePort port)
Returns the bounds of the specified port in absolute world (graph) coordinates. |
protected java.awt.Color |
getPortLineColor(NodeRealizer context,
boolean selected)
Deprecated. Use getPortLineColor(NodeRealizer, NodePort, boolean)
instead. |
protected java.awt.Color |
getPortLineColor(NodeRealizer context,
NodePort port,
boolean selected)
Determines the color to draw the border of the specified node port. |
protected java.awt.Paint |
getPortPaint(NodeRealizer context,
boolean selected)
Deprecated. Use getPortPaint(NodeRealizer, NodePort, boolean)
instead. |
protected java.awt.Paint |
getPortPaint(NodeRealizer context,
NodePort port,
boolean selected)
Determines the paint to fill the specified node port. |
protected java.awt.Stroke |
getPortStroke(NodeRealizer context,
boolean selected)
Deprecated. Use getPortStroke(NodeRealizer, NodePort, boolean)
instead. |
protected java.awt.Stroke |
getPortStroke(NodeRealizer context,
NodePort port,
boolean selected)
Determines the stroke to use for the border of the specified node port. |
YPoint |
getRatio()
Returns the ratio that is used to determine the edge connection point with respect to the NodePort s bounds. |
YDimension |
getSize()
Returns the size of the visual representation of NodePort s
that use this configuration. |
protected boolean |
initializeFill(NodeRealizer context,
NodePort port,
java.awt.Graphics2D g)
Initializes the graphics context for the filling of the specified port. |
protected boolean |
initializeLine(NodeRealizer context,
NodePort port,
java.awt.Graphics2D g)
Initializes the graphics context for the drawing of the border of the specified port. |
void |
paint(NodePort port,
java.awt.Graphics2D g)
Paints the specified port. |
protected void |
paintSelectionBox(NodeRealizer context,
NodePort port,
java.awt.Graphics2D g)
Paints a selection frame for the specified node port if the port's selection state is true . |
void |
setRatio(double x,
double y)
Specifies the ratio that is used to determine the edge connection point with respect to the NodePort s width. |
void |
setRatio(YPoint ratio)
Specifies the ratio that is used to determine the edge connection point with respect to the NodePort s width. |
void |
setSize(double width,
double height)
Specifies the size of the visual representation of NodePort s
that use this configuration. |
void |
setSize(YDimension size)
Specifies the size of the visual representation of NodePort s
that use this configuration. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ShapePortConfiguration()
ShapePortConfiguration
instance.
Method Detail |
---|
public YDimension getSize()
NodePort
s
that use this configuration.
NodePort
s that use this
configuration.setSize(y.geom.YDimension)
,
setSize(double, double)
public void setSize(YDimension size)
NodePort
s
that use this configuration.
size
- the new size of NodePort
s that use this
configuration.
java.lang.IllegalArgumentException
- it size
is null
or the specified instance's width or height are less than 0
,
NaN
, or infinitely large in magnitude.getSize()
,
setSize(double, double)
public void setSize(double width, double height)
NodePort
s
that use this configuration.
Calling this method is equivalent to
setSize(new YDimension(width, height))
width
- the new width of NodePort
s that use this
configuration.height
- the new height of NodePort
s that use this
configuration.
java.lang.IllegalArgumentException
- it size
is null
or the specified instance's width or height are less than 0
,
NaN
, or infinitely large in magnitude.getSize()
,
setSize(y.geom.YDimension)
public YPoint getRatio()
NodePort
s bounds.
A x/y value of 0
means the edge connection point is at the
left/top border of the NodePort
's visual representation;
a x/y value of 0.5
means the edge connection point is in the
center of the NodePort
's visual representation;
and a x/y value of 1
means the edge connection point is at the
right/bottom border of the NodePort
's visual representation.
By default, this property is set to (0.5,0.5)
.
setRatio(y.geom.YPoint)
,
setRatio(double, double)
public void setRatio(YPoint ratio)
NodePort
s width.
A x/y value of 0
means the edge connection point is at the
left/top border of the NodePort
's visual representation;
a x/y value of 0.5
means the edge connection point is in the
center of the NodePort
's visual representation;
and a x/y value of 1
means the edge connection point is at the
right/bottom border of the NodePort
's visual representation.
By default, this property is set to (0.5,0.5)
.
ratio
- a value in [0,1]^2.
java.lang.IllegalArgumentException
- if x/y is less than 0
,
larger than 1
, or NaN
.getRatio()
,
setRatio(double, double)
public void setRatio(double x, double y)
NodePort
s width.
Calling this method is equivalent to
setRatio(new YPoint(x, y))
x
- a value in [0,1].y
- a value in [0,1].
java.lang.IllegalArgumentException
- if x/y is less than 0
,
larger than 1
, or NaN
.getRatio()
,
setRatio(double, double)
public boolean contains(NodePort port, double x, double y)
NodePort.ContainsTest
true
if the specified port contains the specified
point and false
otherwise.
Callback method for NodePort.contains(double, double)
.
contains
in interface NodePort.ContainsTest
port
- the port instance to check.x
- the x-coordinate of the point to check.y
- the y-coordinate of the point to check.
true
if the specified port contains the specified
point and false
otherwise.public boolean findIntersection(NodePort port, double ix, double iy, double ox, double oy, java.awt.geom.Point2D result)
NodePort.IntersectionTest
true
if the point i=(ix,iy)
lies inside
and the point o=(ox,oy)
lies outside the specified port
and false<
otherwise.
Callback method for
NodePort.findIntersection(double, double, double, double, java.awt.geom.Point2D)
.
findIntersection
in interface NodePort.IntersectionTest
port
- the port instance to check.ix
- the x-coordinate of the point that has to lie inside the port.iy
- the y-coordinate of the point that has to lie inside the port.ox
- the x-coordinate of the point that has to lie outside the port.oy
- the y-coordinate of the point that has to lie outside the port.result
- an output parameter to store the intersection of the line
segment through i
and o
and the port.
If this method returns false
, the value of this parameter is
undefined.
true
if (ix,iy)
lies inside and
(ox,oy)
lies outside the specified port and
false<
otherwise.public void paint(NodePort port, java.awt.Graphics2D g)
initializeFill
, initializeLine
, and
paintSelectionBox
.
paint
in interface NodePort.Painter
port
- the port instance to paint.g
- the graphics context to paint upon.initializeFill(NodeRealizer, NodePort, java.awt.Graphics2D)
,
initializeLine(NodeRealizer, NodePort, java.awt.Graphics2D)
,
paintSelectionBox(NodeRealizer, NodePort, java.awt.Graphics2D)
protected void paintSelectionBox(NodeRealizer context, NodePort port, java.awt.Graphics2D g)
selection state
is true
.
Called from paint
.
context
- the realizer whose NodePort
s are painted.port
- the NodePort
instance that is painted.g
- the graphics context to paint upon.paint(NodePort, java.awt.Graphics2D)
protected boolean initializeFill(NodeRealizer context, NodePort port, java.awt.Graphics2D g)
false
the node should not be filled.
Called from paint
.
context
- the realizer whose NodePort
s are painted.port
- the NodePort
instance that is painted.g
- the graphics context to paint upon.
true
if the interior of the specified port should be
filled; false
otherwise.paint(NodePort, java.awt.Graphics2D)
protected java.awt.Paint getPortPaint(NodeRealizer context, NodePort port, boolean selected)
initializeFill
.
context
- the realizer whose NodePort
s are painted.port
- the NodePort
instance that is painted.selected
- the selection state of the NodePort
instance
that is painted.
null
if the interior of the port should not be filled at all.initializeFill(NodeRealizer, NodePort, java.awt.Graphics2D)
protected java.awt.Paint getPortPaint(NodeRealizer context, boolean selected)
getPortPaint(NodeRealizer, NodePort, boolean)
instead.
NodePort
s
associated to the specified realizer.
context
- the realizer whose NodePort
s are painted.selected
- the selection state of the NodePort
instance
that is painted.
NodePort
s
associated to the specified realizer or null
if the interior
of NodePort
s should not be filled at all.protected boolean initializeLine(NodeRealizer context, NodePort port, java.awt.Graphics2D g)
false
no border should be drawn.
Called from paint
.
context
- the realizer whose NodePort
s are painted.port
- the NodePort
instance that is painted.g
- the graphics context to paint upon.
true
if the border of the specified ports should
be drawn; false
otherwise.paint(NodePort, java.awt.Graphics2D)
protected java.awt.Stroke getPortStroke(NodeRealizer context, NodePort port, boolean selected)
initializeLine
.
context
- the realizer whose NodePort
s are painted.port
- the NodePort
instance that is painted.selected
- the selection state of the NodePort
instance
that is painted.
null
if no border should be drawn.protected java.awt.Stroke getPortStroke(NodeRealizer context, boolean selected)
getPortStroke(NodeRealizer, NodePort, boolean)
instead.
NodePort
s
associated to the specified realizer.
context
- the realizer whose NodePort
s are painted.selected
- the selection state of the NodePort
instance
that is painted.
NodePort
s
associated to the specified realizer or null
if no border
should be drawn.protected java.awt.Color getPortLineColor(NodeRealizer context, NodePort port, boolean selected)
initializeLine
.
context
- the realizer whose NodePort
s are painted.port
- the NodePort
instance that is painted.selected
- the selection state of the NodePort
instance
that is painted.
null
if no border should be drawn.protected java.awt.Color getPortLineColor(NodeRealizer context, boolean selected)
getPortLineColor(NodeRealizer, NodePort, boolean)
instead.
NodePort
s
associated with the specified realizer.
The default implementation checks whether the context realizer has a line color set and if so returns that color; otherwise black is returned.
context
- the realizer whose NodePort
s are painted.selected
- the selection state of the NodePort
instance
that is painted.
NodePort
s associated to
the specified realizer or null
if no border should be drawn.public YRectangle getBounds(NodePort port)
NodePort.BoundsProvider
Callback method for NodePort.getBounds()
.
getBounds
in interface NodePort.BoundsProvider
port
- the port instance whose bounds have to be determined.
public void calcUnionRect(NodePort port, java.awt.geom.Rectangle2D r)
NodePort.UnionRectCalculator
Callback method for
NodePort.calcUnionRect(java.awt.geom.Rectangle2D)
.
calcUnionRect
in interface NodePort.UnionRectCalculator
port
- the port instance whose bounds have to be added to the given
rectangle.r
- the rectangle to be enlarged such that it contains the
bounds of the specified port.
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |