Package org.gephi.workspace.impl

Examples of org.gephi.workspace.impl.WorkspaceImpl


        this.project = project;
        workspaces = new ArrayList<Workspace>();
    }

    public WorkspaceImpl newWorkspace() {
        WorkspaceImpl workspace = new WorkspaceImpl(project);
        workspaces.add(workspace);
        return workspace;
    }
View Full Code Here


        return project;
    }

    public Workspace readWorkspace(XMLStreamReader reader) throws Exception {
        WorkspaceImpl workspace = project.getLookup().lookup(WorkspaceProviderImpl.class).newWorkspace();
        WorkspaceInformationImpl info = workspace.getLookup().lookup(WorkspaceInformationImpl.class);

        //Name
        info.setName(reader.getAttributeValue(null, "name"));

        //Status
View Full Code Here

        }
        return null;
    }

    public void closeCurrentWorkspace() {
        WorkspaceImpl workspace = getCurrentWorkspace();
        if (workspace != null) {
            workspace.getLookup().lookup(WorkspaceInformationImpl.class).close();

            //Event
            fireWorkspaceEvent(EventType.UNSELECT, workspace);
        }
    }
View Full Code Here

        return project;
    }

    public Workspace readWorkspace(XMLStreamReader reader, ProjectImpl project) throws Exception {
        WorkspaceImpl workspace = null;
        boolean end = false;
        while (reader.hasNext() && !end) {
            Integer eventType = reader.next();
            if (eventType.equals(XMLEvent.START_ELEMENT)) {
                String name = reader.getLocalName();
                if ("workspaceFile".equalsIgnoreCase(name)) {
                    //Version
                    String version = reader.getAttributeValue(null, "version");
                    if (version == null || version.isEmpty() || Double.parseDouble(version) < 0.7) {
                        throw new GephiFormatException("Gephi project file version must be at least 0.7");
                    }
                } else if ("workspace".equalsIgnoreCase(name)) {
                    //Id
                    Integer workspaceId;
                    if (reader.getAttributeValue(null, "id") == null) {
                        workspaceId = project.nextWorkspaceId();
                    } else {
                        workspaceId = Integer.parseInt(reader.getAttributeValue(null, "id"));
                    }

                    workspace = project.getLookup().lookup(WorkspaceProviderImpl.class).newWorkspace(workspaceId);
                    WorkspaceInformationImpl info = workspace.getLookup().lookup(WorkspaceInformationImpl.class);

                    //Name
                    info.setName(reader.getAttributeValue(null, "name"));

                    //Status
View Full Code Here

        return null;
    }

    @Override
    public void closeCurrentWorkspace() {
        WorkspaceImpl workspace = getCurrentWorkspace();
        if (workspace != null) {
            workspace.getLookup().lookup(WorkspaceInformationImpl.class).close();

            //Event
            fireWorkspaceEvent(EventType.UNSELECT, workspace);
        }
    }
View Full Code Here

        this.project = project;
        workspaces = new ArrayList<Workspace>();
    }

    public synchronized WorkspaceImpl newWorkspace() {
        WorkspaceImpl workspace = new WorkspaceImpl(project, project.nextWorkspaceId());
        workspaces.add(workspace);
        return workspace;
    }
View Full Code Here

        workspaces.add(workspace);
        return workspace;
    }

    public synchronized WorkspaceImpl newWorkspace(int id) {
        WorkspaceImpl workspace = new WorkspaceImpl(project, id);
        workspaces.add(workspace);
        return workspace;
    }
View Full Code Here

TOP

Related Classes of org.gephi.workspace.impl.WorkspaceImpl

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.