JAL-2316 Added jalview.urls.* packages
[jalview.git] / src / jalview / urls / api / 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.urls.api;
22
23 import jalview.urls.UrlLinkDisplay;
24
25 import java.util.List;
26 import java.util.Vector;
27
28 /**
29  * Methods for providing consistent access to up-to-date URLs
30  * 
31  * @author $author$
32  * @version $Revision$
33  */
34 public interface UrlProviderI
35 {
36
37   /**
38    * Get names and urls in the UrlProvider as strings for display
39    * 
40    */
41   Vector<String> getLinksForMenu();
42
43   /**
44    * Get names and urls as strings for display
45    * 
46    */
47   List<UrlLinkDisplay> getLinksForTable();
48
49   /**
50    * Set names and urls from display settings
51    */
52   void setUrlData(List<UrlLinkDisplay> links);
53
54   /**
55    * Get the link for the default URL
56    * 
57    * @seqid sequence id for which to build link
58    * @return link for the default URL
59    */
60   String getDefaultUrl(String seqid);
61
62   /**
63    * Get the default URL id
64    * 
65    * @return id for default URL
66    */
67   String getDefaultUrlId();
68
69   /**
70    * Get the target of the link for the default URL
71    * 
72    * @seqid sequence id for which to build link
73    * @return target of link for the default URL
74    */
75   String getDefaultTarget(String seqid);
76
77   /**
78    * Set the default URL
79    * 
80    * @param id
81    *          the id of the URL to set as default
82    * @return true if setting is successful
83    * @throws IllegalArgumentException
84    *           if id does not exist as a url in the UrlProvider
85    */
86   boolean setDefaultUrl(String id) throws IllegalArgumentException;
87
88   /**
89    * Test if UrlProvider contains a url
90    * 
91    * @param id
92    *          to test for
93    * @return true of UrlProvider contains this id, false otherwise
94    */
95   boolean contains(String id);
96
97   /**
98    * Write out all URLs as a string suitable for serialising
99    * 
100    * @return string representation of available URLs
101    */
102   String writeUrlsAsString(boolean selected);
103
104   /**
105    * Choose the default URL in the event of the selected default being
106    * unavailable
107    * 
108    * @return id of chosen default url
109    */
110   String chooseDefaultUrl();
111
112   /**
113    * Determine if id is for a user-defined URL
114    */
115   boolean isUserEntry(String id);
116 }