public final class ProjectThing extends DBObject implements TitledThing
Modifier and Type | Class and Description |
---|---|
class |
ProjectThing.Profile_List |
Constructor and Description |
---|
ProjectThing(TemplateThing template,
Project project,
long id,
Object ob,
ArrayList<ProjectThing> al_children)
Reconstruct a ProjectThing from the database, used in combination with the 'setup' method.
|
ProjectThing(TemplateThing template,
Project project,
Object ob)
Create a new ProjectThing of the given type to contain the given Object.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addChild(ProjectThing child,
int index)
In addition, if the child contains an object of class ini.trakem2.display.Profile, reorders all children of the parent Thing by the Z of the layers of the profiles.
|
boolean |
addChild(Thing child) |
boolean |
canHaveAsChild(String type) |
boolean |
canHaveAsChild(Thing thing) |
HashSet<ProjectThing> |
collectSimilarThings(TemplateThing tt,
HashSet<ProjectThing> hs)
Recursive into children, find those of the given type that have the same parent chain as the given TemplateThing.
|
ProjectThing |
createChild(String type) |
ArrayList<ProjectThing> |
createChildren(String type,
int amount,
boolean recursive)
Creates one instance of the given type and if recursive, also of all possible children of it, and of them, and so on.
|
ProjectThing |
createClonedChild(ProjectThing child)
At the moment only for basic types, which by definition have no children.
|
void |
debug(String indent) |
ProjectThing |
deepClone(Project project,
boolean copy_id)
Clone this ProjectThing with its template and all its children and objects cloned, and return it.
|
void |
exportSVG(StringBuffer data,
double z_scale,
String indent) |
void |
exportXML(StringBuilder sb_body,
String indent,
XMLOptions options)
Expects a
HashMap<Thing,Boolean> as any . |
HashSet<ProjectThing> |
findBasicTypeChildren()
Recursive into children.
|
HashSet<ProjectThing> |
findBasicTypeChildren(HashSet<ProjectThing> hs_basic,
HashSet<ProjectThing> hs_visited)
Recursive into children, and adds this instance as well if it's a basic type.
|
ProjectThing |
findChild(long id)
Recursive search for the thing of the given id.
|
Thing |
findChild(Object ob)
Recursive search for the thing that contains the given object.
|
void |
findChildren(ArrayList<ProjectThing> found,
Pattern pattern,
Pattern pattern_exclude,
boolean shallow)
Recursive into children, searches for things whose object.toString() matches the given regex pattern, and stores the found ProjectThing in the given ArrayList.
|
ArrayList<ProjectThing> |
findChildren(String regex,
String regex_exclude,
boolean shallow)
Recursive into children, searches for the things whose object.toString() matches the given regex, case insensitive.
|
<T> ArrayList<T> |
findChildrenOfType(Class<T> c)
Check if this Thing directly contains any child of the given object class (including interfaces), and return them all.
|
ArrayList<ProjectThing> |
findChildrenOfType(String type)
Check if this Thing directly contains any child of the given type, and return them all.
|
List<ProjectThing> |
findChildrenOfTypeR(Class<?> c)
Finds them in order.
|
HashSet<ProjectThing> |
findChildrenOfTypeR(HashSet<ProjectThing> hs,
String type)
Recursive into children.
|
List<ProjectThing> |
findChildrenOfTypeR(List<ProjectThing> list,
Class<?> c)
Finds them in order.
|
HashSet<ProjectThing> |
findChildrenOfTypeR(String type)
Recursive into children.
|
DBObject |
findObject(long id)
Recursive search for the object with the given id.
|
<T> List<T> |
findObjects(Class<T> c)
Find objects of the given class, as determined by c.isInstance(this.object).
|
boolean |
fixZOrdering()
If this is of type profile_list, order all children Profile by their layer's Z coordinate, ascending.
|
HashMap<String,ArrayList<ProjectThing>> |
getByType()
Recursively browse all children to classify all nodes by type.
|
ArrayList<ProjectThing> |
getChildren() |
TemplateThing |
getChildTemplate(String type) |
String |
getInfo()
Return information on this node and its object, and also on all the children, recursively.
|
String |
getNodeInfo()
Return information on this node and its object.
|
Object |
getObject() |
Thing |
getParent() |
JMenuItem[] |
getPopupItems(ActionListener listener) |
ProjectThing |
getRootParent()
Crawl up until finding a parent that has no parent: the root.
|
TemplateThing |
getTemplate() |
ArrayList<TemplateThing> |
getTemplatePathTo(String type)
Returns a list of parent types (String), in order, for the given Thing if it exists as a child in the traversed trees.
|
String |
getTitle()
Sublcasses can override this method to provide a proper String, otherwise calls toString()
|
String |
getType() |
boolean |
hasChildren() |
boolean |
hasParent(String type)
Check if this or any of its parents are of the given type.
|
boolean |
isExpanded() |
void |
measure()
Measure each node, recursively into children, and at the end display all the result tables, one for each data type.
|
HashMap<Class<?>,ij.measure.ResultsTable> |
measure(HashMap<Class<?>,ij.measure.ResultsTable> ht)
Call on children things, and on itself if it contains a basic data type directly.
|
boolean |
move(int inc)
Moves this ProjectThing up and down the parent's children list.
|
boolean |
remove(boolean check)
Subclasses can override this method to perform other tasks before removing itself from the database.
|
protected boolean |
remove(boolean check,
boolean remove_object) |
boolean |
removeChild(ProjectThing child) |
void |
setObject(Object object)
Used by the TMLHandler; can be used only once.
|
void |
setParent(Thing parent) |
void |
setTitle(String title) |
void |
setup() |
void |
setVisible(boolean b)
Switch the visibility of the Displayable objects contained here or in the children.
|
Thing |
shallowCopy()
A new copy with same template, same object and cloned table of same attributes, but no parent and no children.
|
ProjectThing |
subclone(Project pr)
Implicit id copying; assumes the ids of the object are also the same in the given project; the object, if it is a DBObject, is retrieved from the given project by matching its id.
|
String |
toString() |
boolean |
uniquePathExists(String type)
Check if any of the possible children of this Thing can have the given Thing as child, or any of they children can, recursing down.
|
void |
updateTitle()
Recursive into children and object (to update it's DisplayablePanel title).
|
void |
updateType(String new_type,
String old_type)
Recursive into children, changes the type column in the ab_things table.
|
addToDatabase, getId, getProject, getShortTitle, getUniqueIdentifier, removeFromDatabase, updateInDatabase, updateInDatabase
public ProjectThing(TemplateThing template, Project project, Object ob) throws Exception
Exception
public ProjectThing(TemplateThing template, Project project, long id, Object ob, ArrayList<ProjectThing> al_children)
public Thing shallowCopy()
shallowCopy
in interface Thing
public ProjectThing deepClone(Project project, boolean copy_id) throws Exception
Exception
public void setObject(Object object)
public void setup()
public String toString()
public String getTitle()
DBObject
public boolean addChild(ProjectThing child, int index)
public ArrayList<ProjectThing> getChildren()
getChildren
in interface Thing
public boolean hasChildren()
hasChildren
in interface Thing
public boolean removeChild(ProjectThing child)
public boolean remove(boolean check)
DBObject
protected boolean remove(boolean check, boolean remove_object)
public ProjectThing getRootParent()
public boolean hasParent(String type)
public void setTitle(String title)
setTitle
in interface TitledThing
public TemplateThing getChildTemplate(String type)
public boolean canHaveAsChild(Thing thing)
canHaveAsChild
in interface Thing
public boolean uniquePathExists(String type)
public ArrayList<TemplateThing> getTemplatePathTo(String type)
public TemplateThing getTemplate()
public JMenuItem[] getPopupItems(ActionListener listener)
public void setVisible(boolean b)
public ArrayList<ProjectThing> createChildren(String type, int amount, boolean recursive)
public boolean canHaveAsChild(String type)
public ProjectThing createChild(String type)
public ProjectThing createClonedChild(ProjectThing child)
public ArrayList<ProjectThing> findChildren(String regex, String regex_exclude, boolean shallow)
public void findChildren(ArrayList<ProjectThing> found, Pattern pattern, Pattern pattern_exclude, boolean shallow)
public Thing findChild(Object ob)
public ProjectThing findChild(long id)
public DBObject findObject(long id)
public HashMap<Class<?>,ij.measure.ResultsTable> measure(HashMap<Class<?>,ij.measure.ResultsTable> ht)
public void measure()
public void exportSVG(StringBuffer data, double z_scale, String indent)
public ArrayList<ProjectThing> findChildrenOfType(String type)
public <T> ArrayList<T> findChildrenOfType(Class<T> c)
c
.public HashSet<ProjectThing> findChildrenOfTypeR(String type)
public HashSet<ProjectThing> findChildrenOfTypeR(HashSet<ProjectThing> hs, String type)
public List<ProjectThing> findChildrenOfTypeR(Class<?> c)
public List<ProjectThing> findChildrenOfTypeR(List<ProjectThing> list, Class<?> c)
public <T> List<T> findObjects(Class<T> c)
public HashSet<ProjectThing> findBasicTypeChildren()
public HashSet<ProjectThing> findBasicTypeChildren(HashSet<ProjectThing> hs_basic, HashSet<ProjectThing> hs_visited)
public void updateTitle()
public void updateType(String new_type, String old_type)
public HashSet<ProjectThing> collectSimilarThings(TemplateThing tt, HashSet<ProjectThing> hs)
public void exportXML(StringBuilder sb_body, String indent, XMLOptions options)
HashMap<Thing,Boolean>
as any
.public boolean fixZOrdering()
public boolean isExpanded()
isExpanded
in interface Thing
public String getNodeInfo()
public String getInfo()
public ProjectThing subclone(Project pr)
public boolean move(int inc)
public HashMap<String,ArrayList<ProjectThing>> getByType()
Copyright © 2015–2021 Fiji. All rights reserved.