Java源码示例:org.netbeans.api.visual.graph.GraphScene
示例1
public HierarchicalLayout(GraphScene<N, E> scene, boolean animate,
boolean inverted, int xOffset, int layerOffset) {
dummyWidth = DUMMY_WIDTH;
// scene is not used yet. It will be used when the container agnostic feature
// is put into the NBVL
this.animate = animate;
if (xOffset > 0) {
this.xOffset = xOffset;
} else {
this.xOffset = X_OFFSET;
}
if (layerOffset > 0) {
this.layerOffset = layerOffset;
} else {
this.layerOffset = LAYER_OFFSET;
}
this.invert = inverted;
}
示例2
/**
* Creates a new instance of DirectedGraph
*/
protected DirectedGraph(UniversalGraph<N, E> uGraph, GraphScene scene) {
this.uGraph = uGraph;
this.scene = scene;
this.nodes = uGraph.getNodes();
this.edges = uGraph.getEdges();
vertexMap = new HashMap<N, Vertex>();
edgeMap = new LinkedHashMap<E, Edge>();
rootVertices = new ArrayList<Vertex>();
vertices = new ArrayList<Vertex>();
}
示例3
/** Creates a new instance of UndirectedGraph */
private MixedGraph(UniversalGraph<N, E> uGraph, GraphScene scene) {
this.uGraph = uGraph;
this.scene = scene;
this.nodes = uGraph.getNodes();
this.edges = uGraph.getEdges() ;
vertexMap = new HashMap<N, Vertex>();
}
示例4
/**
*
* @param uGraph
* @param scene
*/
protected MGraph(UniversalGraph<N, E> uGraph, GraphScene scene) {
this.uGraph = uGraph;
this.scene = scene;
this.nodes = uGraph.getNodes();
vertexMap = new HashMap<N, Vertex>();
edgeMap = new LinkedHashMap<E, Edge>();
vertices = new ArrayList<Vertex>();
DummyVertex.resetCounter();
}
示例5
/**
* Creates a scene layout which performs a specified graph-oriented layout on a specified GraphScene.
* @param graphScene the graph scene
* @param graphLayout the graph layout
* @return the scene layout
*/
public static <N,E> SceneLayout createSceneGraphLayout (final GraphScene<N,E> graphScene, final GraphLayout<N,E> graphLayout) {
assert graphScene != null && graphLayout != null;
return new SceneLayout(graphScene) {
protected void performLayout () {
graphLayout.layoutGraph (graphScene);
}
};
}
示例6
private static void layoutScene(GraphScene<String, String> scene,
String root) {
AbegoTreeLayoutForNetbeans<String, String> graphLayout = new AbegoTreeLayoutForNetbeans<String, String>(
root, 100, 100, 50, 50, true);
SceneLayout sceneLayout = LayoutFactory.createSceneGraphLayout(scene,
graphLayout);
sceneLayout.invokeLayoutImmediately();
}
示例7
private static void layoutScene_NetbeansStyle(
GraphScene<String, String> scene, String root) {
GraphLayout<String, String> graphLayout = GraphLayoutFactory
.createTreeGraphLayout(100, 100, 50, 50, true);
GraphLayoutSupport.setTreeGraphLayoutRootNode(graphLayout, root);
SceneLayout sceneLayout = LayoutFactory.createSceneGraphLayout(scene,
graphLayout);
sceneLayout.invokeLayoutImmediately();
}
示例8
public HierarchicalLayout(GraphScene<N, E> scene, boolean animate, boolean inverted) {
this(scene, animate, inverted, X_OFFSET, LAYER_OFFSET);
}
示例9
public HierarchicalLayout(GraphScene<N, E> scene, boolean animate) {
this(scene, animate, false);
}
示例10
public static <N, E> DirectedGraph createGraph(UniversalGraph<N, E> uGraph, GraphScene scene) {
DirectedGraph<N, E> graph = new DirectedGraph<N, E>(uGraph, scene);
graph.createGraph();
//graph.printGraph();
return graph;
}
示例11
public static <N, E> MixedGraph createGraph(UniversalGraph<N, E> uGraph, GraphScene scene) {
MixedGraph<N, E> graph = new MixedGraph<N, E>(uGraph, scene);
graph.createGraph();
//graph.printGraph();
return graph;
}
示例12
/**
* Creates a graph-oriented tree layout.
* @param scene the GraphScene where the layout is used
* @param originX the x-axis origin
* @param originY the y-axis origin
* @param verticalGap the vertical gap between cells
* @param horizontalGap the horizontal gap between cells
* @param vertical if true, then layout organizes the graph vertically; if false, then horizontally
*/
public TreeGraphLayout (GraphScene<N, E> scene, int originX, int originY, int verticalGap, int horizontalGap, boolean vertical) {
this.scene = scene;
this.originX = originX;
this.originY = originY;
this.verticalGap = verticalGap;
this.horizontalGap = horizontalGap;
this.vertical = vertical;
}
示例13
/**
*
* @param uGraph
* @param scene
* @return
*/
public static <N, E> MGraph createGraph(UniversalGraph<N, E> uGraph, GraphScene scene) {
MGraph<N, E> graph = new MGraph<N, E>(uGraph, scene);
graph.createGraph();
return graph;
}
示例14
/**
* Create an instance of an OrthogonalLayout. Note that this layout does not
* work with the normal Scene class, but rather requires a GraphScene. This
* orthogonal layout uses the OrthogonalRouter to route the edges once it has
* completed laying out the nodes.
* @param scene the scene containing the nodes and edges.
*/
public OrthogonalLayout(GraphScene<N, E> scene, boolean animate) {
this.scene = scene;
this.animate = animate;
}
示例15
/**
*
* @param <N> the node class for the nodes in the graph.
* @param <E> the edge class for the edges in the graph.
* @param graphScene the GraphScene on which the layout is to be invoked.
* @param animate if true, the layout will animate the nodes into their new
* positions.
* @return a GraphLayout to be invoked from the calling class.
*/
public static <N, E> GraphLayout<N, E> createOrthogonalGraphLayout(GraphScene<N, E> graphScene, boolean animate) {
return new OrthogonalLayout(graphScene, animate);
}
示例16
/**
*
* @param <N> the node class for the nodes in the graph.
* @param <E> the edge class for the edges in the graph.
* @param graphScene the GraphScene on which the layout is to be invoked.
* @param animate if true, the layout will animate the nodes into their new
* positions.
* @return a GraphLayout to be invoked from the calling class.
*/
public static <N, E> GraphLayout<N, E> createHierarchicalGraphLayout(GraphScene<N, E> graphScene, boolean animate) {
return new HierarchicalLayout(graphScene, animate);
}
示例17
/**
*
* @param <N> the node class for the nodes in the graph.
* @param <E> the edge class for the edges in the graph.
* @param graphScene the GraphScene on which the layout is to be invoked.
* @param animate if true, the layout will animate the nodes into their new
* positions.
* @param inverted if true, the target nodes of an edge will be poisitioned
* in a layer higher than its source node.
* @return a GraphLayout to be invoked from the calling class.
*/
public static <N, E> GraphLayout<N, E> createHierarchicalGraphLayout(GraphScene<N, E> graphScene, boolean animate, boolean inverted) {
return new HierarchicalLayout(graphScene, animate, inverted);
}
示例18
/**
*
* @param <N> the node class for the nodes in the graph.
* @param <E> the edge class for the edges in the graph.
* @param graphScene the GraphScene on which the layout is to be invoked.
* @param animate if true, the layout will animate the nodes into their new
* positions.
* @param inverted if true, the target nodes of an edge will be poisitioned
* in a layer higher than its source node.
* @param xOffset the horizontal distance or gutter between the nodes.
* @param layerOffset the vertical distance between the layers of nodes.
* @return a GraphLayout to be invoked from the calling class.
*/
public static <N, E> GraphLayout<N, E> createHierarchicalGraphLayout(GraphScene<N, E> graphScene, boolean animate, boolean inverted,
int xOffset, int layerOffset) {
return new HierarchicalLayout(graphScene, animate, inverted, xOffset, layerOffset);
}