Search this API

y.view
Class PortConfigurationAdapter

java.lang.Object
  extended by y.view.PortConfigurationAdapter
All Implemented Interfaces:
NodePort.ContainsTest, NodePort.IntersectionTest, NodePort.Painter

public class PortConfigurationAdapter
extends java.lang.Object
implements NodePort.Painter, NodePort.ContainsTest, NodePort.IntersectionTest

An adapter class that allows existing implementations of GenericNodeRealizer.Painter, GenericNodeRealizer.IntersectionTest, and GenericNodeRealizer.ContainsTest to be reused in NodePort configurations.

 

Constructor Summary
PortConfigurationAdapter(java.util.Map implementations)
          Initializes a new PortConfigurationAdapter instance.
 
Method Summary
 boolean contains(NodePort port, double x, double y)
          Returns true if the specified port contains the specified point and false otherwise.
protected  NodeRealizer createConfiguredAdapter(NodeRealizer prototype, NodePort port)
          Creates the NodeRealizer adapter instance for GenericNodeRealizer behavior implementations used by this class.
 boolean findIntersection(NodePort port, double ix, double iy, double ox, double oy, java.awt.geom.Point2D result)
          Returns true if the point (ix,iy) lies inside and the point (ox,oy) lies outside the specified port and false< otherwise.
 java.awt.Color getFillColor()
          Returns the main color that is used to fill the interior of NodePorts.
 java.awt.Color getFillColor2()
          Returns the gradient color that is used to fill the interior of NodePorts.
 java.awt.Color getLineColor()
          Returns the color that is used to draw the border of NodePorts.
 LineType getLineType()
          Returns the line type that is used to draw the border of NodePorts.
 boolean isPortSelectionAware()
          Determines whether or not the NodePort selection state should be taken into account when delegating painting to the adopted GenericNodeRealizer.Painter implementation.
 void paint(NodePort port, java.awt.Graphics2D g)
          Paints the specified port.
 void setFillColor(java.awt.Color fillColor)
          Specifies the main color that is used to fill the interior of NodePorts.
 void setFillColor2(java.awt.Color fillColor2)
          Specifies the gradient color that is used to fill the interior of NodePorts.
 void setLineColor(java.awt.Color lineColor)
          Specifies the color that is used to draw the border of NodePorts.
 void setLineType(LineType lineType)
          Specifies the line type that is used to draw the border of NodePorts.
 void setPortSelectionAware(boolean aware)
          Specifies whether or not the NodePort selection state should be taken into account when delegating painting to the adopted GenericNodeRealizer.Painter implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortConfigurationAdapter

public PortConfigurationAdapter(java.util.Map implementations)
Initializes a new PortConfigurationAdapter instance.

Parameters:
implementations - interface implementations for GenericNodeRealizer.Painter, GenericNodeRealizer.IntersectionTest, and/or GenericNodeRealizer.ContainsTest.
Method Detail

isPortSelectionAware

public boolean isPortSelectionAware()
Determines whether or not the NodePort selection state should be taken into account when delegating painting to the adopted GenericNodeRealizer.Painter implementation.

Returns:
true if the NodePort selection state is taken into account for painting and false otherwise.
See Also:
setPortSelectionAware(boolean)

setPortSelectionAware

public void setPortSelectionAware(boolean aware)
Specifies whether or not the NodePort selection state should be taken into account when delegating painting to the adopted GenericNodeRealizer.Painter implementation.

Parameters:
aware - if true, the NodePort selection state is taken into account for painting; otherwise it is not.
See Also:
isPortSelectionAware()

contains

public boolean contains(NodePort port,
                        double x,
                        double y)
Returns true if the specified port contains the specified point and false otherwise.

Delegates to the GenericNodeRealizer.ContainsTest implementation associated to this class.

Specified by:
contains in interface NodePort.ContainsTest
Parameters:
port - the port instance to check.
x - the x-coordinate of the point to check.
y - the y-coordinate of the point to check.
Returns:
true if the specified port contains the specified point and false otherwise.
See Also:
createConfiguredAdapter(NodeRealizer, NodePort)

paint

public void paint(NodePort port,
                  java.awt.Graphics2D g)
Paints the specified port.

Delegates to the GenericNodeRealizer.Painter implementation associated to this class.

Specified by:
paint in interface NodePort.Painter
Parameters:
port - the port instance to paint.
g - the graphics context to paint upon.
See Also:
createConfiguredAdapter(NodeRealizer, NodePort)

findIntersection

public boolean findIntersection(NodePort port,
                                double ix,
                                double iy,
                                double ox,
                                double oy,
                                java.awt.geom.Point2D result)
Returns true if the point (ix,iy) lies inside and the point (ox,oy) lies outside the specified port and false< otherwise.

Delegates to the GenericNodeRealizer.IntersectionTest implementation associated to this class.

Specified by:
findIntersection in interface NodePort.IntersectionTest
Parameters:
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.
Returns:
true if (ix,iy) lies inside and (ox,oy) lies outside the specified port and false< otherwise.
See Also:
createConfiguredAdapter(NodeRealizer, NodePort)

getFillColor

public java.awt.Color getFillColor()
Returns the main color that is used to fill the interior of NodePorts.

Returns:
the main color that is used to fill the interior of NodePorts.
See Also:
setFillColor(java.awt.Color), getFillColor2(), setFillColor2(java.awt.Color)

setFillColor

public void setFillColor(java.awt.Color fillColor)
Specifies the main color that is used to fill the interior of NodePorts.

Parameters:
fillColor - the main color that is used to fill the interior of NodePorts.
See Also:
getFillColor(), getFillColor2(), setFillColor2(java.awt.Color)

getFillColor2

public java.awt.Color getFillColor2()
Returns the gradient color that is used to fill the interior of NodePorts.

Returns:
the gradient color that is used to fill the interior of NodePorts.
See Also:
setFillColor2(java.awt.Color), getFillColor(), setFillColor(java.awt.Color)

setFillColor2

public void setFillColor2(java.awt.Color fillColor2)
Specifies the gradient color that is used to fill the interior of NodePorts.

Parameters:
fillColor2 - the gradient color that is used to fill the interior of NodePorts.
See Also:
getFillColor2(), getFillColor(), setFillColor(java.awt.Color)

getLineColor

public java.awt.Color getLineColor()
Returns the color that is used to draw the border of NodePorts.

Returns:
the color that is used to draw the border of NodePorts.
See Also:
setLineColor(java.awt.Color)

setLineColor

public void setLineColor(java.awt.Color lineColor)
Specifies the color that is used to draw the border of NodePorts.

Parameters:
lineColor - the color that is used to draw the border of NodePorts.
See Also:
getLineColor()

getLineType

public LineType getLineType()
Returns the line type that is used to draw the border of NodePorts.

Returns:
the line type that is used to draw the border of NodePorts.
See Also:
setLineType(LineType)

setLineType

public void setLineType(LineType lineType)
Specifies the line type that is used to draw the border of NodePorts.

Parameters:
lineType - the line type that is used to draw the border of NodePorts.
See Also:
getLineType()

createConfiguredAdapter

protected NodeRealizer createConfiguredAdapter(NodeRealizer prototype,
                                               NodePort port)
Creates the NodeRealizer adapter instance for GenericNodeRealizer behavior implementations used by this class.

The default implementation creates a GenericNodeRealizer copy of the specified prototype realizer and adopts the port's bounds as well as the port's selection state.

Called from contains(NodePort, double, double), findIntersection(NodePort, double, double, double, double, java.awt.geom.Point2D), and paint(NodePort, java.awt.Graphics2D).

Parameters:
prototype - a GenericNodeRealizer instance
port - the NodePort instance that is represented by the created NodeRealizer instance.
Returns:
a GenericNodeRealizer that represents the specified NodePort instance.
See Also:
contains(NodePort, double, double), findIntersection(NodePort, double, double, double, double, java.awt.geom.Point2D), paint(NodePort, java.awt.Graphics2D)

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