private boolean running=false;
private Vector groupURLLinks = null;
private Vector groupURLdescr = null;
+ private static String[] allowedDb=new String[] {"UNIPROT","EMBL","PDB"} ;
public EnfinEnvision2OneWay() {
groupURLLinks = new Vector();
final String label = urlLink.getLabel();
boolean usingNames = false;
// Now see which parts of the group apply for this URL
- String ltarget = urlLink.getTarget(); // jalview.util.DBRefUtils.getCanonicalName(urlLink.getTarget());
- Object[] idset = (Object[]) commonDbrefs.get(ltarget.toUpperCase());
+ String ltarget;
String[] seqstr,ids; // input to makeUrl
- if (idset!=null)
- {
- int numinput = ((int[])idset[0])[0];
- String[] allids = ((String[])idset[1]);
- seqstr = new String[numinput];
- ids = new String[numinput];
- for (int sq=0,idcount=0;sq<seqs.length;sq++)
+ for (int t=0;t<allowedDb.length; t++) {
+ ltarget = allowedDb[t]; // jalview.util.DBRefUtils.getCanonicalName(urlLink.getTarget());
+ Object[] idset = (Object[]) commonDbrefs.get(ltarget.toUpperCase());
+ if (idset!=null)
{
- if (allids[sq]!=null) {
- ids[idcount] = allids[sq];
- seqstr[idcount++] = idandseqs[1][sq];
+ int numinput = ((int[])idset[0])[0];
+ String[] allids = ((String[])idset[1]);
+ seqstr = new String[numinput];
+ ids = new String[numinput];
+ for (int sq=0,idcount=0;sq<seqs.length;sq++)
+ {
+ if (allids[sq]!=null) {
+ ids[idcount] = allids[sq];
+ seqstr[idcount++] = idandseqs[1][sq];
+ }
}
+ addMenu = addMenu | createAndAddLinks(linkMenus,false,urlLink,label,ltarget,descr, ids,seqstr);
}
- } else {
- // just use the id/seq set
- seqstr = idandseqs[1];
- ids = idandseqs[0];
- usingNames=true;
- }
- // and try and make the groupURL!
-
- Object[] urlset = urlLink.makeUrlStubs(ids,seqstr, "FromJalview"+System.currentTimeMillis(),false);
- if (urlset!=null)
- {
- int type = urlLink.getGroupURLType() & 3;
- //System.out.println(urlLink.getGroupURLType() +" "+((String[])urlset[3])[0]);
- // first two bits ofurlLink type bitfield are sequenceids and sequences
- // TODO: FUTURE: ensure the groupURL menu structure can be generalised
- addshowLink(linkMenus[type], label + (((type & 1)==1) ? ("("+(usingNames ? "Names" : ltarget)+")") : ""), descr, urlLink, urlset);
- addMenu = true;
}
+ // also do names only.
+ seqstr = idandseqs[1];
+ ids = idandseqs[0];
+ addMenu = addMenu | createAndAddLinks(linkMenus,true,urlLink,label,"Names",descr, ids,seqstr);
}
if (addMenu)
{
return null;
}
+ private boolean createAndAddLinks(JMenu[] linkMenus, boolean usingNames,
+ GroupUrlLink urlLink, String label, String ltarget, String descr, String[] ids,
+ String[] seqstr)
+ {
+ Object[] urlset = urlLink.makeUrlStubs(ids,seqstr, "FromJalview"+System.currentTimeMillis(),false);
+ if (urlset!=null)
+ {
+ int type = urlLink.getGroupURLType() & 3;
+ //System.out.println(urlLink.getGroupURLType() +" "+((String[])urlset[3])[0]);
+ // first two bits ofurlLink type bitfield are sequenceids and sequences
+ // TODO: FUTURE: ensure the groupURL menu structure can be generalised
+ addshowLink(linkMenus[type], label + (((type & 1)==1) ? ("("+(usingNames ? "Names" : ltarget)+")") : ""), descr, urlLink, urlset);
+ return true;
+ }
+ return false;
+ }
/// end of stuff copied from popupmenu
public void attachWSMenuEntry(final JMenu wsmenu, final AlignFrame alignFrame)
{