Search this API

y.view
Class SimpleBendHandler

java.lang.Object
  extended by y.view.SimpleBendHandler
All Implemented Interfaces:
GenericEdgeRealizer.BendHandler

public class SimpleBendHandler
extends java.lang.Object
implements GenericEdgeRealizer.BendHandler

A simple default implementation of GenericEdgeRealizer.BendHandler that poses no restrictions on the number of bends in a GenericEdgeRealizer instance. This implementation mimics the one found in PolyLineEdgeRealizer for example.

 

Constructor Summary
SimpleBendHandler()
           
 
Method Summary
 void bendChanged(EdgeRealizer context, BendList bends, Bend b, double oldX, double oldY)
          This implementation does nothing.
 Bend createBend(EdgeRealizer context, BendList bends, double x, double y, Bend refBend, int dir)
          Adds a new bend before or after the given reference bend.
 int getMinBendCount(EdgeRealizer context)
          This implementation returns 0
 Bend insertBend(EdgeRealizer context, BendList bends, double x, double y)
          Callback method for EdgeRealizer.insertBend(double, double)
 void reInsertBend(EdgeRealizer context, BendList bends, Bend bend, Bend refBend, int dir)
          Callback method for EdgeRealizer.reInsertBend(Bend, Bend, int)
 Bend removeBend(EdgeRealizer context, BendList bends, Bend b)
          Callback method for EdgeRealizer.removeBend(Bend)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleBendHandler

public SimpleBendHandler()
Method Detail

getMinBendCount

public int getMinBendCount(EdgeRealizer context)
This implementation returns 0

Specified by:
getMinBendCount in interface GenericEdgeRealizer.BendHandler
Parameters:
context - the context EdgeRealizer
Returns:
0

createBend

public Bend createBend(EdgeRealizer context,
                       BendList bends,
                       double x,
                       double y,
                       Bend refBend,
                       int dir)
Adds a new bend before or after the given reference bend.

Specified by:
createBend in interface GenericEdgeRealizer.BendHandler
Parameters:
x - X-coordinate of the Bend
y - Y-coordinate of the Bend
refBend - Bend which should be neighbor
dir - indicates if the new Bend should be added before (Graph.BEFORE) or after (Graph.AFTER) the refBend in the bend sequence of the edge
context - the context EdgeRealizer
bends - the current BendList
See Also:
EdgeRealizer.createBend(double, double, Bend, int)

reInsertBend

public void reInsertBend(EdgeRealizer context,
                         BendList bends,
                         Bend bend,
                         Bend refBend,
                         int dir)
Description copied from interface: GenericEdgeRealizer.BendHandler
Callback method for EdgeRealizer.reInsertBend(Bend, Bend, int)

Specified by:
reInsertBend in interface GenericEdgeRealizer.BendHandler
Parameters:
context - the context EdgeRealizer
bends - the current BendList
bend - the bend to be reinserted
refBend - the reference bend
dir - the direction of the insertion, either Graph.BEFORE or Graph.AFTER
See Also:
EdgeRealizer.reInsertBend(Bend, Bend, int)

insertBend

public Bend insertBend(EdgeRealizer context,
                       BendList bends,
                       double x,
                       double y)
Description copied from interface: GenericEdgeRealizer.BendHandler
Callback method for EdgeRealizer.insertBend(double, double)

Specified by:
insertBend in interface GenericEdgeRealizer.BendHandler
Parameters:
context - the context EdgeRealizer
bends - the current BendList
See Also:
EdgeRealizer.insertBend(double, double)

bendChanged

public void bendChanged(EdgeRealizer context,
                        BendList bends,
                        Bend b,
                        double oldX,
                        double oldY)
This implementation does nothing.

Specified by:
bendChanged in interface GenericEdgeRealizer.BendHandler
Parameters:
context - the context EdgeRealizer
bends - the current BendList
b - the bend that changed
oldX - the old x coordinate
oldY - the old y coordinate

removeBend

public Bend removeBend(EdgeRealizer context,
                       BendList bends,
                       Bend b)
Description copied from interface: GenericEdgeRealizer.BendHandler
Callback method for EdgeRealizer.removeBend(Bend)

Specified by:
removeBend in interface GenericEdgeRealizer.BendHandler
Parameters:
context - the context EdgeRealizer
bends - the current BendList
b - the bend to be removed
See Also:
EdgeRealizer.removeBend(Bend)

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