org.netbeans.api.visual.graph.GraphScene Java Examples

The following examples show how to use org.netbeans.api.visual.graph.GraphScene. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HierarchicalLayout.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #2
Source File: AbegoTreeLayoutForNetbeansDemo.java    From treelayout with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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();
}
 
Example #3
Source File: DirectedGraph.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * 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>();
}
 
Example #4
Source File: AbegoTreeLayoutForNetbeansDemo.java    From treelayout with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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();
}
 
Example #5
Source File: MixedGraph.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** 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>();
}
 
Example #6
Source File: LayoutFactory.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
        }
    };
}
 
Example #7
Source File: MGraph.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * @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();
}
 
Example #8
Source File: HierarchicalLayout.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public HierarchicalLayout(GraphScene<N, E> scene, boolean animate, boolean inverted) {
    this(scene, animate, inverted, X_OFFSET, LAYER_OFFSET);
}
 
Example #9
Source File: MixedGraph.java    From netbeans with Apache License 2.0 4 votes vote down vote up
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;
}
 
Example #10
Source File: DirectedGraph.java    From netbeans with Apache License 2.0 4 votes vote down vote up
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;
}
 
Example #11
Source File: HierarchicalLayout.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public HierarchicalLayout(GraphScene<N, E> scene, boolean animate) {
    this(scene, animate, false);
}
 
Example #12
Source File: TreeGraphLayout.java    From netbeans with Apache License 2.0 3 votes vote down vote up
/**
 * 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;
}
 
Example #13
Source File: MGraph.java    From netbeans with Apache License 2.0 2 votes vote down vote up
/**
 * 
 * @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;
}
 
Example #14
Source File: OrthogonalLayout.java    From netbeans with Apache License 2.0 2 votes vote down vote up
/**
 * 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;
}
 
Example #15
Source File: GraphLayoutFactory.java    From netbeans with Apache License 2.0 2 votes vote down vote up
/**
 * 
 * @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);
}
 
Example #16
Source File: GraphLayoutFactory.java    From netbeans with Apache License 2.0 2 votes vote down vote up
/**
 * 
 * @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);
}
 
Example #17
Source File: GraphLayoutFactory.java    From netbeans with Apache License 2.0 2 votes vote down vote up
/**
 * 
 * @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);
}
 
Example #18
Source File: GraphLayoutFactory.java    From netbeans with Apache License 2.0 2 votes vote down vote up
/**
 * 
 * @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);
}