Package org.gephi.project.api

Examples of org.gephi.project.api.ProjectController


        if (nodes != null) {
            int i = 0;
            ArrayList<GraphContextMenuItem> subItems = new ArrayList<GraphContextMenuItem>();
            if (canExecute()) {
                subItems.add(new CopyOrMoveToWorkspaceSubItem(null, true, 0, 0, isCopy()));//New workspace
                ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);
                for (final Workspace w : projectController.getCurrentProject().getLookup().lookup(WorkspaceProvider.class).getWorkspaces()) {
                    GraphContextMenuItem item = new CopyOrMoveToWorkspaceSubItem(w, w != projectController.getCurrentWorkspace(), 1, i, isCopy());
                    subItems.add(item);
                    i++;
                }
                return subItems.toArray(new ContextMenuItemManipulator[0]);
            } else {
View Full Code Here


                add(northBar, BorderLayout.NORTH);
            }
        }

        //Workspace events
        ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);
        projectController.addWorkspaceListener(new WorkspaceListener() {

            public void initialize(Workspace workspace) {
            }

            public void select(Workspace workspace) {
                toolbar.setEnabled(true);
                propertiesBar.setEnabled(true);
                actionsToolbar.setEnabled(true);
                selectionToolbar.setEnabled(true);
                addonsBar.setEnabled(true);
            }

            public void unselect(Workspace workspace) {
            }

            public void close(Workspace workspace) {
            }

            public void disable() {
                toolbar.setEnabled(false);
                propertiesBar.setEnabled(false);
                actionsToolbar.setEnabled(false);
                selectionToolbar.setEnabled(false);
                addonsBar.setEnabled(false);
            }
        });

        boolean hasWorkspace = projectController.getCurrentWorkspace() != null;
        toolbar.setEnabled(hasWorkspace);
        propertiesBar.setEnabled(hasWorkspace);
        actionsToolbar.setEnabled(hasWorkspace);
        selectionToolbar.setEnabled(hasWorkspace);
        addonsBar.setEnabled(hasWorkspace);
View Full Code Here

    private PartitionModelImpl model;
    private boolean refreshPartitions = true;

    public PartitionControllerImpl() {

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

            public void initialize(Workspace workspace) {
                workspace.add(new PartitionModelImpl());
            }

            public void select(Workspace workspace) {
                model = workspace.getLookup().lookup(PartitionModelImpl.class);
                if (model == null) {
                    model = new PartitionModelImpl();
                    workspace.add(model);
                }
                refreshPartitions = true;
                GraphModel gm = Lookup.getDefault().lookup(GraphController.class).getModel(workspace);
                trachViewChange(gm);
                AttributeModel attributeModel = Lookup.getDefault().lookup(AttributeController.class).getModel(workspace);
                attributeModel.addAttributeListener(PartitionControllerImpl.this);
            }

            public void unselect(Workspace workspace) {
                GraphModel gm = Lookup.getDefault().lookup(GraphController.class).getModel(workspace);
                untrackViewChange(gm);
                model = null;
                AttributeModel attributeModel = workspace.getLookup().lookup(AttributeModel.class);
                attributeModel.removeAttributeListener(PartitionControllerImpl.this);
            }

            public void close(Workspace workspace) {
            }

            public void disable() {
                untrackViewChange(null);
            }
        });
        if (pc.getCurrentWorkspace() != null) {
            refreshPartitions = true;
            model = pc.getCurrentWorkspace().getLookup().lookup(PartitionModelImpl.class);
            if (model == null) {
                model = new PartitionModelImpl();
                Workspace workspace = pc.getCurrentWorkspace();
                pc.getCurrentWorkspace().add(model);
                GraphModel gm = Lookup.getDefault().lookup(GraphController.class).getModel(workspace);
                trachViewChange(gm);

                AttributeModel attributeModel = Lookup.getDefault().lookup(AttributeController.class).getModel(workspace);
                attributeModel.addAttributeListener(PartitionControllerImpl.this);
View Full Code Here

        setName(NbBundle.getMessage(PartitionTopComponent.class, "CTL_PartitionTopComponent"));
//        setToolTipText(NbBundle.getMessage(PartitionTopComponent.class, "HINT_PartitionTopComponent"));
        setIcon(ImageUtilities.loadImage(ICON_PATH));

        initEvents();
        ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
        PartitionController partitionController = Lookup.getDefault().lookup(PartitionController.class);
        if (pc.getCurrentWorkspace() != null) {
            PartitionModel model = pc.getCurrentWorkspace().getLookup().lookup(PartitionModel.class);
            refreshModel(model);
        }
    }
View Full Code Here

            refreshModel(model);
        }
    }

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

            public void initialize(Workspace workspace) {
            }

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

        exportFile(file, fileExporter);
    }

    public void exportFile(File file, Exporter fileExporter) throws IOException {
        if (fileExporter.getWorkspace() == null) {
            ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);
            Workspace workspace = projectController.getCurrentWorkspace();
            fileExporter.setWorkspace(workspace);
        }
        if (fileExporter instanceof ByteExporter) {
            OutputStream stream = new BufferedOutputStream(new FileOutputStream(file));
            ((ByteExporter) fileExporter).setOutputStream(stream);
View Full Code Here

        }
    }

    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

                model = null;
                refreshModel();
            }
        });

        ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);
        if (projectController.getCurrentWorkspace() != null) {
            model = projectController.getCurrentWorkspace().getLookup().lookup(LayoutModel.class);
        }
        refreshModel();
    }
View Full Code Here

TOP

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

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.