Package org.gephi.graph.api

Examples of org.gephi.graph.api.GraphModel


        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();
        Font font = new Font("Broadway", Font.PLAIN, 15);
View Full Code Here


        }
    }

    private void filter(AbstractQueryImpl query) {
        FilterProcessor processor = new FilterProcessor();
        GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
        Graph result = processor.process((AbstractQueryImpl) query, graphModel);
//        System.out.println("#Nodes: " + result.getNodeCount());
//        System.out.println("#Edges: " + result.getEdgeCount());
        if (running) {
            GraphView view = result.getView();
            graphModel.setVisibleView(view);
            if (model.getCurrentResult() != null) {
                graphModel.destroyView(model.getCurrentResult());
            }
            model.setCurrentResult(view);
        } else {
            //destroy view
            graphModel.destroyView(result.getView());
        }
    }
View Full Code Here

        }
    }

    private void select(AbstractQueryImpl query) {
        FilterProcessor processor = new FilterProcessor();
        GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
        Graph result = processor.process((AbstractQueryImpl) query, graphModel);
//        System.out.println("#Nodes: " + result.getNodeCount());
//        System.out.println("#Edges: " + result.getEdgeCount());
        if (running) {
            VisualizationController visController = Lookup.getDefault().lookup(VisualizationController.class);
            if (visController != null) {
                visController.selectNodes(result.getNodes().toArray());
                visController.selectEdges(result.getEdges().toArray());
            }
            GraphView view = result.getView();
            model.setCurrentResult(view);
        } else {
            //destroy view
            graphModel.destroyView(result.getView());
        }
    }
View Full Code Here

    public void setup(Node[] nodes, Node clickedNode) {
        this.nodes=nodes;
        this.sourceNode=clickedNode;//Choose clicked node as source by default (but the user can select it or other one in the UI)

        GraphModel currentGraphModel=Lookup.getDefault().lookup(GraphController.class).getModel();
        if(graphModel!=currentGraphModel){//If graph model has changed since last execution, change default mode for edges to create in UI, else keep this parameter across calls
            directed=currentGraphModel.isDirected()||currentGraphModel.isMixed();//Get graph directed state. Set to true if graph is directed or mixed
            graphModel=currentGraphModel;
        }
    }
View Full Code Here

    public boolean canExecute() {
        return Lookup.getDefault().lookup(GraphElementsController.class).getNodesCount()>1;//At least 2 nodes to link them
    }

    public ManipulatorUI getUI() {
        GraphModel currentGraphModel=Lookup.getDefault().lookup(GraphController.class).getModel();
        if(graphModel!=currentGraphModel){//If graph model has changed since last execution, change default mode for edges to create in UI, else keep this parameter across calls
            directed=currentGraphModel.isDirected()||currentGraphModel.isMixed();//Get graph directed state. Set to true if graph is directed or mixed
            graphModel=currentGraphModel;
        }
        return new AddEdgeToGraphUI();
    }
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

        }

        public Partition getCurrentPartition() {
            if (partition.getPartsCount() == 0) {
                //build partition
                GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
                this.partition = Lookup.getDefault().lookup(PartitionController.class).buildPartition(partition.getColumn(), graphModel.getHierarchicalGraphVisible());
            }
            return partition;
        }
View Full Code Here

        attributesExportCheckbox.setSelected(exporterGEXF.isExportAttributes());
        normalizeCheckbox.setSelected(exporterGEXF.isNormalize());
        dynamicExportCheckbox.setSelected(exporterGEXF.isExportDynamic());
        hierarchyCheckbox.setSelected(exporterGEXF.isExportHierarchy());

        GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
        hierarchyCheckbox.setEnabled(graphModel.isHierarchical());
    }
View Full Code Here

        attributesExportCheckbox.setSelected(exporterGraphML.isExportAttributes());
        normalizeCheckbox.setSelected(exporterGraphML.isNormalize());

        hierarchyCheckbox.setSelected(exporterGraphML.isExportHierarchy());

        GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
        hierarchyCheckbox.setEnabled(graphModel.isHierarchical());
    }
View Full Code Here

        levelLimitCombo.setModel(comboBoxModel);
        levelLimitCombo.setSelectedIndex(Math.min(h, dendrogram.getMaxHeight()));
    }

    public void refresh() {
        final GraphModel model = Lookup.getDefault().lookup(GraphController.class).getModel();
        if (model != null) {
            Thread thread = new Thread(new Runnable() {

                public void run() {
                    BusyLabel busyLabel = BusyUtils.createCenteredBusyLabel(centerScrollPane, NbBundle.getMessage(HierarchyTopComponent.class, "HierarchyTopComponent.busyLabel.text"), dendrogram);
                    busyLabel.setBusy(true);
                    final HierarchicalGraph graph = model.getHierarchicalGraph();
                    SwingUtilities.invokeLater(new Runnable() {

                        public void run() {
                            refreshLevelLimit(graph);
                        }
View Full Code Here

TOP

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

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.