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

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