3 TrakEM2 plugin for ImageJ(C).
4 Copyright (C) 2005,2006 Albert Cardona and Rodney Douglas.
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation (http://www.gnu.org/licenses/gpl.txt )
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 You may contact Albert Cardona at acardona at ini.phys.ethz.ch
20 Institute of Neuroinformatics, University of Zurich / ETH, Switzerland.
23 package ini
.trakem2
.tree
;
25 import ini
.trakem2
.persistence
.DBObject
;
26 import ini
.trakem2
.Project
;
29 public final class TemplateAttribute
extends DBObject
implements Attribute
{
32 private Object object
;
34 /** Construct a new attribute with the given title and the given object, which for example can be of class Thing. */
35 public TemplateAttribute(String title
, Object object
) {
41 /** Reconstruct a new attribute from the database. */
42 public TemplateAttribute(String title
, Object object
, Project project
, long id
) {
48 /** WARNING: the object is not cloned. */
49 public TemplateAttribute
clone(final Project pr
, final boolean copy_id
) {
50 final long nid
= copy_id ?
this.id
: pr
.getLoader().getNextId();
51 final TemplateAttribute copy
= new TemplateAttribute(this.title
, this.object
, pr
, nid
);
55 public void addToDatabase(Project project
) {
56 this.project
= project
;
57 this.id
= project
.getLoader().getNextId();
58 super.addToDatabase();
61 public String
getTitle() {
65 public void setObject(Object object
) {
69 public Thing
getOwner() {
70 return null; // stupid java
73 public Object
getObject() {
77 public long getObjectId() {
82 public String
toString() {
84 return title
+ ": [empty]";
86 return title
+ ": " + object
.toString();
89 public String
getObjectString() { // dummy