X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Furls%2Fapi%2FUrlProviderI.java;fp=src%2Fjalview%2Furls%2Fapi%2FUrlProviderI.java;h=728d9beb3e054b060c4a673d79d1411851f46f3a;hb=c437fc72420baf7b045d417fb6cabcebe87987c5;hp=0000000000000000000000000000000000000000;hpb=ede54837349adde8f7265c6d8fa58d14165ee215;p=jalview.git diff --git a/src/jalview/urls/api/UrlProviderI.java b/src/jalview/urls/api/UrlProviderI.java new file mode 100644 index 0000000..728d9be --- /dev/null +++ b/src/jalview/urls/api/UrlProviderI.java @@ -0,0 +1,117 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ +package jalview.urls.api; + +import jalview.urls.UrlLinkDisplay; + +import java.util.List; + +/** + * Methods for providing consistent access to up-to-date URLs + * + * @author $author$ + * @version $Revision$ + */ +public interface UrlProviderI +{ + + /** + * Get names and urls in the UrlProvider as strings for display + * + */ + List getLinksForMenu(); + + /** + * Get names and urls as strings for display + * + */ + List getLinksForTable(); + + /** + * Set names and urls from display settings + */ + void setUrlData(List links); + + /** + * Get the link for the primary URL + * + * @seqid sequence id for which to build link + * @return link for the primary URL + */ + String getPrimaryUrl(String seqid); + + /** + * Get the primary URL id + * + * @return id for primary URL + */ + String getPrimaryUrlId(); + + /** + * Get the target of the link for the primary URL + * + * @seqid sequence id for which to build link + * @return target of link for the primary URL + */ + String getPrimaryTarget(String seqid); + + /** + * Set the primary URL: if only one URL can be used, this URL is the one which + * should be chosen, e.g. provides the URL to be used on double-click of a + * sequence id + * + * @param id + * the id of the URL to set as primary + * @return true if setting is successful + * @throws IllegalArgumentException + * if id does not exist as a url in the UrlProvider + */ + boolean setPrimaryUrl(String id) throws IllegalArgumentException; + + /** + * Test if UrlProvider contains a url + * + * @param id + * to test for + * @return true of UrlProvider contains this id, false otherwise + */ + boolean contains(String id); + + /** + * Write out all URLs as a string suitable for serialising + * + * @return string representation of available URLs + */ + String writeUrlsAsString(boolean selected); + + /** + * Choose the primary URL in the event of the selected primary being + * unavailable + * + * @return id of chosen primary url + */ + String choosePrimaryUrl(); + + /** + * Determine if id is for a user-defined URL + */ + boolean isUserEntry(String id); +}