Search in sources :

Example 1 with ProjectMetaData

use of org.gephi.project.api.ProjectMetaData in project gephi by gephi.

the class ProjectPropertiesEditor method load.

public void load(Project project) {
    ProjectInformation info = project.getLookup().lookup(ProjectInformation.class);
    if (info != null) {
        nameTextField.setText(info.getName());
        if (info.getFile() != null) {
            fileLabel.setText(info.getFile().getName());
        }
    }
    ProjectMetaData metaData = project.getLookup().lookup(ProjectMetaData.class);
    if (metaData != null) {
        titleTextField.setText(metaData.getTitle());
        authorTextField.setText(metaData.getAuthor());
        keywordsTextField.setText(metaData.getKeywords());
        descriptionTextArea.setText(metaData.getDescription());
    }
}
Also used : ProjectMetaData(org.gephi.project.api.ProjectMetaData) ProjectInformation(org.gephi.project.api.ProjectInformation)

Example 2 with ProjectMetaData

use of org.gephi.project.api.ProjectMetaData in project gephi by gephi.

the class GephiWriter method writeProject.

public static void writeProject(XMLStreamWriter writer, Project project) throws Exception {
    writer.writeStartDocument("UTF-8", "1.0");
    writer.writeStartElement("projectFile");
    // Header
    writer.writeAttribute("version", VERSION);
    writer.writeStartElement("lastModifiedDate");
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Calendar cal = Calendar.getInstance();
    sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
    writer.writeCharacters(sdf.format(cal.getTime()));
    writer.writeComment("yyyy-MM-dd HH:mm:ss");
    writer.writeEndElement();
    writer.writeComment("File saved with " + getVersion());
    ProjectInformation info = project.getLookup().lookup(ProjectInformation.class);
    ProjectMetaData metaData = project.getLookup().lookup(ProjectMetaData.class);
    // Start Project
    writer.writeStartElement("project");
    writer.writeAttribute("name", info.getName());
    writer.writeAttribute("ids", String.valueOf(((ProjectImpl) project).getWorkspaceIds()));
    // MetaData
    writer.writeStartElement("metadata");
    writer.writeStartElement("title");
    writer.writeCharacters(metaData.getTitle());
    writer.writeEndElement();
    writer.writeStartElement("keywords");
    writer.writeCharacters(metaData.getKeywords());
    writer.writeEndElement();
    writer.writeStartElement("description");
    writer.writeCharacters(metaData.getDescription());
    writer.writeEndElement();
    writer.writeStartElement("author");
    writer.writeCharacters(metaData.getAuthor());
    writer.writeEndElement();
    writer.writeEndElement();
    // End Metadata
    writer.writeEndElement();
    // End Project
    writer.writeEndElement();
    writer.writeEndDocument();
}
Also used : ProjectImpl(org.gephi.project.impl.ProjectImpl) Calendar(java.util.Calendar) ProjectMetaData(org.gephi.project.api.ProjectMetaData) ProjectInformation(org.gephi.project.api.ProjectInformation) SimpleDateFormat(java.text.SimpleDateFormat)

Example 3 with ProjectMetaData

use of org.gephi.project.api.ProjectMetaData in project gephi by gephi.

the class ProjectPropertiesEditor method save.

public void save(Project project) {
    ProjectInformation info = project.getLookup().lookup(ProjectInformation.class);
    if (info != null) {
        if (!nameTextField.getText().isEmpty() && !nameTextField.getText().equals(info.getName())) {
            ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
            pc.renameProject(project, nameTextField.getText());
        }
    }
    ProjectMetaData metaData = project.getLookup().lookup(ProjectMetaData.class);
    if (metaData != null) {
        metaData.setTitle(titleTextField.getText());
        metaData.setAuthor(authorTextField.getText());
        metaData.setKeywords(keywordsTextField.getText());
        metaData.setDescription(descriptionTextArea.getText());
    }
}
Also used : ProjectMetaData(org.gephi.project.api.ProjectMetaData) ProjectInformation(org.gephi.project.api.ProjectInformation) ProjectController(org.gephi.project.api.ProjectController)

Aggregations

ProjectInformation (org.gephi.project.api.ProjectInformation)3 ProjectMetaData (org.gephi.project.api.ProjectMetaData)3 SimpleDateFormat (java.text.SimpleDateFormat)1 Calendar (java.util.Calendar)1 ProjectController (org.gephi.project.api.ProjectController)1 ProjectImpl (org.gephi.project.impl.ProjectImpl)1