JGraph X 0.15.0.3


com.mxgraph.swing.handler
Class mxEdgeHandler

java.lang.Object
  extended by com.mxgraph.swing.handler.mxCellHandler
      extended by com.mxgraph.swing.handler.mxEdgeHandler
Direct Known Subclasses:
mxElbowEdgeHandler

public class mxEdgeHandler
extends mxCellHandler


Field Summary
protected  boolean cloneEnabled
           
protected  boolean constrainedEvent
          Workaround for shift-key-state not correct in mouseReleased.
protected  String error
           
protected  boolean gridEnabledEvent
          Workaround for alt-key-state not correct in mouseReleased.
protected  mxCellMarker marker
           
protected  Point[] p
           
 
Fields inherited from class com.mxgraph.swing.handler.mxCellHandler
graphComponent, handles, handlesVisible, index, labelMovable, preview, start, state
 
Constructor Summary
mxEdgeHandler(mxGraphComponent graphComponent, mxCellState state)
           
 
Method Summary
protected  void connect(Object edge, Object terminal, boolean isSource, boolean isClone)
          Connects the given edge to the given source or target terminal.
protected  mxPoint convertPoint(mxPoint point, boolean gridEnabled)
           
protected  Rectangle createHandle(Point center)
           
protected  Rectangle createHandle(Point center, int size)
           
protected  Rectangle[] createHandles()
           
protected  Point[] createPoints(mxCellState s)
           
protected  JComponent createPreview()
           
protected  Cursor getCursor(MouseEvent e, int index)
           
protected  Color getHandleFillColor(int index)
           
protected  int getIndexAt(int x, int y)
           
protected  Rectangle getPreviewBounds()
           
 boolean isCloneEnabled()
           
protected  boolean isFlipEvent(MouseEvent e)
           
protected  boolean isIgnoredEvent(MouseEvent e)
          No flip event is ignored.
 boolean isSource(int index)
          Returns true if the current index is 0.
 boolean isTarget(int index)
          Returns true if the current index is the last index.
 void mouseDragged(MouseEvent e)
           
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
protected  void moveLabelTo(mxCellState edgeState, double x, double y)
          Moves the label to the given position.
protected  void movePoint(Object edge, int pointIndex, mxPoint point)
          Moves the edges control point with the given index to the given point.
 void paint(Graphics g)
           
 void setCloneEnabled(boolean cloneEnabled)
           
 String validateConnection(Object source, Object target)
          Returns the error message or an empty string if the connection for the given source target pair is not valid.
 
Methods inherited from class com.mxgraph.swing.handler.mxCellHandler
getHandleBorderColor, getHandleCount, getState, getToolTipText, isHandlesVisible, isHandleVisible, isLabel, isLabelMovable, mouseMoved, reset, setHandlesVisible, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cloneEnabled

protected boolean cloneEnabled

p

protected Point[] p

error

protected transient String error

gridEnabledEvent

protected transient boolean gridEnabledEvent
Workaround for alt-key-state not correct in mouseReleased.


constrainedEvent

protected transient boolean constrainedEvent
Workaround for shift-key-state not correct in mouseReleased.


marker

protected mxCellMarker marker
Constructor Detail

mxEdgeHandler

public mxEdgeHandler(mxGraphComponent graphComponent,
                     mxCellState state)
Parameters:
graphComponent -
state -
Method Detail

setCloneEnabled

public void setCloneEnabled(boolean cloneEnabled)

isCloneEnabled

public boolean isCloneEnabled()

isIgnoredEvent

protected boolean isIgnoredEvent(MouseEvent e)
No flip event is ignored.

Overrides:
isIgnoredEvent in class mxCellHandler

isFlipEvent

protected boolean isFlipEvent(MouseEvent e)

validateConnection

public String validateConnection(Object source,
                                 Object target)
Returns the error message or an empty string if the connection for the given source target pair is not valid. Otherwise it returns null.


isSource

public boolean isSource(int index)
Returns true if the current index is 0.


isTarget

public boolean isTarget(int index)
Returns true if the current index is the last index.


createHandles

protected Rectangle[] createHandles()
Overrides:
createHandles in class mxCellHandler

getHandleFillColor

protected Color getHandleFillColor(int index)
Overrides:
getHandleFillColor in class mxCellHandler

getIndexAt

protected int getIndexAt(int x,
                         int y)
Overrides:
getIndexAt in class mxCellHandler
Parameters:
x -
y -
Returns:
Returns the inde of the handle at the given location.

createHandle

protected Rectangle createHandle(Point center)

createHandle

protected Rectangle createHandle(Point center,
                                 int size)

createPoints

protected Point[] createPoints(mxCellState s)

createPreview

protected JComponent createPreview()
Overrides:
createPreview in class mxCellHandler

convertPoint

protected mxPoint convertPoint(mxPoint point,
                               boolean gridEnabled)
Parameters:
point -
gridEnabled -
Returns:
Returns the scaled, translated and grid-aligned point.

getPreviewBounds

protected Rectangle getPreviewBounds()
Returns:
Returns the bounds of the preview.

mousePressed

public void mousePressed(MouseEvent e)
Overrides:
mousePressed in class mxCellHandler

mouseDragged

public void mouseDragged(MouseEvent e)
Overrides:
mouseDragged in class mxCellHandler

mouseReleased

public void mouseReleased(MouseEvent e)
Overrides:
mouseReleased in class mxCellHandler

movePoint

protected void movePoint(Object edge,
                         int pointIndex,
                         mxPoint point)
Moves the edges control point with the given index to the given point.


connect

protected void connect(Object edge,
                       Object terminal,
                       boolean isSource,
                       boolean isClone)
Connects the given edge to the given source or target terminal.

Parameters:
edge -
terminal -
isSource -

moveLabelTo

protected void moveLabelTo(mxCellState edgeState,
                           double x,
                           double y)
Moves the label to the given position.


getCursor

protected Cursor getCursor(MouseEvent e,
                           int index)
Overrides:
getCursor in class mxCellHandler
Returns:
Returns the cursor for the given event and index.

paint

public void paint(Graphics g)
Overrides:
paint in class mxCellHandler

JGraph X 0.15.0.3


Copyright (c) 2008 Gaudenz Alder. All rights reserved.