use of ini.trakem2.persistence.XMLOptions in project TrakEM2 by trakem2.
the class Project method save.
/**
* Save the project regardless of what getLoader().hasChanges() reports.
*/
public String save() {
// let it repaint the log window
Thread.yield();
XMLOptions options = new XMLOptions();
options.overwriteXMLFile = true;
options.export_images = false;
options.patches_dir = null;
options.include_coordinate_transform = true;
String path = loader.save(this, options);
if (null != path)
restartAutosaving();
return path;
}
use of ini.trakem2.persistence.XMLOptions in project TrakEM2 by trakem2.
the class Project method saveAs.
/**
* This is not the saveAs used from the menus; this one is meant for programmatic access.
*/
public String saveAs(String xml_path, boolean overwrite) throws IllegalArgumentException {
if (null == xml_path)
throw new IllegalArgumentException("xml_path cannot be null.");
XMLOptions options = new XMLOptions();
options.overwriteXMLFile = overwrite;
options.export_images = false;
options.patches_dir = null;
options.include_coordinate_transform = true;
String path = loader.saveAs(xml_path, options);
if (null != path)
restartAutosaving();
return path;
}
use of ini.trakem2.persistence.XMLOptions in project TrakEM2 by trakem2.
the class Project method exportXML2.
// A separate method to ensure that sb_body instance is garbage collected.
private final void exportXML2(final java.io.Writer writer, final String in, final XMLOptions options) throws Exception {
final StringBuilder sb_body = new StringBuilder();
// 2 - the project itself
sb_body.append(in).append("<project \n").append(in).append("\tid=\"").append(id).append("\"\n").append(in).append("\ttitle=\"").append(title).append("\"\n");
loader.insertXMLOptions(sb_body, in + "\t");
// Write properties, with the additional property of the image_resizing_mode
final HashMap<String, String> props = new HashMap<String, String>(ht_props);
props.put("image_resizing_mode", Loader.getMipMapModeName(mipmaps_mode));
props.put("first_mipmap_level_saved", Integer.toString(this.first_mipmap_level_saved));
for (final Map.Entry<String, String> e : props.entrySet()) {
sb_body.append(in).append('\t').append(e.getKey()).append("=\"").append(e.getValue()).append("\"\n");
}
sb_body.append(in).append(">\n");
// 3 - export ProjectTree abstract hierarchy (skip the root since it wraps the project itself)
project_tree.getExpandedStates(options.expanded_states);
if (null != root_pt.getChildren()) {
final String in2 = in + "\t";
for (final ProjectThing pt : root_pt.getChildren()) {
pt.exportXML(sb_body, in2, options);
}
}
sb_body.append(in).append("</project>\n");
writer.write(sb_body.toString());
}
Aggregations