Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JGraph X 1.4.0.9
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.mxgraph.swing.handler
Class mxConnectionHandler

    java.lang.Object
      com.mxgraph.swing.util.mxMouseAdapter
          com.mxgraph.swing.handler.mxConnectionHandler

All Implemented Interfaces:
  MouseListener, MouseMotionListener, EventListener

    public class mxConnectionHandler

extends mxMouseAdapter

Connection handler creates new connections between cells. This control is used to display the connector icon, while the preview is used to draw the line.

Field Summary
`protected Rectangle` | `bounds`
`static Cursor` | `CONNECT_CURSOR`
`protected ImageIcon` | `connectIcon` Specifies the icon to be used for creating new connections.
`protected mxConnectPreview` | `connectPreview`
`protected boolean` | `createTarget` Specifies if the source should be cloned and used as a target if no target was selected.
`protected boolean` | `enabled`
`protected String` | `error`
`protected Point` | `first`
`protected mxGraphComponent` | `graphComponent`
`protected boolean` | `handleEnabled` Specifies if a handle should be used for creating new connections.
`protected int` | `handleSize` Specifies the size of the handle to be used for creating new connections.
`protected boolean` | `keepOnTop` Appearance and event handling order wrt subhandles.
`protected mxCellMarker` | `marker`
`protected mxEventSource.mxIEventListener` | `resetHandler`
`protected boolean` | `select`
`protected mxCellState` | `source`

Constructor Summary
`mxConnectionHandler(mxGraphComponent graphComponent)`

Method Summary
`protected mxConnectPreview` | `createConnectPreview()`
`Object` | `createTargetVertex(MouseEvent e, Object source)`
`ImageIcon` | `getConnecIcon()`
`mxConnectPreview` | `getConnectPreview()`
`int` | `getHandleSize()`
`mxCellMarker` | `getMarker()`
`boolean` | `isConnecting()` Returns true if the source terminal has been clicked and a new connection is currently being previewed.
`boolean` | `isCreateTarget()`
`boolean` | `isEnabled()`
`boolean` | `isHandleEnabled()`
`boolean` | `isHighlighting()` Returns true if no connectIcon is specified and handleEnabled is false.
`boolean` | `isKeepOnTop()`
`boolean` | `isSelect()`
`boolean` | `isValidSource(Object cell)`
`boolean` | `isValidTarget(Object cell)` Returns true.
`void` | `mouseDragged(MouseEvent e)`
`void` | `mouseMoved(MouseEvent e)`
`void` | `mousePressed(MouseEvent e)`
`void` | `mouseReleased(MouseEvent e)`
`void` | `paint(Graphics g)`
`void` | `reset()`
`void` | `setBounds(Rectangle value)`
`void` | `setConnectIcon(ImageIcon value)`
`void` | `setCreateTarget(boolean value)`
`void` | `setEnabled(boolean value)`
`void` | `setHandleEnabled(boolean value)`
`void` | `setHandleSize(int value)`
`void` | `setKeepOnTop(boolean value)`
`void` | `setMarker(mxCellMarker value)`
`void` | `setSelect(boolean value)`
`void` | `start(MouseEvent e, mxCellState state)`
`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.util.mxMouseAdapter
`mouseClicked, mouseEntered, mouseExited`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### CONNECT_CURSOR

    public static Cursor CONNECT_CURSOR

### graphComponent

    protected mxGraphComponent graphComponent

### connectPreview

    protected mxConnectPreview connectPreview

### connectIcon

    protected ImageIcon connectIcon

  Specifies the icon to be used for creating new connections. If this is specified then it is used instead of the handle. Default is null.

### handleSize

    protected int handleSize

  Specifies the size of the handle to be used for creating new connections. Default is mxConstants.CONNECT_HANDLE_SIZE.

### handleEnabled

    protected boolean handleEnabled

  Specifies if a handle should be used for creating new connections. This is only used if no connectIcon is specified. If this is false, then the source cell will be highlighted when the mouse is over the hotspot given in the marker. Default is mxConstants.CONNECT_HANDLE_ENABLED.

### select

    protected boolean select

### createTarget

    protected boolean createTarget

  Specifies if the source should be cloned and used as a target if no target was selected. Default is false.

### keepOnTop

    protected boolean keepOnTop

  Appearance and event handling order wrt subhandles.

### first

    protected transient Point first

### bounds

    protected transient Rectangle bounds

### source

    protected transient mxCellState source

### marker

    protected transient mxCellMarker marker

### error

    protected transient String error

### enabled

    protected boolean enabled

### resetHandler

    protected transient mxEventSource.mxIEventListener resetHandler

Constructor Detail

### mxConnectionHandler

    public mxConnectionHandler(mxGraphComponent graphComponent)

Parameters:
  `graphComponent` -

Method Detail

### createConnectPreview

    protected mxConnectPreview createConnectPreview()

### getConnectPreview

    public mxConnectPreview getConnectPreview()

### isConnecting

    public boolean isConnecting()

  Returns true if the source terminal has been clicked and a new connection is currently being previewed.

### isHighlighting

    public boolean isHighlighting()

  Returns true if no connectIcon is specified and handleEnabled is false.

### isEnabled

    public boolean isEnabled()

### setEnabled

    public void setEnabled(boolean value)

### isKeepOnTop

    public boolean isKeepOnTop()

### setKeepOnTop

    public void setKeepOnTop(boolean value)

### setConnectIcon

    public void setConnectIcon(ImageIcon value)

### getConnecIcon

    public ImageIcon getConnecIcon()

### setHandleEnabled

    public void setHandleEnabled(boolean value)

### isHandleEnabled

    public boolean isHandleEnabled()

### setHandleSize

    public void setHandleSize(int value)

### getHandleSize

    public int getHandleSize()

### getMarker

    public mxCellMarker getMarker()

### setMarker

    public void setMarker(mxCellMarker value)

### setCreateTarget

    public void setCreateTarget(boolean value)

### isCreateTarget

    public boolean isCreateTarget()

### setSelect

    public void setSelect(boolean value)

### isSelect

    public boolean isSelect()

### reset

    public void reset()

### createTargetVertex

    public Object createTargetVertex(MouseEvent e,
                                     Object source)

### isValidSource

    public boolean isValidSource(Object cell)

### isValidTarget

    public boolean isValidTarget(Object cell)

  Returns true. The call to mxGraph.isValidTarget is implicit by calling mxGraph.getEdgeValidationError in validateConnection. This is an additional hook for disabling certain targets in this specific handler.

### 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.

### mousePressed

    public void mousePressed(MouseEvent e)

  Specified by:
    `mousePressed` in interface `MouseListener`
  Overrides:
    `mousePressed` in class `mxMouseAdapter`

### start

    public void start(MouseEvent e,
                      mxCellState state)

### mouseMoved

    public void mouseMoved(MouseEvent e)

  Specified by:
    `mouseMoved` in interface `MouseMotionListener`
  Overrides:
    `mouseMoved` in class `mxMouseAdapter`

### mouseDragged

    public void mouseDragged(MouseEvent e)

  Specified by:
    `mouseDragged` in interface `MouseMotionListener`
  Overrides:
    `mouseDragged` in class `mxMouseAdapter`

### mouseReleased

    public void mouseReleased(MouseEvent e)

  Specified by:
    `mouseReleased` in interface `MouseListener`
  Overrides:
    `mouseReleased` in class `mxMouseAdapter`

### setBounds

    public void setBounds(Rectangle value)

### paint

    public void paint(Graphics g)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JGraph X 1.4.0.9
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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