ini.trakem2.tree
Class LayerThing

java.lang.Object
  extended by ini.trakem2.persistence.DBObject
      extended by ini.trakem2.tree.LayerThing
All Implemented Interfaces:
Thing, TitledThing

public final class LayerThing
extends DBObject
implements TitledThing


Field Summary
 
Fields inherited from class ini.trakem2.persistence.DBObject
id, project
 
Constructor Summary
LayerThing(TemplateThing template, Project project, long id, java.lang.String title, java.lang.Object ob, java.util.ArrayList<LayerThing> al_children)
          Reconstruct from database, in combination with the setup() method.
LayerThing(TemplateThing template, Project project, java.lang.Object ob)
           
 
Method Summary
 boolean addChild(Thing child)
           
 boolean canHaveAsChild(Thing thing)
           
 void debug(java.lang.String indent)
           
 Thing findChild(java.lang.Object ob)
          Recursive search for the thing that contains the given object.
 java.util.ArrayList<LayerThing> getChildren()
           
 TemplateThing getChildTemplate(java.lang.String type)
           
 java.lang.String getInfo()
          Return information on this node and its object.
 java.lang.Object getObject()
           
 Thing getParent()
           
 javax.swing.JMenuItem[] getPopupItems(java.awt.event.ActionListener listener)
           
 java.lang.String getTitle()
          May be null or empty; call toString() to get a textual representation.
 java.lang.String getType()
           
 boolean hasChildren()
           
 int indexOf(LayerThing child)
           
 boolean isExpanded()
           
 boolean remove(boolean check)
          Remove this instance, cascading the remove action to the children and the objects.
 boolean removeChild(LayerThing child)
           
 void setParent(Thing parent)
           
 void setTitle(java.lang.String title)
           
 void setup()
          Tell the attributes who owns them, and the children's attributes as well, and set the parent to the children; used to finish up reconstruction from the database.
 Thing shallowCopy()
          A new copy with same template, same project, same id, same object and cloned table of same attributes, and same title, but no parent and no children.
 java.lang.String toString()
           
 
Methods inherited from class ini.trakem2.persistence.DBObject
addToDatabase, exportXML, getId, getProject, getShortTitle, getUniqueIdentifier, removeFromDatabase, updateInDatabase, updateInDatabase
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LayerThing

public LayerThing(TemplateThing template,
                  Project project,
                  java.lang.Object ob)
           throws java.lang.Exception
Throws:
java.lang.Exception

LayerThing

public LayerThing(TemplateThing template,
                  Project project,
                  long id,
                  java.lang.String title,
                  java.lang.Object ob,
                  java.util.ArrayList<LayerThing> al_children)
Reconstruct from database, in combination with the setup() method.

Method Detail

shallowCopy

public Thing shallowCopy()
A new copy with same template, same project, same id, same object and cloned table of same attributes, and same title, but no parent and no children.

Specified by:
shallowCopy in interface Thing

setup

public void setup()
Tell the attributes who owns them, and the children's attributes as well, and set the parent to the children; used to finish up reconstruction from the database.


getParent

public Thing getParent()
Specified by:
getParent in interface Thing

getChildTemplate

public TemplateThing getChildTemplate(java.lang.String type)

toString

public java.lang.String toString()
Specified by:
toString in interface Thing
Overrides:
toString in class java.lang.Object

setTitle

public void setTitle(java.lang.String title)
Specified by:
setTitle in interface TitledThing

getTitle

public java.lang.String getTitle()
May be null or empty; call toString() to get a textual representation.

Specified by:
getTitle in interface Thing
Overrides:
getTitle in class DBObject

canHaveAsChild

public boolean canHaveAsChild(Thing thing)
Specified by:
canHaveAsChild in interface Thing

addChild

public boolean addChild(Thing child)
Specified by:
addChild in interface Thing

removeChild

public boolean removeChild(LayerThing child)

getType

public java.lang.String getType()
Specified by:
getType in interface Thing

getChildren

public java.util.ArrayList<LayerThing> getChildren()
Specified by:
getChildren in interface Thing

hasChildren

public boolean hasChildren()
Specified by:
hasChildren in interface Thing

getObject

public java.lang.Object getObject()
Specified by:
getObject in interface Thing

setParent

public void setParent(Thing parent)
Specified by:
setParent in interface Thing

getPopupItems

public javax.swing.JMenuItem[] getPopupItems(java.awt.event.ActionListener listener)

remove

public boolean remove(boolean check)
Remove this instance, cascading the remove action to the children and the objects. Will also cleanup the nodes in the ProjectTree.

Overrides:
remove in class DBObject

findChild

public Thing findChild(java.lang.Object ob)
Recursive search for the thing that contains the given object.

Specified by:
findChild in interface Thing

indexOf

public int indexOf(LayerThing child)

debug

public void debug(java.lang.String indent)
Specified by:
debug in interface Thing

isExpanded

public boolean isExpanded()
Specified by:
isExpanded in interface Thing

getInfo

public java.lang.String getInfo()
Return information on this node and its object.

Specified by:
getInfo in interface Thing
Overrides:
getInfo in class DBObject