import java.awt.event.MouseMotionListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
+import java.util.ArrayList;
import java.util.List;
-import java.util.Vector;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
return;
}
- Vector links = Preferences.sequenceURLLinks;
+ List<String> links = Preferences.getSequenceURLLinks();
if (links == null || links.size() < 1)
{
return;
{
// DEFAULT LINK IS FIRST IN THE LINK LIST
// BUT IF ITS A REGEX AND DOES NOT MATCH THE NEXT ONE WILL BE TRIED
- url = links.elementAt(i++).toString();
+ url = links.get(i++).toString();
jalview.util.UrlLink urlLink = null;
try
{
}
}
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
@Override
public void mouseEntered(MouseEvent e)
{
}
}
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
@Override
public void mouseExited(MouseEvent e)
{
Sequence sq = (Sequence) av.getAlignment().getSequenceAt(seq);
// build a new links menu based on the current links + any non-positional
// features
- Vector nlinks = new Vector(Preferences.sequenceURLLinks);
+ List<String> nlinks = new ArrayList<String>(
+ Preferences.getSequenceURLLinks());
SequenceFeature sf[] = sq == null ? null : sq.getSequenceFeatures();
for (int sl = 0; sf != null && sl < sf.length; sl++)
{
{
for (int l = 0, lSize = sf[sl].links.size(); l < lSize; l++)
{
- nlinks.addElement(sf[sl].links.elementAt(l));
+ nlinks.add(sf[sl].links.elementAt(l));
}
}
}
}
- jalview.gui.PopupMenu pop = new jalview.gui.PopupMenu(alignPanel, sq,
- nlinks, new Vector(Preferences.getGroupURLLinks()));
+ PopupMenu pop = new PopupMenu(alignPanel, sq, nlinks,
+ Preferences.getGroupURLLinks());
pop.show(this, e.getX(), e.getY());
return;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.PDBEntry;
-import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Hashtable;
JMenuItem hideInsertions = new JMenuItem();
/**
- * Creates a new PopupMenu object.
- *
- * @param ap
- * DOCUMENT ME!
- * @param seq
- * DOCUMENT ME!
- */
- public PopupMenu(final AlignmentPanel ap, Sequence seq, Vector links)
- {
- this(ap, seq, links, null);
- }
-
- /**
*
* @param ap
* @param seq
* @param groupLinks
*/
public PopupMenu(final AlignmentPanel ap, final SequenceI seq,
- Vector links, Vector groupLinks)
+ List<String> links, List<String> groupLinks)
{
// /////////////////////////////////////////////////////////
// If this is activated from the sequence panel, the user may want to
{
JMenu linkMenu = new JMenu(MessageManager.getString("action.link"));
- Vector linkset = new Vector();
+ List<String> linkset = new ArrayList<String>();
for (int i = 0; i < links.size(); i++)
{
- String link = links.elementAt(i).toString();
+ String link = links.get(i);
UrlLink urlLink = null;
try
{
{
if (!linkset.contains(urls[u] + "|" + urls[u + 1]))
{
- linkset.addElement(urls[u] + "|" + urls[u + 1]);
+ linkset.add(urls[u] + "|" + urls[u + 1]);
addshowLink(linkMenu, label + "|" + urls[u],
urls[u + 1]);
}
{
if (!linkset.contains(urls[u] + "|" + urls[u + 1]))
{
- linkset.addElement(urls[u] + "|" + urls[u + 1]);
+ linkset.add(urls[u] + "|" + urls[u + 1]);
addshowLink(linkMenu, label, urls[u + 1]);
}
}
{
if (!linkset.contains(urls[u] + "|" + urls[u + 1]))
{
- linkset.addElement(urls[u] + "|" + urls[u + 1]);
+ linkset.add(urls[u] + "|" + urls[u + 1]);
addshowLink(linkMenu, label, urls[u + 1]);
}
}
{
if (!linkset.contains(label + "|" + urlLink.getUrl_prefix()))
{
- linkset.addElement(label + "|" + urlLink.getUrl_prefix());
+ linkset.add(label + "|" + urlLink.getUrl_prefix());
// Add a non-dynamic link
addshowLink(linkMenu, label, urlLink.getUrl_prefix());
}
showOrHideMenu.add(item);
}
- private void buildGroupURLMenu(SequenceGroup sg, Vector groupLinks)
+ private void buildGroupURLMenu(SequenceGroup sg, List<String> groupLinks)
{
// TODO: usability: thread off the generation of group url content so root
// to user
for (int i = 0; i < groupLinks.size(); i++)
{
- String link = groupLinks.elementAt(i).toString();
+ String link = groupLinks.get(i);
GroupUrlLink urlLink = null;
try
{
import jalview.jbgui.GPreferences;
import jalview.jbgui.GSequenceLink;
import jalview.schemes.ColourSchemeProperty;
+import jalview.util.BrowserLauncher;
import jalview.util.MessageManager;
+import jalview.util.Platform;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.io.File;
-import java.util.Collection;
+import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
-import java.util.Vector;
import javax.help.HelpSetException;
import javax.swing.JColorChooser;
* Holds name and link separated with | character. Sequence ID must be
* $SEQUENCE_ID$ or $SEQUENCE_ID=/.possible | chars ./=$
*/
- public static Vector sequenceURLLinks;
+ private static List<String> sequenceURLLinks;
/**
* Holds name and link separated with | character. Sequence IDS and Sequences
* (TODO: proper escape for using | to separate ids or sequences
*/
- public static Vector groupURLLinks;
+ private static List<String> groupURLLinks;
+
+ List<String> nameLinks;
+
+ List<String> urlLinks;
+
+ JInternalFrame frame;
+
+ DasSourceBrowser dasSource;
+
+ private WsPreferences wsPrefs;
+
static
{
String string = Cache
.getDefault(
"SEQUENCE_LINKS",
"EMBL-EBI Search|http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$");
- sequenceURLLinks = new Vector();
+ sequenceURLLinks = new ArrayList<String>();
try
{
{
url = url + "|" + st.nextToken();
}
- sequenceURLLinks.addElement(name + "|" + url);
+ sequenceURLLinks.add(name + "|" + url);
}
} catch (Exception ex)
{
if (srsPos > -1)
{
sequenceURLLinks
- .setElementAt(
- "EMBL-EBI Search|http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$",
- srsPos);
+ .set(srsPos,
+ "EMBL-EBI Search|http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$");
}
}
* .properties file as '|' separated strings
*/
- groupURLLinks = new Vector();
+ groupURLLinks = new ArrayList<String>();
}
- Vector nameLinks, urlLinks;
-
- JInternalFrame frame;
-
- DasSourceBrowser dasSource;
-
- private WsPreferences wsPrefs;
-
/**
* Creates a new Preferences object.
*/
wsPrefs = new WsPreferences();
wsTab.add(wsPrefs, BorderLayout.CENTER);
int width = 500, height = 450;
- if (new jalview.util.Platform().isAMac())
+ if (Platform.isAMac())
{
width = 570;
height = 480;
/*
* Set Connections tab defaults
*/
- nameLinks = new Vector();
- urlLinks = new Vector();
+ nameLinks = new ArrayList<String>();
+ urlLinks = new ArrayList<String>();
for (int i = 0; i < sequenceURLLinks.size(); i++)
{
- String link = sequenceURLLinks.elementAt(i).toString();
- nameLinks.addElement(link.substring(0, link.indexOf("|")));
- urlLinks.addElement(link.substring(link.indexOf("|") + 1));
+ String link = sequenceURLLinks.get(i).toString();
+ nameLinks.add(link.substring(0, link.indexOf("|")));
+ urlLinks.add(link.substring(link.indexOf("|") + 1));
}
updateLinkData();
*/
Cache.setOrRemove("DEFAULT_BROWSER", defaultBrowser.getText());
- jalview.util.BrowserLauncher.resetBrowser();
+ BrowserLauncher.resetBrowser();
if (nameLinks.size() > 0)
{
StringBuffer links = new StringBuffer();
- sequenceURLLinks = new Vector();
+ sequenceURLLinks = new ArrayList<String>();
for (int i = 0; i < nameLinks.size(); i++)
{
- sequenceURLLinks.addElement(nameLinks.elementAt(i) + "|"
- + urlLinks.elementAt(i));
- links.append(sequenceURLLinks.elementAt(i).toString());
+ sequenceURLLinks.add(nameLinks.get(i) + "|"
+ + urlLinks.get(i));
+ links.append(sequenceURLLinks.get(i).toString());
links.append("|");
}
// remove last "|"
Boolean.toString(clustaljv.isSelected()));
Cache.applicationProperties.setProperty("FASTA_JVSUFFIX",
Boolean.toString(fastajv.isSelected()));
+ Cache.applicationProperties.setProperty("MEGA_JVSUFFIX",
+ Boolean.toString(megajv.isSelected()));
Cache.applicationProperties.setProperty("MSF_JVSUFFIX",
Boolean.toString(msfjv.isSelected()));
Cache.applicationProperties.setProperty("PFAM_JVSUFFIX",
{
JalviewFileChooser chooser = new JalviewFileChooser(
jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] {
- "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc",
- "jar" }, new String[] { "Fasta", "Clustal", "PFAM", "MSF",
- "PIR", "BLC", "Jalview" },
+ "fa, fasta, fastq", "aln", "pfam", "meg", "msf", "pir",
+ "blc", "jar" }, new String[] { "Fasta", "Clustal", "PFAM",
+ "MEGA", "MSF", "PIR", "BLC", "Jalview" },
jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle(MessageManager
{
if (link.checkValid())
{
- nameLinks.addElement(link.getName());
- urlLinks.addElement(link.getURL());
+ nameLinks.add(link.getName());
+ urlLinks.add(link.getURL());
updateLinkData();
valid = true;
}
return;
}
- link.setName(nameLinks.elementAt(index).toString());
- link.setURL(urlLinks.elementAt(index).toString());
+ link.setName(nameLinks.get(index).toString());
+ link.setURL(urlLinks.get(index).toString());
boolean valid = false;
while (!valid)
{
if (link.checkValid())
{
- nameLinks.setElementAt(link.getName(), index);
- urlLinks.setElementAt(link.getURL(), index);
+ nameLinks.set(index, link.getName());
+ urlLinks.set(index, link.getURL());
updateLinkData();
valid = true;
}
JOptionPane.WARNING_MESSAGE);
return;
}
- nameLinks.removeElementAt(index);
- urlLinks.removeElementAt(index);
+ nameLinks.remove(index);
+ urlLinks.remove(index);
updateLinkData();
}
void updateLinkData()
{
- linkNameList.setListData(nameLinks);
- linkURLList.setListData(urlLinks);
+ linkNameList.setListData(nameLinks.toArray(new String[nameLinks.size()]));
+ linkURLList.setListData(urlLinks.toArray(new String[urlLinks.size()]));
}
public void defaultBrowser_mouseClicked(MouseEvent e)
}
- /*
- * (non-Javadoc)
- *
- * @see
- * jalview.jbgui.GPreferences#showunconserved_actionPerformed(java.awt.event
- * .ActionEvent)
- */
- protected void showunconserved_actionPerformed(ActionEvent e)
+ public static List<String> getGroupURLLinks()
{
- // TODO Auto-generated method stub
- super.showunconserved_actionPerformed(e);
+ return groupURLLinks;
}
- public static Collection getGroupURLLinks()
+ public static List<String> getSequenceURLLinks()
{
- return groupURLLinks;
+ return sequenceURLLinks;
}
@Override