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());
}
}
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();
}
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());
}
}
Aggregations