git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-4235 JAL-3599 Try and report Eclipse Product Version for jalviewjsTranspile....
[jalview.git]
/
src
/
jalview
/
urls
/
UrlLinkDisplay.java
diff --git
a/src/jalview/urls/UrlLinkDisplay.java
b/src/jalview/urls/UrlLinkDisplay.java
index
f8584e4
..
39d6b35
100644
(file)
--- a/
src/jalview/urls/UrlLinkDisplay.java
+++ b/
src/jalview/urls/UrlLinkDisplay.java
@@
-36,43
+36,47
@@
import java.util.List;
public class UrlLinkDisplay
{
public class UrlLinkDisplay
{
- private String id; // id is not supplied to display, but used to identify
- // entries when saved
+ // column positions
+ public static final int DATABASE = 0;
- private boolean isDefault;
+ public static final int NAME = 1;
- private boolean isSelected;
+ public static final int URL = 2;
- private UrlLink link;
+ public static final int SELECTED = 3;
+
+ public static final int PRIMARY = 4;
+
+ public static final int ID = 5;
// Headers for columns in table
// Headers for columns in table
- private final static List<String> colNames = new ArrayList<String>()
+ @SuppressWarnings("serial")
+ private static final List<String> COLNAMES = new ArrayList<String>()
{
{
{
{
+ add(MessageManager.formatMessage("label.database"));
add(MessageManager.formatMessage("label.name"));
add(MessageManager.formatMessage("label.url"));
add(MessageManager.formatMessage("label.inmenu"));
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"));
}
};
add(MessageManager.formatMessage("label.id"));
}
};
- // column positions
- public final static int NAME = 0;
-
- public final static int URL = 1;
+ private String id; // id is not supplied to display, but used to identify
+ // entries when saved
- public final static int SELECTED = 2;
+ private boolean isPrimary;
- public final static int DEFAULT = 3;
+ private boolean isSelected;
- public final static int ID = 4;
+ private UrlLink link;
- public UrlLinkDisplay(String rowId, UrlLink rowLink,
- boolean rowSelected, boolean rowDefault)
+ public UrlLinkDisplay(String rowId, UrlLink rowLink, boolean rowSelected,
+ boolean rowDefault)
{
id = rowId;
{
id = rowId;
- isDefault = rowDefault;
+ isPrimary = rowDefault;
isSelected = rowSelected;
link = rowLink;
isSelected = rowSelected;
link = rowLink;
@@
-84,19
+88,24
@@
public class UrlLinkDisplay
return id;
}
return id;
}
- public String getName()
+ public String getDescription()
{
return link.getLabel();
}
{
return link.getLabel();
}
+ public String getDBName()
+ {
+ return link.getTarget();
+ }
+
public String getUrl()
{
return link.getUrlWithToken();
}
public String getUrl()
{
return link.getUrlWithToken();
}
- public boolean getIsDefault()
+ public boolean getIsPrimary()
{
{
- return isDefault;
+ return isPrimary;
}
public boolean getIsSelected()
}
public boolean getIsSelected()
@@
-104,19
+113,24
@@
public class UrlLinkDisplay
return isSelected;
}
return isSelected;
}
- public void setName(String name)
+ public void setDBName(String name)
{
{
- link.setLabel(name);
+ link.setTarget(name);
}
public void setUrl(String rowUrl)
{
}
public void setUrl(String rowUrl)
{
- link = new UrlLink(rowUrl);
+ link = new UrlLink(getDescription(), rowUrl, getDBName());
+ }
+
+ public void setDescription(String desc)
+ {
+ link.setLabel(desc);
}
public void setIsDefault(boolean rowDefault)
{
}
public void setIsDefault(boolean rowDefault)
{
- isDefault = rowDefault;
+ isPrimary = rowDefault;
}
public void setIsSelected(boolean rowSelected)
}
public void setIsSelected(boolean rowSelected)
@@
-132,12
+146,14
@@
public class UrlLinkDisplay
return id;
case URL:
return getUrl();
return id;
case URL:
return getUrl();
- case DEFAULT:
- return isDefault;
+ case PRIMARY:
+ return isPrimary;
case SELECTED:
return isSelected;
case NAME:
case SELECTED:
return isSelected;
case NAME:
- return getName();
+ return getDescription();
+ case DATABASE:
+ return getDBName();
default:
return null;
}
default:
return null;
}
@@
-153,14
+169,17
@@
public class UrlLinkDisplay
case URL:
setUrl((String) value);
break;
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:
break;
case SELECTED:
isSelected = (boolean) value;
break;
case NAME:
- setName((String) value);
+ setDescription((String) value);
+ // deliberate fall through
+ case DATABASE:
+ setDBName((String) value);
break;
default:
// do nothing
break;
default:
// do nothing
@@
-176,19
+195,15
@@
public class UrlLinkDisplay
*/
public boolean isEditable(int index)
{
*/
public boolean isEditable(int index)
{
- if (index == DEFAULT)
+ if (index == PRIMARY)
{
{
- // default link must be a $SEQUENCE_ID$ link
- // so only allow editing if it is
+ // primary link must not be a $DB_ACCESSION$ link
+ // so only allow editing if it is not
return (!link.usesDBAccession());
}
return (!link.usesDBAccession());
}
- else if (index == SELECTED)
- {
- return true;
- }
else
{
else
{
- return false;
+ return index == SELECTED;
}
}
}
}
@@
-199,7
+214,7
@@
public class UrlLinkDisplay
*/
public static List<String> getDisplayColumnNames()
{
*/
public static List<String> 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);
}
}
}
}