Package org.gephi.graph.api

Examples of org.gephi.graph.api.GraphController


        //Append container to graph structure
        ImportController importController = Lookup.getDefault().lookup(ImportController.class);
        importController.process(container, new DefaultProcessor(), workspace);

        //Set labels
        GraphController gc = Lookup.getDefault().lookup(GraphController.class);
        GraphModel graphModel = gc.getModel(workspace);
        for (Node n : graphModel.getGraph().getNodes()) {
            n.getNodeData().setLabel("Node " + n.getNodeData().getId());
        }

        PreviewModel model = Lookup.getDefault().lookup(PreviewController.class).getModel();
View Full Code Here


    /**
     * Private constructor.
     */
    private PreviewUIController() {
        PreviewController previewController = Lookup.getDefault().lookup(PreviewController.class);
        final GraphController gc = Lookup.getDefault().lookup(GraphController.class);
        PreviewModel previewModel = previewController.getModel();
        if (previewModel != null) {
            graphModel = gc.getModel();
            graphModel.addGraphListener(this);
        }

        ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
        pc.addWorkspaceListener(new WorkspaceListener() {

            public void initialize(Workspace workspace) {
            }

            public void select(Workspace workspace) {
                //Make sure AttributeModel is created before graph model:
                Lookup.getDefault().lookup(AttributeController.class).getModel();

                graphModel = gc.getModel();
                graphModel.addGraphListener(PreviewUIController.this);
                showRefreshNotification();
            }

            public void unselect(Workspace workspace) {
View Full Code Here

                    } else {
                        gradientColors = colors = heatMapPanel.getGradientColors();
                        gradientPositions = positions = heatMapPanel.getGradientPositions();
                        dontPaintUnreachable = heatMapPanel.isDontPaintUnreachable();
                    }
                    GraphController gc = Lookup.getDefault().lookup(GraphController.class);

                    AbstractShortestPathAlgorithm algorithm;
                    if (gc.getModel().getGraphVisible() instanceof DirectedGraph) {
                        DirectedGraph graph = (DirectedGraph) gc.getModel().getGraphVisible();
                        algorithm = new BellmanFordShortestPathAlgorithm(graph, n);
                        algorithm.compute();
                    } else {
                        Graph graph = gc.getModel().getGraphVisible();
                        algorithm = new DijkstraShortestPathAlgorithm(graph, n);
                        algorithm.compute();
                    }

                    //Color
View Full Code Here

                    sourceNode = n;
                    edgePencilPanel.setStatus(NbBundle.getMessage(EdgePencil.class, "EdgePencil.status2"));
                } else {
                    color = edgePencilPanel.getColor();
                    weight = edgePencilPanel.getWeight();
                    GraphController gc = Lookup.getDefault().lookup(GraphController.class);
                    Graph graph = gc.getModel().getGraph();
                    boolean directed = graph instanceof DirectedGraph;
                    Edge edge = gc.getModel().factory().newEdge(sourceNode, n, weight, directed);
                    edge.getEdgeData().setR(color.getRed() / 255f);
                    edge.getEdgeData().setG(color.getGreen() / 255f);
                    edge.getEdgeData().setB(color.getBlue() / 255f);
                    graph.addEdge(edge);
                    sourceNode = null;
View Full Code Here

                    shortestPathPanel.setStatus(NbBundle.getMessage(ShortestPath.class, "ShortestPath.status2"));
                } else if (n != sourceNode) {
                    color = shortestPathPanel.getColor();
                    float[] colorArray = new float[]{color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f};
                    Node targetNode = n;
                    GraphController gc = Lookup.getDefault().lookup(GraphController.class);

                    AbstractShortestPathAlgorithm algorithm;
                    if (gc.getModel().getGraphVisible() instanceof DirectedGraph) {
                        algorithm = new BellmanFordShortestPathAlgorithm((DirectedGraph) gc.getModel().getGraphVisible(), sourceNode);
                    } else {
                        algorithm = new DijkstraShortestPathAlgorithm(gc.getModel().getGraphVisible(), sourceNode);
                    }
                    algorithm.compute();

                    double distance;
                    if ((distance = algorithm.getDistances().get(targetNode)) != Double.POSITIVE_INFINITY) {
View Full Code Here

    @Before
    public void setUp() {
        //Graph
        ProjectController pj = Lookup.getDefault().lookup(ProjectController.class);
        pj.newProject();
        GraphController gc = Lookup.getDefault().lookup(GraphController.class);
        graphModel = gc.getModel();
        GraphFactory factory = graphModel.factory();
        Graph graph = gc.getModel().getUndirectedGraph();
        rootGraph = graph;

        //Add 8 nodes
        for (int i = 0; i < 8; i++) {
            Node node = factory.newNode();
View Full Code Here

            model.setRunning(true);
        }
    }

    public void injectGraph() {
        GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
        if (model.getSelectedLayout() != null && graphController.getModel() != null) {
            model.getSelectedLayout().setGraphModel(graphController.getModel());
        }
    }
View Full Code Here

    /**
     *
     * @param statistics
     */
    public void execute(final Statistics pStatistics, LongTaskListener listener) {
        final GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
        final GraphModel graphModel = graphController.getModel();
        final AttributeModel attributeModel = Lookup.getDefault().lookup(AttributeController.class).getModel();
        StatisticsBuilder builder = getBuilder(pStatistics.getClass());
        final StatisticsUI[] uis = getUI(pStatistics);

        for (StatisticsUI s : uis) {
View Full Code Here

*/
@ServiceProvider(service = WorkspaceDuplicateProvider.class, position = 1000)
public class DhnsDuplicateProvider implements WorkspaceDuplicateProvider {

    public void duplicate(Workspace source, Workspace destination) {
        GraphController controller = Lookup.getDefault().lookup(GraphController.class);
        Dhns sourceModel = (Dhns) controller.getModel(source);
        Dhns destModel = (Dhns) controller.getModel(destination);
        if (sourceModel != null && destModel != null) {
            sourceModel.getDuplicateManager().duplicate(destModel);
        }
    }
View Full Code Here

    private double density;
    /** */
    private boolean isDirected;

    public GraphDensity() {
        GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
        if (graphController != null && graphController.getModel() != null) {
            isDirected = graphController.getModel().isDirected();
        }
    }
View Full Code Here

TOP

Related Classes of org.gephi.graph.api.GraphController

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.