X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Furls%2FUrlProviderImpl.java;h=c1a57ca4223ec52cf0bb8dbcdb77b5d474aa2d74;hb=5e8ec77d921ff2d604811e5e4ba7e9211b0f48de;hp=2356f1dc9aea28d941a68149f836717fdf1cb09c;hpb=2db199e42a0ef5cca46c237544aa5c807cdece18;p=jalview.git diff --git a/src/jalview/urls/UrlProviderImpl.java b/src/jalview/urls/UrlProviderImpl.java index 2356f1d..c1a57ca 100644 --- a/src/jalview/urls/UrlProviderImpl.java +++ b/src/jalview/urls/UrlProviderImpl.java @@ -20,6 +20,7 @@ */ package jalview.urls; +import jalview.urls.api.UrlProviderI; import jalview.util.UrlLink; import java.util.ArrayList; @@ -43,36 +44,36 @@ public abstract class UrlProviderImpl implements UrlProviderI private static final Pattern MIRIAM_PATTERN = Pattern .compile("^MIR:\\d{8}$"); - protected String defaultUrl; + protected String primaryUrl; - protected String getDefaultUrl(String seqid, HashMap urls) + protected String getPrimaryUrl(String seqid, HashMap urls) { if (seqid.length() < MIN_SUBST_LENGTH) { return null; } - else if (defaultUrl == null) + else if (primaryUrl == null) { return null; } - else if (!urls.containsKey(defaultUrl)) + else if (!urls.containsKey(primaryUrl)) { return null; } else { String url = null; - UrlLink urlLink = urls.get(defaultUrl); - String[] defaultUrls = urlLink.makeUrls(seqid, true); - if (defaultUrls == null || defaultUrls[0] == null - || defaultUrls[0].length() < MIN_SUBST_LENGTH) + UrlLink urlLink = urls.get(primaryUrl); + String[] primaryUrls = urlLink.makeUrls(seqid, true); + if (primaryUrls == null || primaryUrls[0] == null + || primaryUrls[0].length() < MIN_SUBST_LENGTH) { url = null; } else { // just take first URL made from regex - url = defaultUrls[1]; + url = primaryUrls[1]; } return url; } @@ -92,7 +93,7 @@ public abstract class UrlProviderImpl implements UrlProviderI for (Entry entry : urls.entrySet()) { String key = entry.getKey(); - boolean isDefault = (key.equals(defaultUrl)); + boolean isPrimary = (key.equals(primaryUrl)); boolean isSelected; if (selectedUrls != null) { @@ -102,9 +103,8 @@ public abstract class UrlProviderImpl implements UrlProviderI { isSelected = selected; } - String displayLink = entry.getValue().getUrlWithToken(); - displayLinks.add(new UrlLinkDisplay(key, entry.getValue().getLabel(), - displayLink, isSelected, isDefault)); + displayLinks.add(new UrlLinkDisplay(key, entry.getValue(), + isSelected, isPrimary)); } return displayLinks; }