001 package nl.cwi.sen1.visbase.factbrowser.data; 002 003 004 /** 005 * This class represents the Visualisation Plugin. In this class the identifier 006 * and name of the plugin are registered. 007 * 008 * @author Renze de Vries 009 * @date 14-02-2007 010 * 011 */ 012 public class VisualisationPlugin implements Comparable<VisualisationPlugin> { 013 private String pluginName; 014 015 private int pluginId; 016 017 /** 018 * This is the default constructor only present for failsafe purposes. The 019 * following constructor should be used: VisualisationPluginNode(String 020 * pluginName, int pluginId) 021 * 022 * @author Renze de Vries 023 * @date 14-02-2007 024 */ 025 public VisualisationPlugin() { 026 pluginName = ""; 027 pluginId = 0; 028 } 029 030 /** 031 * The constructor which makes it possible to create the representitive of 032 * the plugin visualisation. 033 * 034 * @param pluginName 035 * The name of the plugin 036 * @param pluginId 037 * The identifier of the plugin 038 * 039 * @author Renze de Vries 040 * @date 14-02-2007 041 */ 042 public VisualisationPlugin(String pluginName, int pluginId) { 043 this.pluginName = pluginName; 044 this.pluginId = pluginId; 045 } 046 047 /** 048 * This method makes it possible to return the identifier of the plugin 049 * 050 * @return The identifier 051 * 052 * @author Renze de Vries 053 * @date 14-02-2007 054 */ 055 public int getPluginId() { 056 return this.pluginId; 057 } 058 059 /** 060 * This method return the name of the visualisation plugin so it can be 061 * displayed in the Tree. 062 * 063 * @author Renze de Vries 064 * @date 14-02-2007 065 */ 066 public String toString() { 067 return pluginName; 068 } 069 070 /** 071 * This method makes it possible to sort the collection 072 * of VisualisationPlugins. This is nessecary to have the same 073 * order in the visible Tree every time. This is regardless in 074 * which order the ToolBus send this. 075 * 076 * @autor Renze de Vries 077 * @date 15-02-2007 078 */ 079 public int compareTo(VisualisationPlugin arg0) { 080 String localVisName = this.pluginName; 081 String remoteVisName = arg0.pluginName; 082 083 return localVisName.compareTo(remoteVisName); 084 } 085 086 087 }