src/core/net/sf/basedb/util/overview/node/AnnotationNameGenerator.java

Code
Comments
Other
Rev Date Author Line
4740 05 Feb 09 nicklas 1 /**
4740 05 Feb 09 nicklas 2   $Id$
4740 05 Feb 09 nicklas 3
4740 05 Feb 09 nicklas 4   Copyright (C) 2009 Nicklas Nordborg
4740 05 Feb 09 nicklas 5
4740 05 Feb 09 nicklas 6   This file is part of BASE - BioArray Software Environment.
4740 05 Feb 09 nicklas 7   Available at http://base.thep.lu.se/
4740 05 Feb 09 nicklas 8
4740 05 Feb 09 nicklas 9   BASE is free software; you can redistribute it and/or
4740 05 Feb 09 nicklas 10   modify it under the terms of the GNU General Public License
4740 05 Feb 09 nicklas 11   as published by the Free Software Foundation; either version 3
4740 05 Feb 09 nicklas 12   of the License, or (at your option) any later version.
4740 05 Feb 09 nicklas 13
4740 05 Feb 09 nicklas 14   BASE is distributed in the hope that it will be useful,
4740 05 Feb 09 nicklas 15   but WITHOUT ANY WARRANTY; without even the implied warranty of
4740 05 Feb 09 nicklas 16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4740 05 Feb 09 nicklas 17   GNU General Public License for more details.
4740 05 Feb 09 nicklas 18
4740 05 Feb 09 nicklas 19   You should have received a copy of the GNU General Public License
4740 05 Feb 09 nicklas 20   along with BASE. If not, see <http://www.gnu.org/licenses/>.
4740 05 Feb 09 nicklas 21 */
4740 05 Feb 09 nicklas 22 package net.sf.basedb.util.overview.node;
4740 05 Feb 09 nicklas 23
4740 05 Feb 09 nicklas 24 import net.sf.basedb.core.Annotation;
4740 05 Feb 09 nicklas 25 import net.sf.basedb.util.overview.Node;
4740 05 Feb 09 nicklas 26
4740 05 Feb 09 nicklas 27 /**
4740 05 Feb 09 nicklas 28   Since an Annotation isn't Nameable we construct the name
4740 05 Feb 09 nicklas 29   from the name of the annotation type, or from the value
4740 05 Feb 09 nicklas 30   type if we are not allowed to access the annotation type.
4740 05 Feb 09 nicklas 31
4740 05 Feb 09 nicklas 32   @author Nicklas
4740 05 Feb 09 nicklas 33   @version 2.10
4740 05 Feb 09 nicklas 34   @base.modified $Date$
4740 05 Feb 09 nicklas 35 */
4740 05 Feb 09 nicklas 36 public class AnnotationNameGenerator
4740 05 Feb 09 nicklas 37   implements NodeNameGenerator<Annotation>
4740 05 Feb 09 nicklas 38 {
4740 05 Feb 09 nicklas 39   public AnnotationNameGenerator()
4740 05 Feb 09 nicklas 40   {}
4740 05 Feb 09 nicklas 41
4740 05 Feb 09 nicklas 42   /*
4740 05 Feb 09 nicklas 43     From the NodeNameGenerator interface
4740 05 Feb 09 nicklas 44     ------------------------------------
4740 05 Feb 09 nicklas 45   */
4740 05 Feb 09 nicklas 46   @Override
4740 05 Feb 09 nicklas 47   public String getNodeName(Annotation item, Node parentNode)
4740 05 Feb 09 nicklas 48   {
4740 05 Feb 09 nicklas 49     return "annotation." + item.getId();
4740 05 Feb 09 nicklas 50   }
4740 05 Feb 09 nicklas 51
4740 05 Feb 09 nicklas 52   @Override
4740 05 Feb 09 nicklas 53   public String getNodeTitle(Annotation item, Node parentNode)
4740 05 Feb 09 nicklas 54   {
6037 29 Mar 12 nicklas 55     return item.getAnnotationType().getName();
4740 05 Feb 09 nicklas 56   }
6037 29 Mar 12 nicklas 57   
4740 05 Feb 09 nicklas 58   @Override
4740 05 Feb 09 nicklas 59   public String getDeniedNodeName(Node parentNode)
4740 05 Feb 09 nicklas 60   {
4740 05 Feb 09 nicklas 61     return "annotation";
4740 05 Feb 09 nicklas 62   }
4740 05 Feb 09 nicklas 63
4740 05 Feb 09 nicklas 64   @Override
4740 05 Feb 09 nicklas 65   public String getDeniedNodeTitle(Node parentNode)
4740 05 Feb 09 nicklas 66   {
4740 05 Feb 09 nicklas 67     return "Annotation: denied";
4740 05 Feb 09 nicklas 68   }
4740 05 Feb 09 nicklas 69
4740 05 Feb 09 nicklas 70   @Override
4740 05 Feb 09 nicklas 71   public String getMissingNodeName(Node parentNode)
4740 05 Feb 09 nicklas 72   {
4740 05 Feb 09 nicklas 73     return "annotation";
4740 05 Feb 09 nicklas 74   }
4740 05 Feb 09 nicklas 75
4740 05 Feb 09 nicklas 76   @Override
4740 05 Feb 09 nicklas 77   public String getMissingNodeTitle(Node parentNode)
4740 05 Feb 09 nicklas 78   {
4740 05 Feb 09 nicklas 79     return "Annotation: missing";
4740 05 Feb 09 nicklas 80   }
4740 05 Feb 09 nicklas 81   // --------------------------------------
4740 05 Feb 09 nicklas 82 }