public class mxGraphComponent extends JScrollPane implements Printable
graphComponent.getViewport().setOpaque(true); graphComponent.getViewport().setBackground(newColor);This class fires the following events: mxEvent.START_EDITING fires before starting the in-place editor for an existing cell in startEditingAtCell. The
cell
property contains
the cell that is being edit and the event
property contains
optional EventObject which was passed to startEditingAtCell.
mxEvent.LABEL_CHANGED fires between begin- and endUpdate after the call to
mxGraph.cellLabelChanged in labelChanged. The cell
property
contains the cell, the value
property contains the new value for
the cell and the optional event
property contains the
EventObject that started the edit.
mxEvent.ADD_OVERLAY and mxEvent.REMOVE_OVERLAY fire afer an overlay was added
or removed using add-/removeOverlay. The cell
property contains
the cell for which the overlay was added or removed and the
overlay
property contain the mxOverlay.
mxEvent.BEFORE_PAINT and mxEvent.AFTER_PAINT fire before and after the paint
method is called on the component. The g
property contains the
graphics context which is used for painting.Modifier and Type | Class and Description |
---|---|
class |
mxGraphComponent.mxGraphControl |
static class |
mxGraphComponent.mxMouseRedirector |
JScrollPane.AccessibleJScrollPane, JScrollPane.ScrollBar
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
protected boolean |
antiAlias |
protected boolean |
autoExtend
Whether to extend the graph bounds and scroll towards the limit of those
new bounds in the direction of mouse travel if a handler is active while
the mouse leaves the container that the graph exists in.
|
protected boolean |
autoScroll
Whether or not to scroll the scrollable container the graph exists in if
a suitable handler is active and the graph bounds already exist extended
in the direction of mouse travel.
|
protected ImageIcon |
backgroundImage
Specifies the
|
protected mxInteractiveCanvas |
canvas |
protected mxICellEditor |
cellEditor |
protected boolean |
centerPage
Specifies if the background page should be centered by automatically
setting the translate in the view.
|
protected boolean |
centerZoom
Specifies if the zoom operations should go into the center of the actual
diagram rather than going from top, left.
|
protected ImageIcon |
collapsedIcon |
protected Hashtable<Object,Component[]> |
components
Maps from cells to lists of heavyweights.
|
protected mxConnectionHandler |
connectionHandler |
static ImageIcon |
DEFAULT_COLLAPSED_ICON |
static ImageIcon |
DEFAULT_EXPANDED_ICON |
static double |
DEFAULT_PAGESCALE
Specifies the default page scale.
|
static ImageIcon |
DEFAULT_WARNING_ICON |
protected boolean |
dragEnabled |
protected boolean |
enterStopsCellEditing
If true, pressing the enter key without pressing control will stop
editing and accept the new value.
|
protected boolean |
escapeEnabled
Specifies
|
protected mxEventSource |
eventSource |
protected ImageIcon |
expandedIcon |
protected boolean |
exportEnabled |
protected boolean |
foldingEnabled
Specifies if folding (collapse and expand via an image icon in the graph
should be enabled).
|
protected mxGraph |
graph |
protected mxGraphComponent.mxGraphControl |
graphControl |
protected mxGraphHandler |
graphHandler |
static int |
GRID_STYLE_CROSS |
static int |
GRID_STYLE_DASHED |
static int |
GRID_STYLE_DOT |
static int |
GRID_STYLE_LINE |
protected Color |
gridColor |
protected int |
gridStyle |
protected boolean |
gridVisible
Specifies if the grid is visible.
|
protected int |
horizontalPageCount
Specifies the number of pages in the horizontal direction.
|
protected boolean |
importEnabled |
protected boolean |
invokesStopCellEditing
If true, when editing is to be stopped by way of selection changing, data
in diagram changing or other means stopCellEditing is invoked, and
changes are saved.
|
protected boolean |
keepSelectionVisibleOnZoom
Specifies if the viewport should automatically contain the selection
cells after a zoom operation.
|
protected Hashtable<Object,mxICellOverlay[]> |
overlays
Maps from cells to lists of overlays.
|
protected Color |
pageBackgroundColor
Color of the background area if layout view.
|
protected Color |
pageBorderColor |
protected Color |
pageBreakColor
Specifies the color of page breaks
|
protected boolean |
pageBreaksVisible
Specifies if a dashed line should be drawn between multiple pages.
|
protected PageFormat |
pageFormat
Background page format.
|
protected double |
pageScale
Defines the scaling for the background page metrics.
|
protected Color |
pageShadowColor |
protected boolean |
pageVisible
Specifies if the background page should be visible.
|
protected mxPanningHandler |
panningHandler |
protected boolean |
preferPageSize
If the pageFormat should be used to determine the minimal graph bounds
even if the page is not visible (see pageVisible).
|
protected float |
previewAlpha
The transparency of previewed cells from 0.0.
|
protected mxEventSource.mxIEventListener |
repaintHandler |
protected mxEventSource.mxIEventListener |
scaleHandler
Resets the zoom policy if the scale is changed manually.
|
protected mxSelectionCellsHandler |
selectionCellsHandler |
boolean |
showDirtyRectangle
Used for debugging the dirty region.
|
protected boolean |
swimlaneSelectionEnabled
Specifies if swimlanes are selected when the mouse is released over the
swimlanes content area.
|
protected boolean |
textAntiAlias |
protected int |
tolerance
Specifies the tolerance for mouse clicks.
|
protected boolean |
transparentSwimlaneContent
Specifies if the content area should be transparent to events.
|
protected BufferedImage |
tripleBuffer |
protected boolean |
tripleBuffered
Specifies if an image buffer should be used for painting the component.
|
protected Graphics2D |
tripleBufferGraphics |
protected mxEventSource.mxIEventListener |
updateHandler
Updates the heavyweight component structure after any changes.
|
protected int |
verticalPageCount
Specifies the number of pages in the vertical direction.
|
protected PropertyChangeListener |
viewChangeHandler |
protected ImageIcon |
warningIcon |
static int |
ZOOM_POLICY_NONE |
static int |
ZOOM_POLICY_PAGE |
static int |
ZOOM_POLICY_WIDTH |
protected double |
zoomFactor
Specifies the factor used for zoomIn and zoomOut.
|
protected int |
zoomPolicy
Specifies the zoom policy.
|
columnHeader, horizontalScrollBar, horizontalScrollBarPolicy, lowerLeft, lowerRight, rowHeader, upperLeft, upperRight, verticalScrollBar, verticalScrollBarPolicy, viewport
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
NO_SUCH_PAGE, PAGE_EXISTS
COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
mxGraphComponent(mxGraph graph) |
Modifier and Type | Method and Description |
---|---|
mxICellOverlay |
addCellOverlay(Object cell,
mxICellOverlay overlay)
Adds an overlay for the specified cell.
|
void |
addListener(String eventName,
mxEventSource.mxIEventListener listener) |
boolean |
canExportCell(Object cell)
Returns true if the given cell can be exported via datatransfer.
|
boolean |
canImportCell(Object cell)
Returns true if the given cell can be imported via datatransfer.
|
void |
checkTripleBuffer()
Checks if the triple buffer exists and creates a new one if it does not.
|
void |
clearCellOverlays()
Removes all overlays in the graph.
|
void |
clearCellOverlays(Object cell)
Removes all overlays in the graph for the given cell and all its
descendants.
|
mxInteractiveCanvas |
createCanvas()
Hook for subclassers to replace the graphics canvas for rendering and and
printing.
|
protected mxICellEditor |
createCellEditor() |
Component[] |
createComponents(mxCellState state)
Hook for subclassers to create the array of heavyweights for the given
state.
|
protected mxConnectionHandler |
createConnectionHandler() |
protected mxGraphComponent.mxGraphControl |
createGraphControl()
Creates the inner control that handles tooltips, preferred size and can
draw cells onto a canvas.
|
protected mxGraphHandler |
createGraphHandler() |
mxCellHandler |
createHandler(mxCellState state) |
protected void |
createHandlers()
Creates the connection-, panning and graphhandler (in this order).
|
protected mxPanningHandler |
createPanningHandler() |
protected mxSelectionCellsHandler |
createSelectionCellsHandler() |
protected TransferHandler |
createTransferHandler() |
protected void |
createTripleBuffer(int width,
int height)
Creates the tripleBufferGraphics and tripleBuffer for the given dimension
and draws the complete graph onto the triplebuffer.
|
void |
destroyTripleBuffer()
Destroys the tripleBuffer and tripleBufferGraphics objects.
|
void |
escape(KeyEvent e)
Callback to process an escape keystroke.
|
ImageIcon |
getBackgroundImage() |
mxInteractiveCanvas |
getCanvas() |
Object |
getCellAt(int x,
int y) |
Object |
getCellAt(int x,
int y,
boolean hitSwimlaneContent) |
Object |
getCellAt(int x,
int y,
boolean hitSwimlaneContent,
Object parent)
Returns the bottom-most cell that intersects the given point (x, y) in
the cell hierarchy starting at the given parent.
|
mxICellEditor |
getCellEditor() |
mxICellOverlay[] |
getCellOverlays(Object cell)
Returns the array of overlays for the given cell or null, if no overlays
are defined.
|
Object[] |
getCells(Rectangle rect)
Returns the cells inside the given rectangle.
|
Object[] |
getCells(Rectangle rect,
Object parent)
Returns the children of the given parent that are contained in the given
rectangle (x, y, width, height).
|
mxConnectionHandler |
getConnectionHandler() |
String |
getEditingValue(Object cell,
EventObject trigger) |
Object[] |
getExportableCells(Object[] cells)
Returns all cells which may be exported via datatransfer.
|
ImageIcon |
getFoldingIcon(mxCellState state)
Returns the icon used to display the collapsed state of the specified
cell state.
|
Rectangle |
getFoldingIconBounds(mxCellState state,
ImageIcon icon) |
mxGraph |
getGraph() |
mxGraphComponent.mxGraphControl |
getGraphControl() |
mxGraphHandler |
getGraphHandler() |
Color |
getGridColor() |
int |
getGridStyle() |
int |
getHorizontalPageBorder()
Returns the horizontal border between the page and the control.
|
int |
getHorizontalPageCount() |
Object[] |
getImportableCells(Object[] cells)
Returns all cells which may be imported via datatransfer.
|
mxRectangle |
getLayoutAreaSize()
Returns the size of the area that layouts can operate in.
|
Color |
getPageBackgroundColor() |
Color |
getPageBorderColor() |
Color |
getPageBreakColor() |
PageFormat |
getPageFormat() |
double |
getPageScale() |
Color |
getPageShadowColor() |
protected mxPoint |
getPageTranslate(double scale)
Should be called by a hook inside mxGraphView/mxGraph
|
mxPanningHandler |
getPanningHandler() |
mxPoint |
getPointForEvent(MouseEvent e)
Returns an mxPoint representing the given event in the unscaled,
non-translated coordinate space and applies the grid.
|
mxPoint |
getPointForEvent(MouseEvent e,
boolean addOffset)
Returns an mxPoint representing the given event in the unscaled,
non-translated coordinate space and applies the grid.
|
protected Dimension |
getPreferredSizeForPage()
Returns the (unscaled) preferred size for the current page format (scaled
by pageScale).
|
float |
getPreviewAlpha() |
protected Dimension |
getScaledPreferredSizeForGraph()
Returns the scaled preferred size for the current graph.
|
mxSelectionCellsHandler |
getSelectionCellsHandler() |
int |
getTolerance() |
BufferedImage |
getTripleBuffer() |
int |
getVerticalPageBorder()
Returns the vertical border between the page and the control.
|
int |
getVerticalPageCount() |
double |
getZoomFactor() |
int |
getZoomPolicy() |
boolean |
hitFoldingIcon(Object cell,
int x,
int y) |
Object[] |
importCells(Object[] cells,
double dx,
double dy,
Object target,
Point location)
Clones and inserts the given cells into the graph using the move method
and returns the inserted cells.
|
void |
insertComponent(mxCellState state,
Component c) |
protected void |
installDoubleClickHandler()
Adds handling of edit and stop-edit events after all other handlers have
been installed.
|
protected void |
installFocusHandler()
installs a handler to set the focus to the container.
|
protected void |
installKeyHandler()
Handles escape keystrokes.
|
protected void |
installResizeHandler()
Applies the zoom policy if the size of the component changes.
|
boolean |
isAntiAlias() |
boolean |
isAutoExtend() |
boolean |
isAutoScroll() |
boolean |
isCenterPage() |
boolean |
isCenterZoom() |
boolean |
isCloneEvent(MouseEvent event) |
boolean |
isConnectable() |
boolean |
isConstrainedEvent(MouseEvent event)
Note: This is not used during drag and drop operations due to limitations
of the underlying API.
|
boolean |
isDragEnabled() |
boolean |
isEditEvent(MouseEvent e) |
boolean |
isEditing() |
boolean |
isEnterStopsCellEditing() |
boolean |
isEscapeEnabled() |
boolean |
isEventsEnabled() |
boolean |
isExportEnabled() |
boolean |
isFoldingEnabled() |
boolean |
isForceMarqueeEvent(MouseEvent event)
Note: This is not used during drag and drop operations due to limitations
of the underlying API.
|
boolean |
isForceTripleBuffered()
Hook for dynamic triple buffering condition.
|
boolean |
isGridEnabledEvent(MouseEvent event) |
boolean |
isGridVisible() |
boolean |
isImportEnabled()
Returns importEnabled.
|
boolean |
isInvokesStopCellEditing() |
boolean |
isKeepSelectionVisibleOnZoom() |
boolean |
isPageBreaksVisible() |
boolean |
isPageVisible() |
boolean |
isPanning() |
boolean |
isPanningEvent(MouseEvent event)
Note: This is not used during drag and drop operations due to limitations
of the underlying API.
|
boolean |
isPreferPageSize() |
boolean |
isSignificant(double dx,
double dy)
Returns true if the absolute value of one of the given parameters is
greater than the tolerance.
|
boolean |
isSwimlaneSelectionEnabled() |
boolean |
isTextAntiAlias() |
boolean |
isToggleEvent(MouseEvent event) |
boolean |
isTripleBuffered() |
Object |
labelChanged(Object cell,
Object value,
EventObject evt)
Sets the label of the specified cell to the given value using
mxGraph.cellLabelChanged and fires mxEvent.LABEL_CHANGED while the
transaction is in progress.
|
protected void |
maintainScrollBar(boolean horizontal,
double factor,
boolean center) |
protected void |
paintBackground(Graphics g) |
protected void |
paintBackgroundImage(Graphics g) |
protected Rectangle |
paintBackgroundPage(Graphics g) |
protected void |
paintGrid(Graphics g)
Paints the grid onto the given graphics object.
|
int |
print(Graphics g,
PageFormat printFormat,
int page)
Prints the specified page on the specified graphics using
pageFormat for the page format. |
void |
redraw(mxCellState state)
Updates the buffer (if one exists) and repaints the given cell state.
|
void |
refresh()
Refreshes the display and handles.
|
void |
removeAllComponents(Hashtable<Object,Component[]> map) |
void |
removeAllOverlays(Hashtable<Object,mxICellOverlay[]> map) |
mxICellOverlay |
removeCellOverlay(Object cell,
mxICellOverlay overlay)
Removes and returns the given overlay from the given cell.
|
protected void |
removeCellOverlayComponent(mxICellOverlay overlay,
Object cell)
Notified when an overlay has been removed from the graph.
|
mxICellOverlay[] |
removeCellOverlays(Object cell)
Removes all overlays from the given cell.
|
void |
removeComponent(Component c,
Object cell) |
void |
removeListener(mxEventSource.mxIEventListener listener) |
void |
removeListener(mxEventSource.mxIEventListener listener,
String eventName) |
void |
repaintTripleBuffer(Rectangle dirty)
Clears and repaints the triple buffer at the given rectangle or repaints
the complete buffer if no rectangle is specified.
|
void |
scrollCellToVisible(Object cell)
Scrolls the graph so that it shows the given cell.
|
void |
scrollCellToVisible(Object cell,
boolean center)
Scrolls the graph so that it shows the given cell.
|
void |
scrollToCenter(boolean horizontal) |
void |
selectCellForEvent(Object cell,
MouseEvent e)
Selects the cell for the given event.
|
void |
selectCellsForEvent(Object[] cells,
MouseEvent event)
Selects the cells for the given event.
|
Object[] |
selectRegion(Rectangle rect,
MouseEvent e) |
void |
setAntiAlias(boolean value)
Fires a property change event for
antiAlias . |
void |
setAutoExtend(boolean value) |
void |
setAutoScroll(boolean value) |
void |
setBackgroundImage(ImageIcon value) |
void |
setCellEditor(mxICellEditor value) |
mxICellOverlay |
setCellWarning(Object cell,
String warning)
Creates an overlay for the given cell using the warning and image or
warningImage and returns the new overlay.
|
mxICellOverlay |
setCellWarning(Object cell,
String warning,
ImageIcon icon)
Creates an overlay for the given cell using the warning and image or
warningImage and returns the new overlay.
|
mxICellOverlay |
setCellWarning(Object cell,
String warning,
ImageIcon icon,
boolean select)
Creates an overlay for the given cell using the warning and image or
warningImage and returns the new overlay.
|
void |
setCenterPage(boolean value)
zoomAndCenter should be called if this is set to true.
|
void |
setCenterZoom(boolean value) |
void |
setConnectable(boolean connectable) |
void |
setDragEnabled(boolean value) |
void |
setEnterStopsCellEditing(boolean value) |
void |
setEscapeEnabled(boolean value) |
void |
setEventsEnabled(boolean eventsEnabled) |
void |
setExportEnabled(boolean value) |
void |
setFoldingEnabled(boolean value) |
void |
setGraph(mxGraph value) |
void |
setGridColor(Color value)
Fires a property change event for
gridColor . |
void |
setGridStyle(int value)
Fires a property change event for
gridStyle . |
void |
setGridVisible(boolean value)
Fires a property change event for
gridVisible . |
void |
setHorizontalPageCount(int value) |
void |
setImportEnabled(boolean value)
Sets importEnabled.
|
void |
setInvokesStopCellEditing(boolean value) |
void |
setKeepSelectionVisibleOnZoom(boolean value) |
void |
setPageBackgroundColor(Color value)
Sets the color that appears behind the page.
|
void |
setPageBorderColor(Color value) |
void |
setPageBreakColor(Color pageBreakColor) |
void |
setPageBreaksVisible(boolean value) |
void |
setPageFormat(PageFormat value) |
void |
setPageScale(double value) |
void |
setPageShadowColor(Color value) |
void |
setPageVisible(boolean value)
Fires a property change event for
pageVisible . |
void |
setPanning(boolean enabled) |
void |
setPreferPageSize(boolean value)
Fires a property change event for
preferPageSize . |
void |
setPreviewAlpha(float value) |
void |
setSwimlaneSelectionEnabled(boolean value) |
void |
setTextAntiAlias(boolean value)
Fires a property change event for
textAntiAlias . |
void |
setTolerance(int value) |
void |
setToolTips(boolean enabled) |
void |
setTripleBuffered(boolean value) |
void |
setVerticalPageCount(int value) |
void |
setZoomFactor(double value) |
void |
setZoomPolicy(int value) |
mxPoint |
snapScaledPoint(mxPoint pt) |
mxPoint |
snapScaledPoint(mxPoint pt,
double dx,
double dy) |
void |
startEditing() |
void |
startEditingAtCell(Object cell) |
void |
startEditingAtCell(Object cell,
EventObject evt) |
void |
stopEditing(boolean cancel) |
protected void |
updateCellOverlayComponent(mxCellState state,
mxICellOverlay overlay)
Notified when an overlay has been removed from the graph.
|
Hashtable<Object,mxICellOverlay[]> |
updateCellOverlays(Object cell)
Returns a hashtable with all entries from the overlays variable where a
cell still exists in the model.
|
void |
updateComponent(mxCellState state,
Component c) |
void |
updateComponents() |
Hashtable<Object,Component[]> |
updateComponents(Object cell) |
String |
validateGraph()
Validates the graph by validating each descendant of the given cell or
the root of the model.
|
String |
validateGraph(Object cell,
Hashtable<Object,Object> context)
Validates the graph by validating each descendant of the given cell or
the root of the model.
|
void |
zoom(boolean page,
boolean center) |
void |
zoom(double factor) |
void |
zoomActual()
Function: zoomActual
Resets the zoom and panning in the view.
|
void |
zoomAndCenter()
Invoked after the component was resized to update the zoom if the zoom
policy is not none and/or update the translation of the diagram if
pageVisible and centerPage are true.
|
void |
zoomIn()
Zooms into the graph by zoomFactor.
|
void |
zoomOut()
Function: zoomOut
Zooms out of the graph by
|
void |
zoomTo(double newScale,
boolean center) |
createHorizontalScrollBar, createVerticalScrollBar, createViewport, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, isWheelScrollingEnabled, paramString, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportView, setWheelScrollingEnabled, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
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, transferFocusDownCycle, validate, validateTree
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, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, 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, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final int GRID_STYLE_DOT
public static final int GRID_STYLE_CROSS
public static final int GRID_STYLE_LINE
public static final int GRID_STYLE_DASHED
public static final int ZOOM_POLICY_NONE
public static final int ZOOM_POLICY_PAGE
public static final int ZOOM_POLICY_WIDTH
public static ImageIcon DEFAULT_EXPANDED_ICON
public static ImageIcon DEFAULT_COLLAPSED_ICON
public static ImageIcon DEFAULT_WARNING_ICON
public static final double DEFAULT_PAGESCALE
protected mxGraph graph
protected mxGraphComponent.mxGraphControl graphControl
protected mxEventSource eventSource
protected mxICellEditor cellEditor
protected mxConnectionHandler connectionHandler
protected mxPanningHandler panningHandler
protected mxSelectionCellsHandler selectionCellsHandler
protected mxGraphHandler graphHandler
protected float previewAlpha
protected ImageIcon backgroundImage
protected PageFormat pageFormat
protected mxInteractiveCanvas canvas
protected BufferedImage tripleBuffer
protected Graphics2D tripleBufferGraphics
protected double pageScale
DEFAULT_PAGESCALE
.protected boolean pageVisible
protected boolean preferPageSize
protected boolean pageBreaksVisible
protected Color pageBreakColor
protected int horizontalPageCount
protected int verticalPageCount
protected boolean centerPage
protected Color pageBackgroundColor
protected Color pageShadowColor
protected Color pageBorderColor
protected boolean gridVisible
protected Color gridColor
protected boolean autoScroll
protected boolean autoExtend
protected boolean dragEnabled
protected boolean importEnabled
protected boolean exportEnabled
protected boolean foldingEnabled
protected int tolerance
protected boolean swimlaneSelectionEnabled
protected boolean transparentSwimlaneContent
protected int gridStyle
protected ImageIcon expandedIcon
protected ImageIcon collapsedIcon
protected ImageIcon warningIcon
protected boolean antiAlias
protected boolean textAntiAlias
protected boolean escapeEnabled
protected boolean invokesStopCellEditing
protected boolean enterStopsCellEditing
protected int zoomPolicy
protected double zoomFactor
protected boolean keepSelectionVisibleOnZoom
protected boolean centerZoom
protected boolean tripleBuffered
public boolean showDirtyRectangle
protected Hashtable<Object,Component[]> components
protected Hashtable<Object,mxICellOverlay[]> overlays
protected mxEventSource.mxIEventListener updateHandler
protected mxEventSource.mxIEventListener repaintHandler
protected PropertyChangeListener viewChangeHandler
protected mxEventSource.mxIEventListener scaleHandler
public mxGraphComponent(mxGraph graph)
graph
- protected void installFocusHandler()
protected void installKeyHandler()
protected void installResizeHandler()
protected void installDoubleClickHandler()
protected mxICellEditor createCellEditor()
public void setGraph(mxGraph value)
public mxGraph getGraph()
protected mxGraphComponent.mxGraphControl createGraphControl()
public mxGraphComponent.mxGraphControl getGraphControl()
protected void createHandlers()
protected TransferHandler createTransferHandler()
protected mxSelectionCellsHandler createSelectionCellsHandler()
protected mxGraphHandler createGraphHandler()
public mxSelectionCellsHandler getSelectionCellsHandler()
public mxGraphHandler getGraphHandler()
protected mxConnectionHandler createConnectionHandler()
public mxConnectionHandler getConnectionHandler()
protected mxPanningHandler createPanningHandler()
public mxPanningHandler getPanningHandler()
public boolean isEditing()
public mxICellEditor getCellEditor()
public void setCellEditor(mxICellEditor value)
public int getTolerance()
public void setTolerance(int value)
value
- the tolerance to setpublic PageFormat getPageFormat()
public void setPageFormat(PageFormat value)
public double getPageScale()
public void setPageScale(double value)
public mxRectangle getLayoutAreaSize()
public ImageIcon getBackgroundImage()
public void setBackgroundImage(ImageIcon value)
public boolean isPageVisible()
public void setPageVisible(boolean value)
pageVisible
. zoomAndCenter
should be called if this is set to true.value
- the pageVisible to setpublic boolean isPreferPageSize()
public void setPreferPageSize(boolean value)
preferPageSize
.value
- the preferPageSize to setpublic boolean isPageBreaksVisible()
public void setPageBreaksVisible(boolean value)
value
- the pageBreaksVisible to setpublic Color getPageBreakColor()
public void setPageBreakColor(Color pageBreakColor)
pageBreakColor
- the pageBreakColor to setpublic void setHorizontalPageCount(int value)
value
- the horizontalPageCount to setpublic int getHorizontalPageCount()
public void setVerticalPageCount(int value)
value
- the verticalPageCount to setpublic int getVerticalPageCount()
public boolean isCenterPage()
public void setCenterPage(boolean value)
value
- the centerPage to setpublic Color getPageBackgroundColor()
public void setPageBackgroundColor(Color value)
value
- the pageBackgroundColor to setpublic Color getPageShadowColor()
public void setPageShadowColor(Color value)
value
- the pageShadowColor to setpublic Color getPageBorderColor()
public void setPageBorderColor(Color value)
value
- the pageBorderColor to setpublic boolean isKeepSelectionVisibleOnZoom()
public void setKeepSelectionVisibleOnZoom(boolean value)
value
- the keepSelectionVisibleOnZoom to setpublic double getZoomFactor()
public void setZoomFactor(double value)
value
- the zoomFactor to setpublic boolean isCenterZoom()
public void setCenterZoom(boolean value)
value
- the centerZoom to setpublic void setZoomPolicy(int value)
public int getZoomPolicy()
public void escape(KeyEvent e)
e
- public Object[] importCells(Object[] cells, double dx, double dy, Object target, Point location)
public void refresh()
public mxPoint getPointForEvent(MouseEvent e)
public mxPoint getPointForEvent(MouseEvent e, boolean addOffset)
public void startEditing()
public void startEditingAtCell(Object cell)
public void startEditingAtCell(Object cell, EventObject evt)
public String getEditingValue(Object cell, EventObject trigger)
public void stopEditing(boolean cancel)
public Object labelChanged(Object cell, Object value, EventObject evt)
cell
- Cell whose label should be changed.value
- New value of the label.evt
- Optional event that triggered the change.protected Dimension getPreferredSizeForPage()
public int getVerticalPageBorder()
public int getHorizontalPageBorder()
protected Dimension getScaledPreferredSizeForGraph()
protected mxPoint getPageTranslate(double scale)
public void zoomAndCenter()
public void zoomIn()
public void zoomOut()
public void zoom(double factor)
public void zoomTo(double newScale, boolean center)
public void zoomActual()
public void zoom(boolean page, boolean center)
protected void maintainScrollBar(boolean horizontal, double factor, boolean center)
public void scrollToCenter(boolean horizontal)
public void scrollCellToVisible(Object cell)
cell
- public void scrollCellToVisible(Object cell, boolean center)
cell
- public Object getCellAt(int x, int y)
x
- y
- public Object getCellAt(int x, int y, boolean hitSwimlaneContent)
x
- y
- hitSwimlaneContent
- public Object getCellAt(int x, int y, boolean hitSwimlaneContent, Object parent)
x
- X-coordinate of the location to be checked.y
- Y-coordinate of the location to be checked.parent
- public void setSwimlaneSelectionEnabled(boolean value)
public boolean isSwimlaneSelectionEnabled()
public Object[] selectRegion(Rectangle rect, MouseEvent e)
public Object[] getCells(Rectangle rect)
public Object[] getCells(Rectangle rect, Object parent)
public void selectCellsForEvent(Object[] cells, MouseEvent event)
public void selectCellForEvent(Object cell, MouseEvent e)
public boolean isSignificant(double dx, double dy)
public ImageIcon getFoldingIcon(mxCellState state)
public Rectangle getFoldingIconBounds(mxCellState state, ImageIcon icon)
public boolean hitFoldingIcon(Object cell, int x, int y)
public void setToolTips(boolean enabled)
enabled
- public boolean isConnectable()
public void setConnectable(boolean connectable)
connectable
- public boolean isPanning()
public void setPanning(boolean enabled)
enabled
- public boolean isAutoScroll()
public void setAutoScroll(boolean value)
value
- the autoScroll to setpublic boolean isAutoExtend()
public void setAutoExtend(boolean value)
value
- the autoExtend to setpublic boolean isEscapeEnabled()
public void setEscapeEnabled(boolean value)
value
- the escapeEnabled to setpublic boolean isInvokesStopCellEditing()
public void setInvokesStopCellEditing(boolean value)
value
- the invokesStopCellEditing to setpublic boolean isEnterStopsCellEditing()
public void setEnterStopsCellEditing(boolean value)
value
- the enterStopsCellEditing to setpublic boolean isDragEnabled()
public void setDragEnabled(boolean value)
value
- the dragEnabled to setpublic boolean isGridVisible()
public void setGridVisible(boolean value)
gridVisible
.value
- the gridVisible to setpublic boolean isAntiAlias()
public void setAntiAlias(boolean value)
antiAlias
.value
- the antiAlias to setpublic boolean isTextAntiAlias()
public void setTextAntiAlias(boolean value)
textAntiAlias
.value
- the textAntiAlias to setpublic float getPreviewAlpha()
public void setPreviewAlpha(float value)
public boolean isTripleBuffered()
public boolean isForceTripleBuffered()
public void setTripleBuffered(boolean value)
value
- the tripleBuffered to setpublic Color getGridColor()
public void setGridColor(Color value)
gridColor
.value
- the gridColor to setpublic int getGridStyle()
public void setGridStyle(int value)
gridStyle
.value
- the gridStyle to setpublic boolean isImportEnabled()
public void setImportEnabled(boolean value)
public Object[] getImportableCells(Object[] cells)
public boolean canImportCell(Object cell)
public boolean isExportEnabled()
public void setExportEnabled(boolean value)
value
- the exportEnabled to setpublic Object[] getExportableCells(Object[] cells)
public boolean canExportCell(Object cell)
public boolean isFoldingEnabled()
public void setFoldingEnabled(boolean value)
value
- the foldingEnabled to setpublic boolean isEditEvent(MouseEvent e)
public boolean isCloneEvent(MouseEvent event)
event
- public boolean isToggleEvent(MouseEvent event)
event
- public boolean isGridEnabledEvent(MouseEvent event)
event
- public boolean isPanningEvent(MouseEvent event)
event
- public boolean isConstrainedEvent(MouseEvent event)
event
- public boolean isForceMarqueeEvent(MouseEvent event)
event
- public int print(Graphics g, PageFormat printFormat, int page)
pageFormat
for the page format.print
in interface Printable
g
- The graphics to paint the graph on.printFormat
- The page format to use for printing.page
- The page to printPrintable.PAGE_EXISTS
or
Printable.NO_SUCH_PAGE
.public mxInteractiveCanvas getCanvas()
public BufferedImage getTripleBuffer()
public mxInteractiveCanvas createCanvas()
public mxCellHandler createHandler(mxCellState state)
state
- Cell state for which a handler should be created.public Component[] createComponents(mxCellState state)
public void insertComponent(mxCellState state, Component c)
public void updateComponent(mxCellState state, Component c)
public void updateComponents()
public void removeAllOverlays(Hashtable<Object,mxICellOverlay[]> map)
public String validateGraph()
public String validateGraph(Object cell, Hashtable<Object,Object> context)
cell
- Cell to start the validation recursion.context
- Object that represents the global validation state.public mxICellOverlay addCellOverlay(Object cell, mxICellOverlay overlay)
cell
- Cell to add the overlay for.overlay
- Overlay to be added for the cell.public mxICellOverlay[] getCellOverlays(Object cell)
cell
- Cell whose overlays should be returned.public mxICellOverlay removeCellOverlay(Object cell, mxICellOverlay overlay)
cell
- Cell whose overlay should be removed.overlay
- Optional overlay to be removed.public mxICellOverlay[] removeCellOverlays(Object cell)
cell
- Cell whose overlays should be removed.protected void removeCellOverlayComponent(mxICellOverlay overlay, Object cell)
protected void updateCellOverlayComponent(mxCellState state, mxICellOverlay overlay)
public void clearCellOverlays()
public void clearCellOverlays(Object cell)
cell
- Optional cell that represents the root of the subtree to
remove the overlays from. Default is the root in the model.public mxICellOverlay setCellWarning(Object cell, String warning)
cell
- Cell whose warning should be set.warning
- String that represents the warning to be displayed.public mxICellOverlay setCellWarning(Object cell, String warning, ImageIcon icon)
cell
- Cell whose warning should be set.warning
- String that represents the warning to be displayed.icon
- Optional image to be used for the overlay. Default is
warningImageBasename.public mxICellOverlay setCellWarning(Object cell, String warning, ImageIcon icon, boolean select)
cell
- Cell whose warning should be set.warning
- String that represents the warning to be displayed.icon
- Optional image to be used for the overlay. Default is
warningImageBasename.select
- Optional boolean indicating if a click on the overlay should
select the corresponding cell. Default is false.public Hashtable<Object,mxICellOverlay[]> updateCellOverlays(Object cell)
protected void paintBackground(Graphics g)
protected void paintBackgroundImage(Graphics g)
protected void paintGrid(Graphics g)
public void redraw(mxCellState state)
public void checkTripleBuffer()
protected void createTripleBuffer(int width, int height)
width
- height
- public void destroyTripleBuffer()
public void repaintTripleBuffer(Rectangle dirty)
dirty
- public boolean isEventsEnabled()
mxEventSource.isEventsEnabled()
public void setEventsEnabled(boolean eventsEnabled)
eventsEnabled
- mxEventSource.setEventsEnabled(boolean)
public void addListener(String eventName, mxEventSource.mxIEventListener listener)
eventName
- listener
- mxEventSource.addListener(java.lang.String,
com.mxgraph.util.mxEventSource.mxIEventListener)
public void removeListener(mxEventSource.mxIEventListener listener)
listener
- Listener instance.public void removeListener(mxEventSource.mxIEventListener listener, String eventName)
eventName
- Name of the event.listener
- Listener instance.Copyright (c) 2010 Gaudenz Alder, David Benson. All rights reserved.