mxGraph 2.1.0.3


com.mxgraph.swing.handler
Class mxCellHandler

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

public class mxCellHandler
extends Object


Field Summary
protected  Rectangle bounds
          Holds the bounding box of the handler.
protected  Point first
          Holds the start location of the mouse gesture.
protected  mxGraphComponent graphComponent
          Reference to the enclosing graph component.
protected  Rectangle[] handles
          Holds the rectangles that define the handles.
protected  boolean handlesVisible
          Specifies if the handles should be painted.
protected  int index
          Holds the index of the handle that was clicked.
protected  JComponent preview
          Holds the component that is used for preview.
protected  mxCellState state
          Holds the cell state associated with this handler.
 
Constructor Summary
mxCellHandler(mxGraphComponent graphComponent, mxCellState state)
          Constructs a new cell handler for the given cell state.
 
Method Summary
protected  Rectangle[] createHandles()
          Creates the rectangles that define the handles.
protected  JComponent createPreview()
          Creates the preview for this handler.
protected  void destroy()
          Invoked when the handler is no longer used.
 Rectangle getBounds()
          Returns the bounding box of this handler.
protected  Cursor getCursor(MouseEvent e, int index)
          Returns the cursor for the given event and handle.
 mxGraphComponent getGraphComponent()
           
protected  Color getHandleBorderColor(int index)
          Returns the border color of the handle at the specified index.
protected  int getHandleCount()
          Returns the number of handles in this handler.
protected  Color getHandleFillColor(int index)
          Returns the color to be used to fill the handle at the specified index.
 int getIndex()
          Returns the index of the current handle.
 int getIndexAt(int x, int y)
          Returns the index of the handle at the given location.
 Color getSelectionColor()
          Returns the color used to draw the selection border.
 Stroke getSelectionStroke()
          Returns the stroke used to draw the selection border.
 mxCellState getState()
          Returns the cell state that is associated with this handler.
 String getToolTipText(MouseEvent e)
          Hook for subclassers to return tooltip texts for certain points on the handle.
 boolean isActive()
           
protected  boolean isHandleEnabled(int index)
          Returns true if the handle at the specified index is enabled.
 boolean isHandlesVisible()
          Returns true if the handles should be painted.
protected  boolean isHandleVisible(int index)
          Returns true if the handle at the specified index is visible.
protected  boolean isIgnoredEvent(MouseEvent e)
          Returns true if the given event should be ignored.
 boolean isLabel(int index)
          Returns true if the given index is the index of the last handle.
 boolean isLabelMovable()
          Returns true if the label is movable.
 void mouseDragged(MouseEvent e)
          Processes the given event.
 void mouseMoved(MouseEvent e)
          Processes the given event.
 void mousePressed(MouseEvent e)
          Processes the given event.
 void mouseReleased(MouseEvent e)
          Processes the given event.
 void paint(Graphics g)
          Paints the visible handles of this handler.
 void refresh(mxCellState state)
          Refreshes the cell handler.
 void reset()
          Resets the state of the handler and removes the preview.
 void setHandlesVisible(boolean handlesVisible)
          Specifies if the handles should be painted.
 void start(MouseEvent e, int index)
          Starts handling a gesture at the given handle index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

graphComponent

protected mxGraphComponent graphComponent
Reference to the enclosing graph component.


state

protected mxCellState state
Holds the cell state associated with this handler.


handles

protected Rectangle[] handles
Holds the rectangles that define the handles.


handlesVisible

protected boolean handlesVisible
Specifies if the handles should be painted. Default is true.


bounds

protected transient Rectangle bounds
Holds the bounding box of the handler.


preview

protected transient JComponent preview
Holds the component that is used for preview.


first

protected transient Point first
Holds the start location of the mouse gesture.


index

protected transient int index
Holds the index of the handle that was clicked.

Constructor Detail

mxCellHandler

public mxCellHandler(mxGraphComponent graphComponent,
                     mxCellState state)
Constructs a new cell handler for the given cell state.

Parameters:
graphComponent - Enclosing graph component.
state - Cell state for which the handler is created.
Method Detail

isActive

public boolean isActive()

refresh

public void refresh(mxCellState state)
Refreshes the cell handler.


getGraphComponent

public mxGraphComponent getGraphComponent()

getState

public mxCellState getState()
Returns the cell state that is associated with this handler.


getIndex

public int getIndex()
Returns the index of the current handle.


getBounds

public Rectangle getBounds()
Returns the bounding box of this handler.


isLabelMovable

public boolean isLabelMovable()
Returns true if the label is movable.


isHandlesVisible

public boolean isHandlesVisible()
Returns true if the handles should be painted.


setHandlesVisible

public void setHandlesVisible(boolean handlesVisible)
Specifies if the handles should be painted.


isLabel

public boolean isLabel(int index)
Returns true if the given index is the index of the last handle.


createHandles

protected Rectangle[] createHandles()
Creates the rectangles that define the handles.


getHandleCount

protected int getHandleCount()
Returns the number of handles in this handler.


getToolTipText

public String getToolTipText(MouseEvent e)
Hook for subclassers to return tooltip texts for certain points on the handle.


getIndexAt

public int getIndexAt(int x,
                      int y)
Returns the index of the handle at the given location.

Parameters:
x - X-coordinate of the location.
y - Y-coordinate of the location.
Returns:
Returns the handle index for the given location.

mousePressed

public void mousePressed(MouseEvent e)
Processes the given event.


mouseMoved

public void mouseMoved(MouseEvent e)
Processes the given event.


mouseDragged

public void mouseDragged(MouseEvent e)
Processes the given event.


mouseReleased

public void mouseReleased(MouseEvent e)
Processes the given event.


start

public void start(MouseEvent e,
                  int index)
Starts handling a gesture at the given handle index.


isIgnoredEvent

protected boolean isIgnoredEvent(MouseEvent e)
Returns true if the given event should be ignored.


createPreview

protected JComponent createPreview()
Creates the preview for this handler.


reset

public void reset()
Resets the state of the handler and removes the preview.


getCursor

protected Cursor getCursor(MouseEvent e,
                           int index)
Returns the cursor for the given event and handle.


paint

public void paint(Graphics g)
Paints the visible handles of this handler.


getSelectionColor

public Color getSelectionColor()
Returns the color used to draw the selection border. This implementation returns null.


getSelectionStroke

public Stroke getSelectionStroke()
Returns the stroke used to draw the selection border. This implementation returns null.


isHandleEnabled

protected boolean isHandleEnabled(int index)
Returns true if the handle at the specified index is enabled.


isHandleVisible

protected boolean isHandleVisible(int index)
Returns true if the handle at the specified index is visible.


getHandleFillColor

protected Color getHandleFillColor(int index)
Returns the color to be used to fill the handle at the specified index.


getHandleBorderColor

protected Color getHandleBorderColor(int index)
Returns the border color of the handle at the specified index.


destroy

protected void destroy()
Invoked when the handler is no longer used. This is an empty hook for subclassers.


mxGraph 2.1.0.3


Copyright (c) 2010 Gaudenz Alder, David Benson. All rights reserved.