continue;
}
final String label = urlLink.getLabel();
- if (seq != null && urlLink.isDynamic())
+
+ // collect id string too
+ String id = seq.getName();
+ String descr = seq.getDescription();
+ if (descr != null && descr.length() < 1)
{
+ descr = null;
+ }
+ if (seq != null && urlLink.usesSeqId()) // link is ID
+ {
// collect matching db-refs
DBRefEntry[] dbr = DBRefUtils.selectRefs(seq.getDBRefs(),
new String[] { urlLink.getTarget() });
- // collect id string too
- String id = seq.getName();
- String descr = seq.getDescription();
- if (descr != null && descr.length() < 1)
- {
- descr = null;
- }
+ // if there are any dbrefs which match up with the link
if (dbr != null)
{
for (int r = 0; r < dbr.length; r++)
id = null;
}
// create Bare ID link for this URL
- String[] urls = urlLink.makeUrls(dbr[r].getAccessionId(), true);
- if (urls != null)
- {
- for (int u = 0; u < urls.length; u += 2)
- {
- if (!linkset.contains(urls[u] + "|" + urls[u + 1]))
- {
- linkset.add(urls[u] + "|" + urls[u + 1]);
- addshowLink(linkMenu, label + "|" + urls[u], urls[u + 1]);
- }
- }
- }
+ createBareURLLink(urlLink, dbr[r].getAccessionId(), linkset,
+ linkMenu, label, true);
}
}
+
+ // Create urls from description but only for URL links which are regex
+ // links
+ if (descr != null && urlLink.getRegexReplace() != null)
+ {
+ // create link for this URL from description where regex matches
+ createBareURLLink(urlLink, descr, linkset, linkMenu, label, false);
+ }
+
+ }
+ else if (seq != null && !urlLink.usesSeqId()) // link is name
+ {
if (id != null)
{
// create Bare ID link for this URL
- String[] urls = urlLink.makeUrls(id, true);
- if (urls != null)
- {
- for (int u = 0; u < urls.length; u += 2)
- {
- if (!linkset.contains(urls[u] + "|" + urls[u + 1]))
- {
- linkset.add(urls[u] + "|" + urls[u + 1]);
- addshowLink(linkMenu, label, urls[u + 1]);
- }
- }
- }
+ createBareURLLink(urlLink, id, linkset, linkMenu, label, false);
}
// Create urls from description but only for URL links which are regex
// links
if (descr != null && urlLink.getRegexReplace() != null)
{
// create link for this URL from description where regex matches
- String[] urls = urlLink.makeUrls(descr, true);
- if (urls != null)
- {
- for (int u = 0; u < urls.length; u += 2)
- {
- if (!linkset.contains(urls[u] + "|" + urls[u + 1]))
- {
- linkset.add(urls[u] + "|" + urls[u + 1]);
- addshowLink(linkMenu, label, urls[u + 1]);
- }
- }
- }
+ createBareURLLink(urlLink, descr, linkset, linkMenu, label, false);
}
}
else
addshowLink(linkMenu, label, urlLink.getUrl_prefix());
}
}
+
}
if (sequence != null)
{
}
}
+ /*
+ * Create a bare URL Link
+ */
+ private void createBareURLLink(UrlLink urlLink, String id,
+ List<String> linkset, JMenu linkMenu, String label,
+ Boolean addSepToLabel)
+ {
+ String[] urls = urlLink.makeUrls(id, true);
+ if (urls != null)
+ {
+ for (int u = 0; u < urls.length; u += 2)
+ {
+ if (!linkset.contains(urls[u] + "|" + urls[u + 1]))
+ {
+ linkset.add(urls[u] + "|" + urls[u + 1]);
+ if (addSepToLabel)
+ {
+ addshowLink(linkMenu, label + "|" + urls[u], urls[u + 1]);
+ }
+ else
+ {
+ addshowLink(linkMenu, label, urls[u + 1]);
+ }
+ }
+ }
+ }
+ }
+
/**
* Add annotation types to 'Show annotations' and/or 'Hide annotations' menus.
* "All" is added first, followed by a separator. Then add any annotation
public void createSequenceDetailsReport(SequenceI[] sequences)
{
CutAndPasteHtmlTransfer cap = new CutAndPasteHtmlTransfer();
- StringBuffer contents = new StringBuffer();
+ StringBuilder contents = new StringBuilder(128);
for (SequenceI seq : sequences)
{
contents.append("<p><h2>"
seq,
true,
true,
- false,
(ap.getSeqPanel().seqCanvas.fr != null) ? ap
.getSeqPanel().seqCanvas.fr.getMinMax()
: null);