JAL-2316 Refactoring of functionality to provide urls to gui
[jalview.git] / src / jalview / util / UrlProviderI.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $$Year-Rel$$ The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3
10  * of the License, or (at your option) any later version.
11  *  
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  */
21 package jalview.util;
22
23 import java.util.Vector;
24
25 /**
26  * Methods for providing consistent access to up-to-date URLs
27  * 
28  * @author $author$
29  * @version $Revision$
30  */
31 public interface UrlProviderI
32 {
33
34   /*
35    * Default sequence URL link label for EMBL-EBI search
36    */
37   public static final String DEFAULT_LABEL = "EMBL-EBI Search";
38
39   /*
40    * Default sequence URL link string for EMBL-EBI search
41    */
42   public static final String DEFAULT_STRING = DEFAULT_LABEL
43           + "|http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$";
44
45   /**
46    * Get names and urls in as strings for display
47    * 
48    */
49   Vector<String> getLinksForDisplay();
50
51   /**
52    * Get the id of the default URL
53    * 
54    * @return id of the default URL
55    */
56   String getDefaultUrl();
57
58   /**
59    * Get the link for the default URL
60    * 
61    * @seqid sequence id for which to build link
62    * @return link for the default URL
63    */
64   String getDefaultUrl(String seqid);
65
66   /**
67    * Get the target of thelink for the default URL
68    * 
69    * @seqid sequence id for which to build link
70    * @return target of link for the default URL
71    */
72   String getDefaultTarget(String seqid);
73
74   /**
75    * Set the default URL
76    * 
77    * @param id
78    *          the id of the URL to set as default
79    * @return true if setting was successful, false otherwise
80    */
81   boolean setDefaultUrl(String id);
82
83   /**
84    * Write out all URLs as a string suitable for serialising
85    * 
86    * @return string representation of available URLs
87    */
88   String writeUrlsAsString();
89
90   /**
91    * Set URL links from pair of collections
92    * 
93    * @param names
94    * @param urls
95    */
96   void setUrlLinks(Vector<String> names, Vector<String> urls)
97           throws IllegalArgumentException;
98
99   /**
100    * Choose the default URL in the event of the selected default being
101    * unavailable
102    * 
103    * @return id of chosen default url
104    */
105   String chooseDefaultUrl();
106 }