org.jgrapht.ext
Class JGraphModelAdapter<V,E>
- java.lang.Object
-
- javax.swing.undo.UndoableEditSupport
-
- org.jgraph.graph.DefaultGraphModel
-
- org.jgrapht.ext.JGraphModelAdapter<V,E>
-
- Type Parameters:
V- the graph vertex typeE- the graph edge type
- All Implemented Interfaces:
- java.io.Serializable, GraphModel
public class JGraphModelAdapter<V,E> extends DefaultGraphModel
A JGraph model adapter.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static interfaceJGraphModelAdapter.CellFactory<VV,EE>Creates the JGraph cells that reflect the respective JGraphT elements.static classJGraphModelAdapter.DefaultCellFactory<VV,EE>A simple default cell factory.-
Nested classes/interfaces inherited from class org.jgraph.graph.DefaultGraphModel
DefaultGraphModel.EmptyIterator, DefaultGraphModel.GraphModelEdit, DefaultGraphModel.GraphModelLayerEdit
-
-
Constructor Summary
Constructors Constructor and Description JGraphModelAdapter(Graph<V,E> jGraphTGraph)Constructs a new JGraph model adapter for the specified JGraphT graph.JGraphModelAdapter(Graph<V,E> jGraphTGraph, AttributeMap defaultVertexAttributes, AttributeMap defaultEdgeAttributes)Constructs a new JGraph model adapter for the specified JGraphT graph.JGraphModelAdapter(Graph<V,E> jGraphTGraph, AttributeMap defaultVertexAttributes, AttributeMap defaultEdgeAttributes, JGraphModelAdapter.CellFactory<V,E> cellFactory)Constructs a new JGraph model adapter for the specified JGraphT graph.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static <V,E> AttributeMapcreateDefaultEdgeAttributes(Graph<V,E> jGraphTGraph)Creates and returns a map of attributes to be used as defaults for edge attributes, depending on the specified graph.static AttributeMapcreateDefaultVertexAttributes()Creates and returns a map of attributes to be used as defaults for vertex attributes.JGraphModelAdapter.CellFactory<V,E>getCellFactory()Returns the cell factory used to create the JGraph cells.AttributeMapgetDefaultEdgeAttributes()Returns the default edge attributes used for creating new JGraph edges.AttributeMapgetDefaultVertexAttributes()Returns the default vertex attributes used for creating new JGraph vertices.DefaultEdgegetEdgeCell(E jGraphTEdge)Returns the JGraph edge cell that corresponds to the specified JGraphT edge.DefaultGraphCellgetVertexCell(java.lang.Object jGraphTVertex)Returns the JGraph vertex cell that corresponds to the specified JGraphT vertex.DefaultPortgetVertexPort(java.lang.Object jGraphTVertex)Returns the JGraph port cell that corresponds to the specified JGraphT vertex.voidsetDefaultEdgeAttributes(AttributeMap defaultEdgeAttributes)Sets the default edge attributes used for creating new JGraph edges.voidsetDefaultVertexAttributes(AttributeMap defaultVertexAttributes)Sets the default vertex attributes used for creating new JGraph vertices.-
Methods inherited from class org.jgraph.graph.DefaultGraphModel
acceptsSource, acceptsTarget, addGraphModelListener, beginUpdate, cellsChanged, cloneCell, cloneCell, cloneCells, contains, containsEdgeBetween, edges, edit, edit, endUpdate, execute, getAll, getAttributes, getAttributes, getChild, getChildCount, getConnectionSet, getDescendants, getEdges, getEdges, getEdgesBetween, getGraphModelListeners, getIncomingEdges, getIndexOfChild, getIndexOfRoot, getOpposite, getOutgoingEdges, getParent, getRootAt, getRootCount, getRoots, getRoots, getRoots, getRootsAsCollection, getSource, getSourceVertex, getTarget, getTargetVertex, getTopmostCells, getUpdateLevel, getUserObject, getValue, hasAncestorIn, insert, isEdge, isGroup, isLeaf, isPort, isRemoveEmptyGroups, isVertex, order, remove, removeGraphModelListener, setRemoveEmptyGroups, setSourcePort, setTargetPort, toBack, toFront, valueForCellChanged
-
Methods inherited from class javax.swing.undo.UndoableEditSupport
addUndoableEditListener, getUndoableEditListeners, postEdit, removeUndoableEditListener, toString
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jgraph.graph.GraphModel
addUndoableEditListener, removeUndoableEditListener
-
-
-
-
Constructor Detail
-
JGraphModelAdapter
public JGraphModelAdapter(Graph<V,E> jGraphTGraph)
Constructs a new JGraph model adapter for the specified JGraphT graph.- Parameters:
jGraphTGraph- the JGraphT graph for which JGraph model adapter to be created.nullis NOT permitted.
-
JGraphModelAdapter
public JGraphModelAdapter(Graph<V,E> jGraphTGraph, AttributeMap defaultVertexAttributes, AttributeMap defaultEdgeAttributes)
Constructs a new JGraph model adapter for the specified JGraphT graph.- Parameters:
jGraphTGraph- the JGraphT graph for which JGraph model adapter to be created.nullis NOT permitted.defaultVertexAttributes- a default map of JGraph attributes to format vertices.nullis NOT permitted.defaultEdgeAttributes- a default map of JGraph attributes to format edges.nullis NOT permitted.
-
JGraphModelAdapter
public JGraphModelAdapter(Graph<V,E> jGraphTGraph, AttributeMap defaultVertexAttributes, AttributeMap defaultEdgeAttributes, JGraphModelAdapter.CellFactory<V,E> cellFactory)
Constructs a new JGraph model adapter for the specified JGraphT graph.- Parameters:
jGraphTGraph- the JGraphT graph for which JGraph model adapter to be created.nullis NOT permitted.defaultVertexAttributes- a default map of JGraph attributes to format vertices.nullis NOT permitted.defaultEdgeAttributes- a default map of JGraph attributes to format edges.nullis NOT permitted.cellFactory- aJGraphModelAdapter.CellFactoryto be used to create the JGraph cells.nullis NOT permitted.- Throws:
java.lang.IllegalArgumentException- in case a parameter is not permitted
-
-
Method Detail
-
createDefaultEdgeAttributes
public static <V,E> AttributeMap createDefaultEdgeAttributes(Graph<V,E> jGraphTGraph)
Creates and returns a map of attributes to be used as defaults for edge attributes, depending on the specified graph.- Type Parameters:
V- the graph vertex typeE- the graph edge type- Parameters:
jGraphTGraph- the graph for which default edge attributes to be created.- Returns:
- a map of attributes to be used as default for edge attributes.
-
createDefaultVertexAttributes
public static AttributeMap createDefaultVertexAttributes()
Creates and returns a map of attributes to be used as defaults for vertex attributes.- Returns:
- a map of attributes to be used as defaults for vertex attributes.
-
getCellFactory
public JGraphModelAdapter.CellFactory<V,E> getCellFactory()
Returns the cell factory used to create the JGraph cells.- Returns:
- the cell factory used to create the JGraph cells.
-
setDefaultEdgeAttributes
public void setDefaultEdgeAttributes(AttributeMap defaultEdgeAttributes)
Sets the default edge attributes used for creating new JGraph edges.- Parameters:
defaultEdgeAttributes- the default edge attributes to set.
-
getDefaultEdgeAttributes
public AttributeMap getDefaultEdgeAttributes()
Returns the default edge attributes used for creating new JGraph edges.- Returns:
- the default edge attributes used for creating new JGraph edges.
-
setDefaultVertexAttributes
public void setDefaultVertexAttributes(AttributeMap defaultVertexAttributes)
Sets the default vertex attributes used for creating new JGraph vertices.- Parameters:
defaultVertexAttributes- the default vertex attributes to set.
-
getDefaultVertexAttributes
public AttributeMap getDefaultVertexAttributes()
Returns the default vertex attributes used for creating new JGraph vertices.- Returns:
- the default vertex attributes used for creating new JGraph vertices.
-
getEdgeCell
public DefaultEdge getEdgeCell(E jGraphTEdge)
Returns the JGraph edge cell that corresponds to the specified JGraphT edge. If no corresponding cell found, returnsnull.- Parameters:
jGraphTEdge- a JGraphT edge of the JGraphT graph.- Returns:
- the JGraph edge cell that corresponds to the specified JGraphT edge, or
nullif no corresponding cell found.
-
getVertexCell
public DefaultGraphCell getVertexCell(java.lang.Object jGraphTVertex)
Returns the JGraph vertex cell that corresponds to the specified JGraphT vertex. If no corresponding cell found, returnsnull.- Parameters:
jGraphTVertex- a JGraphT vertex of the JGraphT graph.- Returns:
- the JGraph vertex cell that corresponds to the specified JGraphT vertex, or
nullif no corresponding cell found.
-
getVertexPort
public DefaultPort getVertexPort(java.lang.Object jGraphTVertex)
Returns the JGraph port cell that corresponds to the specified JGraphT vertex. If no corresponding port found, returnsnull.- Parameters:
jGraphTVertex- a JGraphT vertex of the JGraphT graph.- Returns:
- the JGraph port cell that corresponds to the specified JGraphT vertex, or
nullif no corresponding cell found.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG