Package org.gephi.project.api

Examples of org.gephi.project.api.Workspace


    }

    public void exportStream(OutputStream stream, ByteExporter byteExporter) {
        if (byteExporter.getWorkspace() == null) {
            ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);
            Workspace workspace = projectController.getCurrentWorkspace();
            byteExporter.setWorkspace(workspace);
        }
        byteExporter.setOutputStream(stream);
        try {
            byteExporter.execute();
View Full Code Here


    }

    public void exportWriter(Writer writer, CharacterExporter characterExporter) {
        if (characterExporter.getWorkspace() == null) {
            ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);
            Workspace workspace = projectController.getCurrentWorkspace();
            characterExporter.setWorkspace(workspace);
        }
        characterExporter.setWriter(writer);
        try {
            characterExporter.execute();
View Full Code Here

    public void copyToWorkspace(Workspace workspace) {
        GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
        AttributeController attributeController = Lookup.getDefault().lookup(AttributeController.class);
        ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);

        Workspace currentWorkspace = projectController.getCurrentWorkspace();
        AttributeModel sourceAttributeModel = attributeController.getModel(currentWorkspace);
        AttributeModel destAttributeModel = attributeController.getModel(workspace);
        destAttributeModel.mergeModel(sourceAttributeModel);

        GraphModel sourceModel = graphController.getModel(currentWorkspace);
View Full Code Here

    @Before
    public void setUp() {
        ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);
        projectController.newProject();
        Workspace workspace = projectController.getCurrentWorkspace();
        AttributeController attributeController = Lookup.getDefault().lookup(AttributeController.class);
        AttributeModel attributeModel = attributeController.getModel();
        GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
        GraphModel graphModel = graphController.getModel();
        HierarchicalDirectedGraph graph = graphModel.getHierarchicalDirectedGraph();
View Full Code Here

        return layoutBuilder;
    }

    public void setGraphModel(GraphModel graphModel) {
        this.graphModel = graphModel;
        Workspace workspace = graphModel.getWorkspace();
        DynamicController dynamicController = Lookup.getDefault().lookup(DynamicController.class);
        if (dynamicController != null && workspace != null) {
            dynamicModel = dynamicController.getModel(workspace);
        }
    }
View Full Code Here

                uiModel = null;
                refreshModel();
            }
        });
        if (pc.getCurrentWorkspace() != null) {
            Workspace workspace = pc.getCurrentWorkspace();
            filterModel = workspace.getLookup().lookup(FilterModel.class);
            uiModel = workspace.getLookup().lookup(FilterUIModel.class);
            if (uiModel == null) {
                uiModel = new FilterUIModel();
                workspace.add(uiModel);
            }
        }
        refreshModel();
    }
View Full Code Here

    @Before
    public void setUp() {
        ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
        pc.newProject();
        Workspace workspace = pc.getCurrentWorkspace();
        Lookup.getDefault().lookup(AttributeController.class).getModel();

        //Graph 1 - Multilevel sample without edges
        DhnsGraphController controller1 = new DhnsGraphController();
        dhns1 = new Dhns(controller1, workspace);
        graph1 = new HierarchicalDirectedGraphImpl(dhns1, dhns1.getGraphStructure().getMainView());
        GraphFactoryImpl factory1 = dhns1.factory();

        AbstractNode nodeA = factory1.newNode();
        AbstractNode nodeB = factory1.newNode();
        AbstractNode nodeC = factory1.newNode();
        AbstractNode nodeD = factory1.newNode();
        AbstractNode nodeE = factory1.newNode();
        graph1.addNode(nodeA);
        graph1.addNode(nodeB);
        graph1.addNode(nodeC, nodeA);
        graph1.addNode(nodeE, nodeB);
        graph1.addNode(nodeD, nodeA);
        graph1.addNode(nodeD, nodeB);

        //Graph2 - Directed sample with edges
        Workspace workspace2 = pc.newWorkspace(pc.getCurrentProject());
        pc.openWorkspace(workspace2);
        Lookup.getDefault().lookup(AttributeController.class).getModel();
        nodeMap2 = new HashMap<String, Node>();
        DhnsGraphController controller2 = new DhnsGraphController();
        dhns2 = new Dhns(controller2, workspace2);
View Full Code Here

            DHNSSerializer dHNSSerializer = new DHNSSerializer();
            StringWriter stringWriter = new StringWriter();
            dHNSSerializer.writeDhns(createWriter(stringWriter), dhns2);
            String s1 = stringWriter.toString();
            ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
            Workspace workspace3 = pc.newWorkspace(pc.getCurrentProject());
            pc.openWorkspace(workspace3);
            Lookup.getDefault().lookup(AttributeController.class).getModel();
            Dhns d2 = new Dhns(new DhnsGraphController(), workspace3);
            StringReader stringReader = new StringReader(s1);
            dHNSSerializer.readDhns(createReader(stringReader), d2);
View Full Code Here

            }
        }
    }

    public AttributeModel getModel() {
        Workspace workspace = projectController.getCurrentWorkspace();
        if (workspace != null) {
            AttributeModel model = workspace.getLookup().lookup(AttributeModel.class);
            if (model != null) {
                return model;
            }
            model = new IndexedAttributeModel();
            workspace.add(model);
            return model;
        }
        return null;
    }
View Full Code Here

            }
        });

        // checks the current workspace state
        if (pc.getCurrentWorkspace() != null) {
            Workspace workspace = pc.getCurrentWorkspace();
            model = (PreviewModelImpl) workspace.getLookup().lookup(PreviewModel.class);
            if (model == null) {
                model = new PreviewModelImpl();
                workspace.add(model);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.gephi.project.api.Workspace

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.