JGraph X 1.3.0.0

## com.mxgraph.swing.handler
Class mxCellMarker

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  com.mxgraph.swing.handler.mxCellMarker

All Implemented Interfaces:
  java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

Direct Known Subclasses:
  mxCellTracker

    public class mxCellMarker

extends javax.swing.JComponent

Implements a mouse tracker that marks cells under the mouse. This class fires the following event: mxEvent.MARK fires in mark and unmark to notify the listener of a new cell under the mouse. The `state` property contains the mxCellState of the respective cell or null if no cell is under the mouse.

See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class javax.swing.JComponent
`javax.swing.JComponent.AccessibleJComponent`

Nested classes/interfaces inherited from class java.awt.Container
`java.awt.Container.AccessibleAWTContainer`

Nested classes/interfaces inherited from class java.awt.Component
`java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy`

Field Summary
`protected java.awt.Color` `currentColor` Holds the current marker color.
`static java.awt.Stroke` `DEFAULT_STROKE` Specifies the default stroke for the marker.
`protected boolean` `enabled` Specifies if the marker is enabled.
`protected mxEventSource` `eventSource` Holds the event source.
`protected mxGraphComponent` `graphComponent` Holds the enclosing graph component.
`protected double` `hotspot` Specifies the portion of the width and height that should trigger a highlight.
`protected boolean` `hotspotEnabled` Specifies if the hotspot is enabled.
`protected java.awt.Color` `invalidColor` Specifies the valid- and invalidColor for the marker.
`static boolean` `KEEP_ON_TOP` Specifies if the highlights should appear on top of everything else in the overlay pane.
`protected mxCellState` `markedState` Holds the marked state.
`protected boolean` `swimlaneContentEnabled` Specifies if the the content area of swimlane should be non-transparent to mouse events.
`protected java.awt.Color` `validColor` Specifies the valid- and invalidColor for the marker.
`protected mxCellState` `validState` Holds the marked state if it is valid.

Fields inherited from class javax.swing.JComponent
`accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW`

Fields inherited from class java.awt.Component
`BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

Fields inherited from interface java.awt.image.ImageObserver
`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

Constructor Summary
`mxCellMarker(mxGraphComponent graphComponent)` Constructs a new marker for the given graph component.
`mxCellMarker(mxGraphComponent graphComponent, java.awt.Color validColor)` Constructs a new marker for the given graph component.
`mxCellMarker(mxGraphComponent graphComponent, java.awt.Color validColor, java.awt.Color invalidColor)` Constructs a new marker for the given graph component.
`mxCellMarker(mxGraphComponent graphComponent, java.awt.Color validColor, java.awt.Color invalidColor, double hotspot)` Constructs a new marker for the given graph component.

Method Summary
`void` `addListener(java.lang.String eventName, mxEventSource.mxIEventListener listener)` Adds the given event listener.
`protected java.lang.Object` `getCell(java.awt.event.MouseEvent e)` Returns the state at the given location.
`double` `getHotspot()` Returns the hotspot.
`mxCellState` `getMarkedState()` Returns the marked state.
`protected java.awt.Color` `getMarkerColor(java.awt.event.MouseEvent e, mxCellState state, boolean isValid)` Returns the valid- or invalidColor depending on the value of isValid.
`protected mxCellState` `getState(java.awt.event.MouseEvent e)` Uses getCell, getMarkedState and intersects to return the state for the given event.
`protected mxCellState` `getStateToMark(mxCellState state)` Returns the state to be marked for the given state under the mouse.
`mxCellState` `getValidState()` Returns the valid state.
`boolean` `hasValidState()` Returns true if validState is not null.
`protected boolean` `intersects(mxCellState state, java.awt.event.MouseEvent e)` Returns true if the given mouse event intersects the given state.
`boolean` `isEnabled()` Returns true if the marker is enabled, that is, if it processes events in process.
`boolean` `isHotspotEnabled()` Returns true if hotspot is used in intersects.
`boolean` `isSwimlaneContentEnabled()` Returns true if the content area of swimlanes is non-transparent to events.
`protected boolean` `isValidState(mxCellState state)` Returns true if the given state is a valid state.
`protected void` `mark()` Marks the markedState and fires a mxEvent.MARK event.
`void` `paint(java.awt.Graphics g)` Paints the outline of the markedState with the currentColor.
`mxCellState` `process(java.awt.event.MouseEvent e)` Processes the given event and marks the state returned by getStateAt with the color returned by getMarkerColor.
`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()` Resets the state of the cell marker.
`void` `setEnabled(boolean enabled)` Sets the enabled state of the marker.
`void` `setHotspot(double hotspot)` Sets the hotspot.
`void` `setHotspotEnabled(boolean enabled)` Specifies whether the hotspot should be used in intersects.
`void` `setSwimlaneContentEnabled(boolean swimlaneContentEnabled)` Sets if the content area of swimlanes should not be transparent to events.
`protected void` `unmark()` Hides the marker and fires a mxEvent.MARK event.

Methods inherited from class javax.swing.JComponent

`addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI`

Methods inherited from class java.awt.Container

`add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree`

Methods inherited from class java.awt.Component

`action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle`

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

Field Detail

### KEEP_ON_TOP

    public static boolean KEEP_ON_TOP

  Specifies if the highlights should appear on top of everything else in the overlay pane. Default is false.

### DEFAULT_STROKE

    public static java.awt.Stroke DEFAULT_STROKE

  Specifies the default stroke for the marker.

### eventSource

    protected mxEventSource eventSource

  Holds the event source.

### graphComponent

    protected mxGraphComponent graphComponent

  Holds the enclosing graph component.

### enabled

    protected boolean enabled

  Specifies if the marker is enabled. Default is true.

### hotspot

    protected double hotspot

  Specifies the portion of the width and height that should trigger a highlight. The area around the center of the cell to be marked is used as the hotspot. Possible values are between 0 and 1. Default is mxConstants.DEFAULT_HOTSPOT.

### hotspotEnabled

    protected boolean hotspotEnabled

  Specifies if the hotspot is enabled. Default is false.

### swimlaneContentEnabled

    protected boolean swimlaneContentEnabled

  Specifies if the the content area of swimlane should be non-transparent to mouse events. Default is false.

### validColor

    protected java.awt.Color validColor

  Specifies the valid- and invalidColor for the marker.

### invalidColor

    protected java.awt.Color invalidColor

  Specifies the valid- and invalidColor for the marker.

### currentColor

    protected transient java.awt.Color currentColor

  Holds the current marker color.

### validState

    protected transient mxCellState validState

  Holds the marked state if it is valid.

### markedState

    protected transient mxCellState markedState

  Holds the marked state.

Constructor Detail

### mxCellMarker

    public mxCellMarker(mxGraphComponent graphComponent)

  Constructs a new marker for the given graph component.

  Parameters:
    `graphComponent` -

### mxCellMarker

    public mxCellMarker(mxGraphComponent graphComponent,
                        java.awt.Color validColor)

  Constructs a new marker for the given graph component.

### mxCellMarker

    public mxCellMarker(mxGraphComponent graphComponent,
                        java.awt.Color validColor,
                        java.awt.Color invalidColor)

  Constructs a new marker for the given graph component.

### mxCellMarker

    public mxCellMarker(mxGraphComponent graphComponent,
                        java.awt.Color validColor,
                        java.awt.Color invalidColor,
                        double hotspot)

  Constructs a new marker for the given graph component.

Method Detail

### setEnabled

    public void setEnabled(boolean enabled)

  Sets the enabled state of the marker.

  Overrides:
    `setEnabled` in class `javax.swing.JComponent`

### isEnabled

    public boolean isEnabled()

  Returns true if the marker is enabled, that is, if it processes events in process.

  Overrides:
    `isEnabled` in class `java.awt.Component`

### setHotspot

    public void setHotspot(double hotspot)

  Sets the hotspot.

### getHotspot

    public double getHotspot()

  Returns the hotspot.

### setHotspotEnabled

    public void setHotspotEnabled(boolean enabled)

  Specifies whether the hotspot should be used in intersects.

### isHotspotEnabled

    public boolean isHotspotEnabled()

  Returns true if hotspot is used in intersects.

### setSwimlaneContentEnabled

    public void setSwimlaneContentEnabled(boolean swimlaneContentEnabled)

  Sets if the content area of swimlanes should not be transparent to events.

### isSwimlaneContentEnabled

    public boolean isSwimlaneContentEnabled()

  Returns true if the content area of swimlanes is non-transparent to events.

### hasValidState

    public boolean hasValidState()

  Returns true if validState is not null.

### getValidState

    public mxCellState getValidState()

  Returns the valid state.

### getMarkedState

    public mxCellState getMarkedState()

  Returns the marked state.

### reset

    public void reset()

  Resets the state of the cell marker.

### process

    public mxCellState process(java.awt.event.MouseEvent e)

  Processes the given event and marks the state returned by getStateAt with the color returned by getMarkerColor. If the markerColor is not null, then the state is stored in markedState. If isValidState returns true, then the state is stored in validState regardless of the marker color. The state is returned regardless of the marker color and valid state.

### mark

    protected void mark()

  Marks the markedState and fires a mxEvent.MARK event.

### unmark

    protected void unmark()

  Hides the marker and fires a mxEvent.MARK event.

### isValidState

    protected boolean isValidState(mxCellState state)

  Returns true if the given state is a valid state. If this returns true, then the state is stored in validState. The return value of this method is used as the argument for getMarkerColor.

### getMarkerColor

    protected java.awt.Color getMarkerColor(java.awt.event.MouseEvent e,
                                            mxCellState state,
                                            boolean isValid)

  Returns the valid- or invalidColor depending on the value of isValid. The given state is ignored by this implementation.

### getState

    protected mxCellState getState(java.awt.event.MouseEvent e)

  Uses getCell, getMarkedState and intersects to return the state for the given event.

### getCell

    protected java.lang.Object getCell(java.awt.event.MouseEvent e)

  Returns the state at the given location. This uses mxGraph.getCellAt.

### getStateToMark

    protected mxCellState getStateToMark(mxCellState state)

  Returns the state to be marked for the given state under the mouse. This returns the given state.

### intersects

    protected boolean intersects(mxCellState state,
                                 java.awt.event.MouseEvent e)

  Returns true if the given mouse event intersects the given state. This returns true if the hotspot is 0 or the event is inside the hotspot for the given cell state.

### addListener

    public void addListener(java.lang.String eventName,
                            mxEventSource.mxIEventListener listener)

  Adds the given event listener.

### removeListener

    public void removeListener(mxEventSource.mxIEventListener listener)

  Removes the given event listener.

### removeListener

    public void removeListener(mxEventSource.mxIEventListener listener,
                               java.lang.String eventName)

  Removes the given event listener for the specified event name.

### paint

    public void paint(java.awt.Graphics g)

  Paints the outline of the markedState with the currentColor.

  Overrides:
    `paint` in class `javax.swing.JComponent`

JGraph X 1.3.0.0

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