org.jgrapht.ext
Class JGraphXAdapter<V,E>
- java.lang.Object
-
- com.mxgraph.util.mxEventSource
-
- com.mxgraph.view.mxGraph
-
- org.jgrapht.ext.JGraphXAdapter<V,E>
-
- Type Parameters:
V- the graph vertex typeE- the graph edge type
- All Implemented Interfaces:
- java.util.EventListener, GraphListener<V,E>, VertexSetListener<V>
public class JGraphXAdapter<V,E> extends 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.
Known Bugs: If this class is used with String-Edges, please note that there is a bug with the method JgraphT.addEdge(vertex1, vertex2); 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. So, if you're using Strings as Edgeclass please use the method addEdge(vertex1, vertex2, "Edgename"); with a unique edgename.
- Since:
- 09 July, 2013
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.mxgraph.view.mxGraph
mxGraph.mxICellVisitor
-
Nested classes/interfaces inherited from class com.mxgraph.util.mxEventSource
mxEventSource.mxIEventListener
-
-
Constructor Summary
Constructors 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidedgeAdded(GraphEdgeChangeEvent<V,E> e)Notifies that an edge has been added to the graph.voidedgeRemoved(GraphEdgeChangeEvent<V,E> e)Notifies that an edge has been removed from the graph.java.util.HashMap<mxICell,E>getCellToEdgeMap()Returns Hashmap which maps the visualization mxICells onto their edges.java.util.HashMap<mxICell,V>getCellToVertexMap()Returns Hashmap which maps the visualization mxICells onto their vertices.java.util.HashMap<E,mxICell>getEdgeToCellMap()Returns Hashmap which maps the edges onto their visualization mxICells.java.util.HashMap<V,mxICell>getVertexToCellMap()Returns Hashmap which maps the vertices onto their visualization mxICells.voidvertexAdded(GraphVertexChangeEvent<V> e)Notifies that a vertex has been added to the graph.voidvertexRemoved(GraphVertexChangeEvent<V> e)Notifies that a vertex has been removed from the graph.-
Methods inherited from class com.mxgraph.view.mxGraph
addAllEdges, addCell, addCell, addCell, addCells, addCells, addCells, addCells, addEdge, addImageBundle, addPropertyChangeListener, addPropertyChangeListener, addSelectionCell, addSelectionCells, alignCells, alignCells, alignCells, cellConnected, cellLabelChanged, cellsAdded, cellsAdded, cellsFolded, cellsFolded, cellSizeUpdated, cellsMoved, cellsOrdered, cellsRemoved, cellsResized, cellsToggled, clearSelection, cloneCells, cloneCells, connectCell, connectCell, constrainChild, convertValueToString, createEdge, createGroupCell, 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, getMaximumGraphBounds, getMinimumGraphSize, getModel, getMovableCells, getMultiplicities, getOpposites, getOpposites, getOrigin, getOutgoingEdges, getOutgoingEdges, getOverlap, getPaintBounds, getPreferredSizeForCell, getRemovedCellsForChanges, getSelectionCell, getSelectionCells, getSelectionCellsForChanges, getSelectionCount, getSelectionModel, getStartSize, getStylesheet, 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, processChange, processChanges, refresh, removeCells, removeCells, removeCells, removeCellsFromParent, removeCellsFromParent, removeImageBundle, removePropertyChangeListener, removePropertyChangeListener, removeSelectionCell, removeSelectionCells, 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, validateCell, validateEdge
-
Methods inherited from class com.mxgraph.util.mxEventSource
addListener, fireEvent, fireEvent, getEventSource, isEventsEnabled, removeListener, removeListener, setEventsEnabled, setEventSource
-
-
-
-
Constructor Detail
-
JGraphXAdapter
public JGraphXAdapter(ListenableGraph<V,E> graph)
Constructs and draws a new ListenableGraph. If the graph changes through as ListenableGraph, the JGraphXAdapter will automatically add/remove the new edge/vertex as it implements the GraphListener interface. Throws a IllegalArgumentException if the graph is null.- Parameters:
graph- casted to graph
-
JGraphXAdapter
public JGraphXAdapter(Graph<V,E> graph)
Constructs and draws a new mxGraph from a jGraphT graph. Changes on the jgraphT graph will not edit this mxGraph any further; use the constructor with the ListenableGraph parameter instead or use this graph as a normal mxGraph. Throws an IllegalArgumentException if the parameter is null.- Parameters:
graph- is a graph
-
-
Method Detail
-
getVertexToCellMap
public java.util.HashMap<V,mxICell> getVertexToCellMap()
Returns Hashmap which maps the vertices onto their visualization mxICells.- Returns:
vertexToCellMap
-
getEdgeToCellMap
public java.util.HashMap<E,mxICell> getEdgeToCellMap()
Returns Hashmap which maps the edges onto their visualization mxICells.- Returns:
edgeToCellMap
-
getCellToEdgeMap
public java.util.HashMap<mxICell,E> getCellToEdgeMap()
Returns Hashmap which maps the visualization mxICells onto their edges.- Returns:
cellToEdgeMap
-
getCellToVertexMap
public java.util.HashMap<mxICell,V> getCellToVertexMap()
Returns Hashmap which maps the visualization mxICells onto their vertices.- Returns:
cellToVertexMap
-
vertexAdded
public void vertexAdded(GraphVertexChangeEvent<V> e)
Description copied from interface:VertexSetListenerNotifies that a vertex has been added to the graph.- Specified by:
vertexAddedin interfaceVertexSetListener<V>- Parameters:
e- the vertex event.
-
vertexRemoved
public void vertexRemoved(GraphVertexChangeEvent<V> e)
Description copied from interface:VertexSetListenerNotifies that a vertex has been removed from the graph.- Specified by:
vertexRemovedin interfaceVertexSetListener<V>- Parameters:
e- the vertex event.
-
edgeAdded
public void edgeAdded(GraphEdgeChangeEvent<V,E> e)
Description copied from interface:GraphListenerNotifies that an edge has been added to the graph.- Specified by:
edgeAddedin interfaceGraphListener<V,E>- Parameters:
e- the edge event.
-
edgeRemoved
public void edgeRemoved(GraphEdgeChangeEvent<V,E> e)
Description copied from interface:GraphListenerNotifies that an edge has been removed from the graph.- Specified by:
edgeRemovedin interfaceGraphListener<V,E>- Parameters:
e- the edge event.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG