V
- the graph vertex typeE
- the graph edge typepublic class JGraphXAdapter<V,E> extends com.mxgraph.view.mxGraph implements GraphListener<V,E>
Adapter to draw a JGraphT graph with the JGraphX drawing library.
This adapter will not convert JGraphX to JGraphT - this should be handled in another class entirely.
Note: If this class is used with an edge type such as String, you must either supply unique String names via addEdge(v1, v2, "edge123"), or use a custom edge factory which does so. Otherwise, if you use addEdge(v1, v2), the edge will be created with an empty String "" as value and saved (in JGraphT as well as in this class), which results in the edge not saving correctly.
allowDanglingEdges, allowLoops, allowNegativeCoordinates, alternateEdgeStyle, autoOrigin, autoSizeCells, border, cellsBendable, cellsCloneable, cellsDeletable, cellsDisconnectable, cellsEditable, cellsLocked, cellsMovable, cellsResizable, cellsSelectable, changesRepaintThreshold, changeSupport, cloneInvalidEdges, collapseToPreferredSize, connectableEdges, constrainChildren, defaultLoopStyle, defaultOverlap, defaultParent, disconnectOnMove, dropEnabled, edgeLabelsMovable, enabled, extendParents, extendParentsOnAdd, fullRepaintHandler, graphModelChangeHandler, gridEnabled, gridSize, htmlLabels, imageBundles, keepEdgesInBackground, keepEdgesInForeground, labelsClipped, labelsVisible, maximumGraphBounds, minimumGraphSize, model, multigraph, multiplicities, origin, portsEnabled, resetEdgesOnConnect, resetEdgesOnMove, resetEdgesOnResize, resetViewOnRootChange, selectionModel, splitEnabled, stylesheet, swimlaneNesting, updateOriginHandler, VERSION, vertexLabelsMovable, view
Constructor and Description |
---|
JGraphXAdapter(Graph<V,E> graph)
Constructs and draws a new mxGraph from a JGraphT graph.
|
JGraphXAdapter(ListenableGraph<V,E> graph)
Constructs and draws a new ListenableGraph.
|
Modifier and Type | Method and Description |
---|---|
void |
edgeAdded(GraphEdgeChangeEvent<V,E> e)
Notifies that an edge has been added to the graph.
|
void |
edgeRemoved(GraphEdgeChangeEvent<V,E> e)
Notifies that an edge has been removed from the graph.
|
HashMap<com.mxgraph.model.mxICell,E> |
getCellToEdgeMap()
Returns Hashmap which maps the visualization mxICells onto their edges.
|
HashMap<com.mxgraph.model.mxICell,V> |
getCellToVertexMap()
Returns Hashmap which maps the visualization mxICells onto their vertices.
|
HashMap<E,com.mxgraph.model.mxICell> |
getEdgeToCellMap()
Returns Hashmap which maps the edges onto their visualization mxICells.
|
HashMap<V,com.mxgraph.model.mxICell> |
getVertexToCellMap()
Returns Hashmap which maps the vertices onto their visualization mxICells.
|
void |
vertexAdded(GraphVertexChangeEvent<V> e)
Notifies that a vertex has been added to the graph.
|
void |
vertexRemoved(GraphVertexChangeEvent<V> e)
Notifies that a vertex has been removed from the graph.
|
addAllEdges, addCell, addCell, addCell, addCells, addCells, addCells, addCells, addEdge, addImageBundle, addPropertyChangeListener, addPropertyChangeListener, addSelectionCell, addSelectionCells, alignCells, alignCells, alignCells, cellConnected, cellDrawn, cellLabelChanged, cellsAdded, cellsAdded, cellsFolded, cellsFolded, cellSizeUpdated, cellsMoved, cellsOrdered, cellsRemoved, cellsResized, cellsToggled, clearSelection, cloneCells, cloneCells, connectCell, connectCell, constrainChild, convertValueToString, createEdge, createGraphView, createGroupCell, createSelectionModel, createStylesheet, createVertex, createVertex, disconnectGraph, drawCell, drawGraph, drawState, enterGroup, enterGroup, exitGroup, extendParent, findTreeRoots, findTreeRoots, findTreeRoots, flipEdge, foldCells, foldCells, foldCells, foldCells, getAllConnectionConstraints, getAllEdges, getAlternateEdgeStyle, getBorder, getBoundingBox, getBoundingBox, getBoundingBox, getBoundingBoxFromGeometry, getBoundsForCells, getBoundsForGroup, getCellBounds, getCellBounds, getCellBounds, getCellBounds, getCellContainmentArea, getCellGeometry, getCellsBeyond, getCellsForGroup, getCellStyle, getCellValidationError, getChangesRepaintThreshold, getChildCells, getChildCells, getChildEdges, getChildOffsetForCell, getChildVertices, getCloneableCells, getConnectionConstraint, getConnectionPoint, getConnections, getConnections, getConnections, getCurrentRoot, getDefaultLoopStyle, getDefaultOverlap, getDefaultParent, getDeletableCells, getDropTarget, getEdges, getEdges, getEdges, getEdges, getEdgesBetween, getEdgesBetween, getEdgeValidationError, getFoldableCells, getGraphBounds, getGridSize, getImage, getImageBundles, getImageBundles, getImageFromBundles, getIncomingEdges, getIncomingEdges, getLabel, getLinkForCell, getMaximumGraphBounds, getMinimumGraphSize, getModel, getMovableCells, getMultiplicities, getOpposites, getOpposites, getOrigin, getOutgoingEdges, getOutgoingEdges, getOverlap, getPaintBounds, getPreferredSizeForCell, getRemovedCellsForChanges, getSelectionCell, getSelectionCells, getSelectionCellsForChanges, getSelectionCount, getSelectionModel, getStartSize, getStylesheet, getTargetForCell, getTerminalForPort, getToolTipForCell, getTranslateForRoot, getView, graphModelChanged, groupCells, groupCells, groupCells, groupCells, home, insertEdge, insertEdge, insertVertex, insertVertex, insertVertex, isAllowDanglingEdges, isAllowLoops, isAllowNegativeCoordinates, isAllowOverlapParent, isAutoOrigin, isAutoSizeCell, isAutoSizeCells, isCellBendable, isCellCloneable, isCellCollapsed, isCellConnectable, isCellDeletable, isCellDisconnectable, isCellEditable, isCellFoldable, isCellLocked, isCellMovable, isCellResizable, isCellsBendable, isCellsCloneable, isCellsDeletable, isCellsDisconnectable, isCellsEditable, isCellSelectable, isCellSelected, isCellsLocked, isCellsMovable, isCellsResizable, isCellsSelectable, isCellVisible, isCloneInvalidEdges, isCollapseToPreferredSize, isConnectableEdges, isConstrainChild, isConstrainChildren, isDisconnectOnMove, isDropEnabled, isEdgeLabelsMovable, isEdgeValid, isEnabled, isExtendParent, isExtendParents, isExtendParentsOnAdd, isGridEnabled, isHtmlLabel, isHtmlLabels, isKeepEdgesInBackground, isKeepEdgesInForeground, isLabelClipped, isLabelMovable, isLabelsClipped, isLabelsVisible, isLoop, isMultigraph, isOrthogonal, isPort, isPortsEnabled, isResetEdgesOnConnect, isResetEdgesOnMove, isResetEdgesOnResize, isResetViewOnRootChange, isSelectionEmpty, isSplitEnabled, isSplitTarget, isSwimlane, isSwimlaneNesting, isTerminalPointMovable, isValidAncestor, isValidConnection, isValidDropTarget, isValidRoot, isValidSource, isValidTarget, isVertexLabelsMovable, main, moveCells, moveCells, moveCells, orderCells, orderCells, postProcessCellStyle, processChange, processChanges, refresh, removeCells, removeCells, removeCells, removeCellsFromParent, removeCellsFromParent, removeImageBundle, removePropertyChangeListener, removePropertyChangeListener, removeSelectionCell, removeSelectionCells, removeStateForCell, repaint, repaint, resetEdge, resetEdges, resizeCell, resizeCells, selectAll, selectAll, selectCell, selectCells, selectCells, selectChildCell, selectEdges, selectEdges, selectNextCell, selectParentCell, selectPreviousCell, selectVertices, selectVertices, setAllowDanglingEdges, setAllowLoops, setAllowNegativeCoordinates, setAlternateEdgeStyle, setAutoOrigin, setAutoSizeCells, setBorder, setCellsBendable, setCellsCloneable, setCellsDeletable, setCellsDisconnectable, setCellsEditable, setCellsLocked, setCellsMovable, setCellsResizable, setCellsSelectable, setCellStyle, setCellStyle, setCellStyleFlags, setCellStyleFlags, setCellStyles, setCellStyles, setChangesRepaintThreshold, setCloneInvalidEdges, setCollapseToPreferredSize, setConnectableEdges, setConnectionConstraint, setConstrainChildren, setDefaultLoopStyle, setDefaultOverlap, setDefaultParent, setDisconnectOnMove, setDropEnabled, setEdgeLabelsMovable, setEnabled, setExtendParents, setExtendParentsOnAdd, setGridEnabled, setGridSize, setHtmlLabels, setKeepEdgesInBackground, setKeepEdgesInForeground, setLabelsClipped, setLabelsVisible, setMaximumGraphBounds, setMinimumGraphSize, setModel, setMultigraph, setMultiplicities, setOrigin, setPortsEnabled, setResetEdgesOnConnect, setResetEdgesOnMove, setResetEdgesOnResize, setResetViewOnRootChange, setSelectionCell, setSelectionCells, setSelectionCells, setSplitEnabled, setStylesheet, setSwimlaneNesting, setVertexLabelsMovable, setView, snap, splitEdge, splitEdge, splitEdge, swapBounds, toggleCells, toggleCells, toggleCells, toggleCellStyle, toggleCellStyleFlags, toggleCellStyleFlags, toggleCellStyles, toggleCellStyles, translateCell, traverse, traverse, ungroupCells, ungroupCells, updateAlternateBounds, updateCellSize, updateCellSize, updateGroupBounds, updateGroupBounds, updateGroupBounds, updateGroupBounds, updateOrigin, validateCell, validateEdge
addListener, fireEvent, fireEvent, getEventSource, isEventsEnabled, removeListener, removeListener, setEventsEnabled, setEventSource
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
edgeWeightUpdated
public JGraphXAdapter(ListenableGraph<V,E> graph)
graph
- casted to graphpublic JGraphXAdapter(Graph<V,E> graph)
graph
- is a graphpublic HashMap<V,com.mxgraph.model.mxICell> getVertexToCellMap()
vertexToCellMap
public HashMap<E,com.mxgraph.model.mxICell> getEdgeToCellMap()
edgeToCellMap
public HashMap<com.mxgraph.model.mxICell,E> getCellToEdgeMap()
cellToEdgeMap
public HashMap<com.mxgraph.model.mxICell,V> getCellToVertexMap()
cellToVertexMap
public void vertexAdded(GraphVertexChangeEvent<V> e)
VertexSetListener
vertexAdded
in interface VertexSetListener<V>
e
- the vertex event.public void vertexRemoved(GraphVertexChangeEvent<V> e)
VertexSetListener
vertexRemoved
in interface VertexSetListener<V>
e
- the vertex event.public void edgeAdded(GraphEdgeChangeEvent<V,E> e)
GraphListener
edgeAdded
in interface GraphListener<V,E>
e
- the edge event.public void edgeRemoved(GraphEdgeChangeEvent<V,E> e)
GraphListener
edgeRemoved
in interface GraphListener<V,E>
e
- the edge event.Copyright © 2018. All rights reserved.