X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fjalview%2Furls%2FUrlLinkDisplay.java;h=0eabff7292076a4f45a6c50e51c909837d6c1942;hb=5e8ec77d921ff2d604811e5e4ba7e9211b0f48de;hp=2582f90531942e1ff8ee2a0c9dfc01d6f7f59424;hpb=96b8ecca446eca75f8fddea49387436a25b536eb;p=jalview.git diff --git a/src/jalview/urls/UrlLinkDisplay.java b/src/jalview/urls/UrlLinkDisplay.java index 2582f90..0eabff7 100644 --- a/src/jalview/urls/UrlLinkDisplay.java +++ b/src/jalview/urls/UrlLinkDisplay.java @@ -39,7 +39,7 @@ public class UrlLinkDisplay private String id; // id is not supplied to display, but used to identify // entries when saved - private boolean isDefault; + private boolean isPrimary; private boolean isSelected; @@ -49,30 +49,33 @@ public class UrlLinkDisplay private final static List colNames = new ArrayList() { { + add(MessageManager.formatMessage("label.database")); add(MessageManager.formatMessage("label.name")); add(MessageManager.formatMessage("label.url")); add(MessageManager.formatMessage("label.inmenu")); - add(MessageManager.formatMessage("label.default")); + add(MessageManager.formatMessage("label.primary")); add(MessageManager.formatMessage("label.id")); } }; // column positions - public final static int NAME = 0; + public final static int DATABASE = 0; - public final static int URL = 1; + public final static int NAME = 1; - public final static int SELECTED = 2; + public final static int URL = 2; - public final static int DEFAULT = 3; + public final static int SELECTED = 3; - public final static int ID = 4; + public final static int PRIMARY = 4; + + public final static int ID = 5; public UrlLinkDisplay(String rowId, UrlLink rowLink, boolean rowSelected, boolean rowDefault) { id = rowId; - isDefault = rowDefault; + isPrimary = rowDefault; isSelected = rowSelected; link = rowLink; @@ -84,19 +87,24 @@ public class UrlLinkDisplay return id; } - public String getName() + public String getDescription() { return link.getLabel(); } + public String getDBName() + { + return link.getTarget(); + } + public String getUrl() { return link.getUrlWithToken(); } - public boolean getIsDefault() + public boolean getIsPrimary() { - return isDefault; + return isPrimary; } public boolean getIsSelected() @@ -104,19 +112,24 @@ public class UrlLinkDisplay return isSelected; } - public void setName(String name) + public void setDBName(String name) { - link.setLabel(name); + link.setTarget(name); } public void setUrl(String rowUrl) { - link = new UrlLink(getName(), rowUrl); + link = new UrlLink(getDescription(), rowUrl, getDBName()); + } + + public void setDescription(String desc) + { + link.setLabel(desc); } public void setIsDefault(boolean rowDefault) { - isDefault = rowDefault; + isPrimary = rowDefault; } public void setIsSelected(boolean rowSelected) @@ -132,12 +145,14 @@ public class UrlLinkDisplay return id; case URL: return getUrl(); - case DEFAULT: - return isDefault; + case PRIMARY: + return isPrimary; case SELECTED: return isSelected; case NAME: - return getName(); + return getDescription(); + case DATABASE: + return getDBName(); default: return null; } @@ -153,14 +168,16 @@ public class UrlLinkDisplay case URL: setUrl((String) value); break; - case DEFAULT: - isDefault = (boolean) value; + case PRIMARY: + isPrimary = (boolean) value; break; case SELECTED: isSelected = (boolean) value; break; case NAME: - setName((String) value); + setDescription((String) value); + case DATABASE: + setDBName((String) value); break; default: // do nothing @@ -176,9 +193,9 @@ public class UrlLinkDisplay */ public boolean isEditable(int index) { - if (index == DEFAULT) + if (index == PRIMARY) { - // default link must not be a $DB_ACCESSION$ link + // primary link must not be a $DB_ACCESSION$ link // so only allow editing if it is not return (!link.usesDBAccession()); } @@ -199,7 +216,7 @@ public class UrlLinkDisplay */ public static List getDisplayColumnNames() { - // Display names between NAME and ID (excludes ID) - return colNames.subList(NAME, ID); + // Display names between DESCRIPTION and ID (excludes ID) + return colNames.subList(DATABASE, ID); } }