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 and Description |
---|---|
protected boolean |
active |
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 mxEventSource |
eventSource
Holds the event source.
|
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 and Description |
---|
mxConnectionHandler(mxGraphComponent graphComponent) |
Modifier and Type | Method and Description |
---|---|
protected void |
addGraphListeners(mxGraph graph)
Installs the listeners to update the handles after any changes.
|
void |
addListener(String eventName,
mxEventSource.mxIEventListener listener)
Adds the given event listener.
|
protected mxConnectPreview |
createConnectPreview() |
Object |
createTargetVertex(MouseEvent e,
Object source) |
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(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) |
protected void |
removeGraphListeners(mxGraph graph)
Removes all installed listeners.
|
void |
removeListener(mxEventSource.mxIEventListener listener)
Removes the given event listener.
|
void |
removeListener(mxEventSource.mxIEventListener listener,
String eventName)
Removes the given event listener for the specified event name.
|
void |
reset() |
void |
setBounds(Rectangle value) |
void |
setConnectIcon(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(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.
|
mouseClicked, mouseEntered, mouseExited
public static Cursor CONNECT_CURSOR
protected mxGraphComponent graphComponent
protected mxEventSource eventSource
protected mxConnectPreview connectPreview
protected ImageIcon connectIcon
protected int handleSize
protected boolean handleEnabled
protected boolean select
protected boolean createTarget
protected boolean keepOnTop
protected boolean enabled
protected transient Point first
protected transient boolean active
protected transient Rectangle bounds
protected transient mxCellState source
protected transient mxCellMarker marker
protected transient 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(ImageIcon value)
public 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 Object createTargetVertex(MouseEvent e, Object source)
public boolean isValidSource(Object cell)
public boolean isValidTarget(Object cell)
public String validateConnection(Object source, Object target)
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
mousePressed
in class mxMouseAdapter
public void start(MouseEvent e, mxCellState state)
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
mouseMoved
in class mxMouseAdapter
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
mouseDragged
in class mxMouseAdapter
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
mouseReleased
in class mxMouseAdapter
public void setBounds(Rectangle value)
public void addListener(String eventName, mxEventSource.mxIEventListener listener)
public void removeListener(mxEventSource.mxIEventListener listener)
public void removeListener(mxEventSource.mxIEventListener listener, String eventName)
public void paint(Graphics g)
Copyright (c) 2010 Gaudenz Alder, David Benson. All rights reserved.