java.awt.event.MouseListener
, java.awt.event.MouseMotionListener
, java.util.EventListener
public class mxConnectionHandler extends mxMouseAdapter
cell
property contains the inserted edge, the event
and target
properties contain the respective arguments that were passed to mouseReleased.Modifier and Type | Field | Description |
---|---|---|
protected boolean |
active |
|
protected java.awt.Rectangle |
bounds |
|
static java.awt.Cursor |
CONNECT_CURSOR |
|
protected javax.swing.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 java.lang.String |
error |
|
protected mxEventSource |
eventSource |
Holds the event source.
|
protected java.awt.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 | Description |
---|---|
mxConnectionHandler(mxGraphComponent graphComponent) |
Modifier and Type | Method | Description |
---|---|---|
protected void |
addGraphListeners(mxGraph graph) |
Installs the listeners to update the handles after any changes.
|
void |
addListener(java.lang.String eventName,
mxEventSource.mxIEventListener listener) |
Adds the given event listener.
|
protected mxConnectPreview |
createConnectPreview() |
|
java.lang.Object |
createTargetVertex(java.awt.event.MouseEvent e,
java.lang.Object source) |
|
javax.swing.ImageIcon |
getConnecIcon() |
|
mxConnectPreview |
getConnectPreview() |
|
int |
getHandleSize() |
|
mxCellMarker |
getMarker() |
|
boolean |
isActive() |
|
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(java.lang.Object cell) |
|
boolean |
isValidTarget(java.lang.Object cell) |
Returns true.
|
void |
mouseDragged(java.awt.event.MouseEvent e) |
|
void |
mouseMoved(java.awt.event.MouseEvent e) |
|
void |
mousePressed(java.awt.event.MouseEvent e) |
|
void |
mouseReleased(java.awt.event.MouseEvent e) |
|
void |
paint(java.awt.Graphics g) |
|
protected void |
removeGraphListeners(mxGraph graph) |
Removes all installed listeners.
|
void |
removeListener(mxEventSource.mxIEventListener listener) |
Removes the given event listener.
|
void |
removeListener(mxEventSource.mxIEventListener listener,
java.lang.String eventName) |
Removes the given event listener for the specified event name.
|
void |
reset() |
|
void |
setBounds(java.awt.Rectangle value) |
|
void |
setConnectIcon(javax.swing.ImageIcon value) |
|
void |
setConnectPreview(mxConnectPreview 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(java.awt.event.MouseEvent e,
mxCellState state) |
|
java.lang.String |
validateConnection(java.lang.Object source,
java.lang.Object target) |
Returns the error message or an empty string if the connection for the
given source target pair is not valid.
|
mouseClicked, mouseEntered, mouseExited
public static java.awt.Cursor CONNECT_CURSOR
protected mxGraphComponent graphComponent
protected mxEventSource eventSource
protected mxConnectPreview connectPreview
protected javax.swing.ImageIcon connectIcon
protected int handleSize
protected boolean handleEnabled
protected boolean select
protected boolean createTarget
protected boolean keepOnTop
protected boolean enabled
protected transient java.awt.Point first
protected transient boolean active
protected transient java.awt.Rectangle bounds
protected transient mxCellState source
protected transient mxCellMarker marker
protected transient java.lang.String error
protected transient mxEventSource.mxIEventListener resetHandler
public mxConnectionHandler(mxGraphComponent graphComponent)
graphComponent
- protected void addGraphListeners(mxGraph graph)
protected void removeGraphListeners(mxGraph graph)
protected mxConnectPreview createConnectPreview()
public mxConnectPreview getConnectPreview()
public void setConnectPreview(mxConnectPreview value)
public boolean isConnecting()
public boolean isActive()
public boolean isHighlighting()
public boolean isEnabled()
public void setEnabled(boolean value)
public boolean isKeepOnTop()
public void setKeepOnTop(boolean value)
public void setConnectIcon(javax.swing.ImageIcon value)
public javax.swing.ImageIcon getConnecIcon()
public void setHandleEnabled(boolean value)
public boolean isHandleEnabled()
public void setHandleSize(int value)
public int getHandleSize()
public mxCellMarker getMarker()
public void setMarker(mxCellMarker value)
public void setCreateTarget(boolean value)
public boolean isCreateTarget()
public void setSelect(boolean value)
public boolean isSelect()
public void reset()
public java.lang.Object createTargetVertex(java.awt.event.MouseEvent e, java.lang.Object source)
public boolean isValidSource(java.lang.Object cell)
public boolean isValidTarget(java.lang.Object cell)
public java.lang.String validateConnection(java.lang.Object source, java.lang.Object target)
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
mousePressed
in class mxMouseAdapter
public void start(java.awt.event.MouseEvent e, mxCellState state)
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
mouseMoved
in class mxMouseAdapter
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseDragged
in class mxMouseAdapter
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
mouseReleased
in class mxMouseAdapter
public void setBounds(java.awt.Rectangle value)
public void addListener(java.lang.String eventName, mxEventSource.mxIEventListener listener)
public void removeListener(mxEventSource.mxIEventListener listener)
public void removeListener(mxEventSource.mxIEventListener listener, java.lang.String eventName)
public void paint(java.awt.Graphics g)
Copyright (c) 2010-2017 Gaudenz Alder, JGraph Ltd. All rights reserved.