src/core/net/sf/basedb/util/extensions/ExtensionBean.java

Code
Comments
Other
Rev Date Author Line
4158 22 Feb 08 nicklas 1 /**
4320 29 May 08 nicklas 2   $Id:ExtensionBean.java 4187 2008-03-20 11:15:25Z nicklas $
4158 22 Feb 08 nicklas 3
4158 22 Feb 08 nicklas 4   Copyright (C) Authors contributing to this file.
4158 22 Feb 08 nicklas 5
4158 22 Feb 08 nicklas 6   This file is part of BASE - BioArray Software Environment.
4158 22 Feb 08 nicklas 7   Available at http://base.thep.lu.se/
4158 22 Feb 08 nicklas 8
4158 22 Feb 08 nicklas 9   BASE is free software; you can redistribute it and/or
4158 22 Feb 08 nicklas 10   modify it under the terms of the GNU General Public License
4479 05 Sep 08 jari 11   as published by the Free Software Foundation; either version 3
4158 22 Feb 08 nicklas 12   of the License, or (at your option) any later version.
4158 22 Feb 08 nicklas 13
4158 22 Feb 08 nicklas 14   BASE is distributed in the hope that it will be useful,
4158 22 Feb 08 nicklas 15   but WITHOUT ANY WARRANTY; without even the implied warranty of
4158 22 Feb 08 nicklas 16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4158 22 Feb 08 nicklas 17   GNU General Public License for more details.
4158 22 Feb 08 nicklas 18
4158 22 Feb 08 nicklas 19   You should have received a copy of the GNU General Public License
4515 11 Sep 08 jari 20   along with BASE. If not, see <http://www.gnu.org/licenses/>.
4158 22 Feb 08 nicklas 21 */
4158 22 Feb 08 nicklas 22 package net.sf.basedb.util.extensions;
4158 22 Feb 08 nicklas 23
4163 28 Feb 08 nicklas 24 import net.sf.basedb.core.plugin.About;
4163 28 Feb 08 nicklas 25
4158 22 Feb 08 nicklas 26 /**
4163 28 Feb 08 nicklas 27   A bean-like implementation of the {@link Extension} interface.
4163 28 Feb 08 nicklas 28   This implementation adds setter methods for simple initialisation
4163 28 Feb 08 nicklas 29   of the bean properties.
4158 22 Feb 08 nicklas 30
4158 22 Feb 08 nicklas 31   @author nicklas
4158 22 Feb 08 nicklas 32   @version 2.7
4320 29 May 08 nicklas 33   @base.modified $Date:2008-03-20 12:15:25 +0100 (Thu, 20 Mar 2008) $
4163 28 Feb 08 nicklas 34 */
4163 28 Feb 08 nicklas 35 public class ExtensionBean<A extends Action>
4158 22 Feb 08 nicklas 36   implements Extension<A>
4158 22 Feb 08 nicklas 37 {
4158 22 Feb 08 nicklas 38
4163 28 Feb 08 nicklas 39   private String id;
4163 28 Feb 08 nicklas 40   private String extensionPoint;
4170 07 Mar 08 nicklas 41   private ActionFactory<? extends A> actionFactory;
4170 07 Mar 08 nicklas 42   private RendererFactory<? super A> rendererFactory;
4163 28 Feb 08 nicklas 43   private About about;
4163 28 Feb 08 nicklas 44   private float index;
4158 22 Feb 08 nicklas 45   
4163 28 Feb 08 nicklas 46   /**
4163 28 Feb 08 nicklas 47     Create a new empty extension bean. Use the setter
4163 28 Feb 08 nicklas 48     methods to set the properties before registering 
7703 11 Apr 19 nicklas 49     the extension with {@link Registry#registerExtension(Extension, ClassLoader)}.
4163 28 Feb 08 nicklas 50   */
4163 28 Feb 08 nicklas 51   public ExtensionBean()
4163 28 Feb 08 nicklas 52   {}
4163 28 Feb 08 nicklas 53   
4163 28 Feb 08 nicklas 54   /**
4163 28 Feb 08 nicklas 55     Create a new fully initialised extension bean. See the 
4163 28 Feb 08 nicklas 56     {@link Extension} interface for a description of the parameters.
4163 28 Feb 08 nicklas 57   */
4163 28 Feb 08 nicklas 58   public ExtensionBean(
4163 28 Feb 08 nicklas 59     String id, 
4163 28 Feb 08 nicklas 60     String extensionPoint, 
4163 28 Feb 08 nicklas 61     float position,
4163 28 Feb 08 nicklas 62     About about,
4170 07 Mar 08 nicklas 63     ActionFactory<? extends A> actionFactory, 
4170 07 Mar 08 nicklas 64     RendererFactory<? super A> rendererFactory)
4158 22 Feb 08 nicklas 65   {
4158 22 Feb 08 nicklas 66     this.id = id;
4163 28 Feb 08 nicklas 67     this.extensionPoint = extensionPoint;
4163 28 Feb 08 nicklas 68     this.index = position;
4158 22 Feb 08 nicklas 69     this.actionFactory = actionFactory;
4163 28 Feb 08 nicklas 70     this.about = about;
4158 22 Feb 08 nicklas 71     this.rendererFactory = rendererFactory;
4158 22 Feb 08 nicklas 72   }
4320 29 May 08 nicklas 73   
4320 29 May 08 nicklas 74   @Override
4320 29 May 08 nicklas 75   public String toString()
4320 29 May 08 nicklas 76   {
4320 29 May 08 nicklas 77     return "ExtensionBean[id="+ id +"]";
4320 29 May 08 nicklas 78   }
4163 28 Feb 08 nicklas 79
4163 28 Feb 08 nicklas 80   @Override
4163 28 Feb 08 nicklas 81   public String getId()
4163 28 Feb 08 nicklas 82   {
4163 28 Feb 08 nicklas 83     return id;
4163 28 Feb 08 nicklas 84   }
4163 28 Feb 08 nicklas 85   public void setId(String id)
4163 28 Feb 08 nicklas 86   {
4163 28 Feb 08 nicklas 87     this.id = id;
4163 28 Feb 08 nicklas 88   }
4158 22 Feb 08 nicklas 89   
4163 28 Feb 08 nicklas 90   @Override
4163 28 Feb 08 nicklas 91   public String getExtends()
4163 28 Feb 08 nicklas 92   {
4163 28 Feb 08 nicklas 93     return extensionPoint;
4163 28 Feb 08 nicklas 94   }
4163 28 Feb 08 nicklas 95   public void setExtends(String extensionPoint)
4163 28 Feb 08 nicklas 96   {
4163 28 Feb 08 nicklas 97     this.extensionPoint = extensionPoint;
4163 28 Feb 08 nicklas 98   }
4163 28 Feb 08 nicklas 99   
4163 28 Feb 08 nicklas 100   @Override
4163 28 Feb 08 nicklas 101   public float getIndex()
4163 28 Feb 08 nicklas 102   {
4163 28 Feb 08 nicklas 103     return index;
4163 28 Feb 08 nicklas 104   }
4163 28 Feb 08 nicklas 105   public void setIndex(float index)
4163 28 Feb 08 nicklas 106   {
4163 28 Feb 08 nicklas 107     this.index = index;
4163 28 Feb 08 nicklas 108   }
4163 28 Feb 08 nicklas 109   
4163 28 Feb 08 nicklas 110   @Override
4170 07 Mar 08 nicklas 111   public ActionFactory<? extends A> getActionFactory()
4158 22 Feb 08 nicklas 112   {
4158 22 Feb 08 nicklas 113     return actionFactory;
4158 22 Feb 08 nicklas 114   }
4170 07 Mar 08 nicklas 115   public void setActionFactory(ActionFactory<? extends A> actionFactory)
4163 28 Feb 08 nicklas 116   {
4163 28 Feb 08 nicklas 117     this.actionFactory = actionFactory;
4163 28 Feb 08 nicklas 118   }
4158 22 Feb 08 nicklas 119   
4163 28 Feb 08 nicklas 120   @Override
4170 07 Mar 08 nicklas 121   public RendererFactory<? super A> getRendererFactory()
4158 22 Feb 08 nicklas 122   {
4158 22 Feb 08 nicklas 123     return rendererFactory;
4158 22 Feb 08 nicklas 124   }
4170 07 Mar 08 nicklas 125   public void setRendererFactory(RendererFactory<? super A> rendererFactory)
4158 22 Feb 08 nicklas 126   {
4163 28 Feb 08 nicklas 127     this.rendererFactory = rendererFactory;
4158 22 Feb 08 nicklas 128   }
4158 22 Feb 08 nicklas 129
4163 28 Feb 08 nicklas 130   @Override
4163 28 Feb 08 nicklas 131   public About getAbout()
4158 22 Feb 08 nicklas 132   {
4163 28 Feb 08 nicklas 133     return about;
4158 22 Feb 08 nicklas 134   }
4163 28 Feb 08 nicklas 135   public void setAbout(About about)
4158 22 Feb 08 nicklas 136   {
4163 28 Feb 08 nicklas 137     this.about = about;
4158 22 Feb 08 nicklas 138   }
4158 22 Feb 08 nicklas 139
4158 22 Feb 08 nicklas 140 }