public class Project extends DBObject
Constructor and Description |
---|
Project(long id,
String title)
Constructor used by the Loader to find projects.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addUniqueType(TemplateThing tt)
Returns false if the type exists already.
|
void |
adjustProperties() |
Project |
createSubproject(Rectangle roi,
Layer first,
Layer last,
boolean ignore_hidden_patches)
Create a new subproject for the given layer range and ROI.
|
void |
decache(Object ob) |
boolean |
destroy() |
void |
exportDTD(StringBuilder sb_header,
HashSet<String> hs,
String indent)
Export a complete DTD listing to export the project as XML.
|
void |
exportXML(StringBuilder sb,
String indent,
XMLOptions options)
Subclasses can override this method to store the instance as XML.
|
void |
exportXML(Writer writer,
String indent,
XMLOptions options)
Export the main trakem2 tag wrapping four hierarchies (the project tag, the ProjectTree, and the Top Level LayerSet the latter including all Displayable objects) and a list of displays.
|
ProjectThing |
find(long id)
Find the ProjectThing instance with the given id.
|
DBObject |
findById(long id) |
LayerThing |
findLayerThing(Object ob)
Find a LayerThing that contains the given object.
|
static Project |
findProject(Loader loader) |
ProjectThing |
findProjectThing(Object ob)
Find a ProjectThing that contains the given object.
|
boolean |
getBooleanProperty(String key) |
String |
getDocType()
Returns the String to be used as Document Type of the XML file, generated from the name of the root template thing.
|
int |
getFirstMipMapLevelSaved()
Get the mipmap level at which to start saving images.
|
String |
getInfo()
Returns id and project name; this method is meant to be overriden by any of the subclasses.
|
LayerTree |
getLayerTree() |
Loader |
getLoader() |
String |
getMeaningfulTitle(Displayable d)
Searches upstream in the Project tree for things that have a user-defined name, stops at the first and returns it along with all the intermediate ones that only have a type and not a title, appended.
|
String |
getMeaningfulTitle2(Displayable d) |
int |
getMipMapsMode()
The mode (aka algorithmic approach) used to generate mipmaps, which defaults to
Loader.DEFAULT_MIPMAPS_MODE . |
static String |
getName(Class<?> c)
Returns a user-understandable name for the given class.
|
String |
getParentTitle(Displayable d)
Returns the title of the enclosing abstract node in the ProjectTree.
|
TreeMap<String,TPlugIn> |
getPlugins(String menu) |
static Project |
getProject(String title) |
static ArrayList<Project> |
getProjects()
Return a copy of the list of all open projects.
|
ProjectTree |
getProjectTree() |
HashMap<String,String> |
getPropertiesCopy() |
String |
getProperty(String key)
Returns null if not defined.
|
float |
getProperty(String key,
float default_value)
Returns the default value if not defined, or if not a number or not parsable as a number.
|
int |
getProperty(String key,
int default_value) |
LayerSet |
getRootLayerSet() |
LayerThing |
getRootLayerThing() |
ProjectThing |
getRootProjectThing() |
TemplateThing |
getRootTemplateThing() |
String |
getShortMeaningfulTitle(Displayable d)
Returns the first upstream user-defined name and type, and the id of the displayable tagged at the end.
|
String |
getShortMeaningfulTitle(ProjectThing thing,
Displayable d) |
TemplateThing |
getTemplateThing(String type)
Returns the proper TemplateThing for the given type, complete with children and attributes if any.
|
TemplateTree |
getTemplateTree() |
String |
getTitle()
Sublcasses can override this method to provide a proper String, otherwise calls toString()
|
static String |
getType(Class<?> c) |
String[] |
getUniqueTypes()
Returns a list of existing unique types in the template tree
(thus the 'project' type is not included, nor the label).
|
String |
getUNUId()
Return the Universal Near-Unique Id of this project, which may be null for non-FSLoader projects.
|
static boolean |
isBasicType(String type)
Returns true if the type is 'patch', 'layer', 'layer_set', 'profile', 'profile_list' 'pipe'.
|
boolean |
isBeingDestroyed() |
boolean |
isInputEnabled() |
static boolean |
isLayerSetType(String type) |
static boolean |
isLayerType(String type) |
static boolean |
isProjectType(String type) |
Object |
makeObject(TemplateThing tt)
Make an object of the type the TemplateThing can hold.
|
static Project |
newDBProject()
Create a new PostgreSQL-based TrakEM2 project.
|
static Project |
newFSProject(String arg)
Creates a new project to be based on .xml and image files, not a database.
|
static Project |
newFSProject(String arg,
TemplateThing template_root) |
static Project |
newFSProject(String arg,
TemplateThing template_root,
String storage_folder)
Creates a new project to be based on .xml and image files, not a database.
|
static Project |
newFSProject(String arg,
TemplateThing template_root,
String storage_folder,
boolean autocreate_one_layer) |
static Project |
openDBProject()
Open a TrakEM2 project from the database.
|
static Project |
openFSProject(String path) |
static Project |
openFSProject(String path,
boolean open_displays)
Opens a project from an .xml file.
|
void |
parseXMLOptions(HashMap<String,String> ht_attributes) |
void |
remove()
Remove the project from the database and release memory.
|
boolean |
remove(boolean check)
Remove the project from the database and release memory.
|
boolean |
remove(Displayable d)
Removes an object from this Project.
|
boolean |
removeAll(Set<Displayable> col)
Calls Project.removeAll(col, null)
|
boolean |
removeAll(Set<Displayable> col,
DefaultMutableTreeNode top_node)
Remove any set of Displayable objects from the Layer, LayerSet and Project Tree as necessary.
|
boolean |
removeProjectThing(Object object,
boolean check)
Remove the ProjectThing that contains the given object, which will remove the object itself as well.
|
boolean |
removeProjectThing(Object object,
boolean check,
boolean remove_empty_parents,
int levels)
Remove the ProjectThing that contains the given object, which will remove the object itself as well.
|
boolean |
removeUniqueType(String type)
Remove a unique type from the HashMap.
|
void |
resetRootLayerThing(LayerThing lt,
HashMap<Thing,Boolean> ltree_exp)
For undo purposes.
|
void |
resetRootProjectThing(ProjectThing pt,
HashMap<Thing,Boolean> ptree_exp)
For undo purposes.
|
void |
resetRootTemplateThing(TemplateThing tt,
HashMap<Thing,Boolean> ttree_exp)
For undo purposes.
|
String |
save()
Save the project regardless of what getLoader().hasChanges() reports.
|
String |
saveAs(String xml_path,
boolean overwrite)
This is not the saveAs used from the menus; this one is meant for programmatic access.
|
Bureaucrat |
saveTask(String command) |
String |
saveWithoutCoordinateTransforms()
Save an XML file that is stripped of coordinate transforms,
and merely refers to them by the 'ct_id' attribute of each 't2_patch' element;
this method will NOT overwrite the XML file but save into a new one,
which is chosen from a file dialog.
|
void |
select(Displayable d)
Find the node in any tree with a Thing that contains the given Displayable, and set it selected/highlighted, deselecting everything else first.
|
void |
select(Layer layer)
Find the node in the layer tree with a Thing that contains the given object, and set it selected/highlighted, deselecting everything else first.
|
int |
setFirstMipMapLevelSaved(double level)
Returns the newly set mipmap level (an integer, made by a floor operation on
level ), or the current one if level is NaN or negative. |
void |
setMipMapsMode(int mode) |
void |
setProperty(String key,
String value) |
void |
setReceivesInput(boolean b)
Tells the displays concerning this Project to accept/reject input.
|
void |
setTempLoader(Loader loader) |
void |
setTitle(String title) |
String |
toString() |
boolean |
typeExists(String type) |
boolean |
updateTypeName(String old_type,
String new_type) |
addToDatabase, getId, getProject, getShortTitle, getUniqueIdentifier, removeFromDatabase, updateInDatabase, updateInDatabase
public Project(long id, String title)
public static ArrayList<Project> getProjects()
public static Project newDBProject()
public static Project openDBProject()
public static Project newFSProject(String arg)
public static Project newFSProject(String arg, TemplateThing template_root)
public static Project newFSProject(String arg, TemplateThing template_root, String storage_folder)
arg
- Either "blank", "amira", "stack" or null. "blank" will generate a default template tree; "amira" will ask for importing an Amira file; "stack" will ask for importing an image stack (single multi-image file, like multi-TIFF).template_root
- May be null, in which case a template DTD or XML file will be asked for, unless arg
equals "blank".storage_folder
- If null, a dialog asks for it.public static Project newFSProject(String arg, TemplateThing template_root, String storage_folder, boolean autocreate_one_layer)
public static Project openFSProject(String path, boolean open_displays)
public void setTempLoader(Loader loader)
public final Loader getLoader()
public String save()
public String saveAs(String xml_path, boolean overwrite) throws IllegalArgumentException
IllegalArgumentException
public String saveWithoutCoordinateTransforms()
public boolean destroy()
public boolean isBeingDestroyed()
public void remove()
public boolean remove(boolean check)
public void setTitle(String title)
public String getTitle()
DBObject
public TemplateTree getTemplateTree()
public LayerTree getLayerTree()
public ProjectTree getProjectTree()
public Object makeObject(TemplateThing tt)
public static boolean isBasicType(String type)
public static boolean isProjectType(String type)
public static boolean isLayerSetType(String type)
public static boolean isLayerType(String type)
public boolean removeProjectThing(Object object, boolean check)
public boolean removeProjectThing(Object object, boolean check, boolean remove_empty_parents, int levels)
public void select(Layer layer)
public void select(Displayable d)
public ProjectThing find(long id)
public DBObject findById(long id)
public LayerThing findLayerThing(Object ob)
public ProjectThing findProjectThing(Object ob)
public void decache(Object ob)
public ProjectThing getRootProjectThing()
public LayerSet getRootLayerSet()
public String getParentTitle(Displayable d)
public String getMeaningfulTitle2(Displayable d)
public String getMeaningfulTitle(Displayable d)
public String getShortMeaningfulTitle(Displayable d)
public String getShortMeaningfulTitle(ProjectThing thing, Displayable d)
public TemplateThing getTemplateThing(String type)
public String[] getUniqueTypes()
public boolean removeUniqueType(String type)
public boolean typeExists(String type)
public boolean addUniqueType(TemplateThing tt)
public void exportXML(StringBuilder sb, String indent, XMLOptions options)
DBObject
public void exportXML(Writer writer, String indent, XMLOptions options) throws Exception
Exception
public void exportDTD(StringBuilder sb_header, HashSet<String> hs, String indent)
public String getDocType()
public static String getName(Class<?> c)
public String getInfo()
DBObject
public void setReceivesInput(boolean b)
public boolean isInputEnabled()
public Project createSubproject(Rectangle roi, Layer first, Layer last, boolean ignore_hidden_patches)
public float getProperty(String key, float default_value)
public int getProperty(String key, int default_value)
public boolean getBooleanProperty(String key)
public final int setFirstMipMapLevelSaved(double level)
level
), or the current one if level
is NaN or negative.public final int getFirstMipMapLevelSaved()
public void adjustProperties()
public String getUNUId()
public final boolean remove(Displayable d)
public final boolean removeAll(Set<Displayable> col)
public final boolean removeAll(Set<Displayable> col, DefaultMutableTreeNode top_node)
col
.public void resetRootProjectThing(ProjectThing pt, HashMap<Thing,Boolean> ptree_exp)
public void resetRootTemplateThing(TemplateThing tt, HashMap<Thing,Boolean> ttree_exp)
public void resetRootLayerThing(LayerThing lt, HashMap<Thing,Boolean> ltree_exp)
public TemplateThing getRootTemplateThing()
public LayerThing getRootLayerThing()
public Bureaucrat saveTask(String command)
public int getMipMapsMode()
Loader.DEFAULT_MIPMAPS_MODE
.public void setMipMapsMode(int mode)
getMipMapsMode()
Copyright © 2015–2021 Fiji. All rights reserved.