/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
/**
* DOCUMENT ME!
- *
+ *
* @author $author$
* @version $Revision$
*/
-public class Preferences
- extends GPreferences
+public class Preferences extends GPreferences
{
- /** Holds name and link separated with | character. Sequence ID must be $SEQUENCE_ID$ */
+ /**
+ * Holds name and link separated with | character. Sequence ID must be
+ * $SEQUENCE_ID$ or $SEQUENCE_ID=/.possible | chars ./=$
+ */
public static Vector sequenceURLLinks;
static
{
- String string = Cache.getDefault("SEQUENCE_LINKS",
- "SRS|http://srs.ebi.ac.uk/srsbin/cgi-bin/wgetz?-newId+(([uniprot-all:$SEQUENCE_ID$]))+-view+SwissEntry");
+ String string = Cache
+ .getDefault(
+ "SEQUENCE_LINKS",
+ "SRS|http://srs.ebi.ac.uk/srsbin/cgi-bin/wgetz?-newId+(([uniprot-all:$SEQUENCE_ID$]))+-view+SwissEntry");
sequenceURLLinks = new Vector();
try
StringTokenizer st = new StringTokenizer(string, "|");
while (st.hasMoreElements())
{
- sequenceURLLinks.addElement(st.nextToken() + "|" + st.nextToken());
+ String name = st.nextToken();
+ String url = st.nextToken();
+ // check for '|' within a regex
+ int rxstart = url.indexOf("$SEQUENCE_ID$");
+ while (rxstart == -1 && url.indexOf("/=$") == -1)
+ {
+ url = url + "|" + st.nextToken();
+ }
+ sequenceURLLinks.addElement(name + "|" + url);
}
- }
- catch (Exception ex)
+ } catch (Exception ex)
{
System.out.println(ex + "\nError parsing sequence links");
}
colour.setSelectedItem(string);
- String[] fonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment()
- .getAvailableFontFamilyNames();
+ String[] fonts = java.awt.GraphicsEnvironment
+ .getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
for (int i = 0; i < fonts.length; i++)
{
fontNameCB.setSelectedItem(Cache.getDefault("FONT_NAME", "SansSerif"));
fontSizeCB.setSelectedItem(Cache.getDefault("FONT_SIZE", "10"));
- fontStyleCB.setSelectedItem(Cache.getDefault("FONT_STYLE", Font.PLAIN + ""));
+ fontStyleCB.setSelectedItem(Cache.getDefault("FONT_STYLE", Font.PLAIN
+ + ""));
smoothFont.setSelected(Cache.getDefault("ANTI_ALIAS", false));
gapSymbolCB.setSelectedItem(Cache.getDefault("GAP_SYMBOL", "-"));
- startupCheckbox.setSelected(Cache.getDefault("SHOW_STARTUP_FILE", true));
+ startupCheckbox
+ .setSelected(Cache.getDefault("SHOW_STARTUP_FILE", true));
startupFileTextfield.setText(Cache.getDefault("STARTUP_FILE",
- "http://www.jalview.org/examples/exampleFile_2_3.jar"));
+ "http://www.jalview.org/examples/exampleFile_2_3.jar"));
sortby.addItem("No sort");
sortby.addItem("Id");
epsRendering.addItem("Lineart");
epsRendering.addItem("Text");
epsRendering.setSelectedItem(Cache.getDefault("EPS_RENDERING",
- "Prompt each time"));
+ "Prompt each time"));
blcjv.setSelected(Cache.getDefault("BLC_JVSUFFIX", true));
clustaljv.setSelected(Cache.getDefault("CLUSTAL_JVSUFFIX", true));
modellerOutput.setSelected(Cache.getDefault("PIR_MODELLER", false));
- autoCalculateConsCheck.setSelected(Cache.getDefault("AUTO_CALC_CONSENSUS", true));
+ autoCalculateConsCheck.setSelected(Cache.getDefault(
+ "AUTO_CALC_CONSENSUS", true));
padGaps.setSelected(Cache.getDefault("PAD_GAPS", false));
- /****************************************************
+ /***************************************************************************
* Set up Connections
*/
nameLinks = new Vector();
try
{
jbInit();
- }
- catch (Exception ex)
+ } catch (Exception ex)
{
ex.printStackTrace();
}
/**
* DOCUMENT ME!
- *
- * @param e DOCUMENT ME!
+ *
+ * @param e
+ * DOCUMENT ME!
*/
public void ok_actionPerformed(ActionEvent e)
{
- Cache.applicationProperties.setProperty("SHOW_JVSUFFIX",
- Boolean.toString(seqLimit.
- isSelected()));
- Cache.applicationProperties.setProperty("RIGHT_ALIGN_IDS",
- Boolean.toString(rightAlign.
- isSelected()));
- Cache.applicationProperties.setProperty("SHOW_FULLSCREEN",
- Boolean.toString(fullScreen.
- isSelected()));
- Cache.applicationProperties.setProperty("SHOW_OVERVIEW",
- Boolean.toString(openoverv.
- isSelected()));
- Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS",
- Boolean.
- toString(annotations.isSelected()));
- Cache.applicationProperties.setProperty("SHOW_CONSERVATION",
- Boolean.
- toString(conservation.isSelected()));
- Cache.applicationProperties.setProperty("SHOW_QUALITY",
- Boolean.toString(quality.isSelected()));
- Cache.applicationProperties.setProperty("SHOW_IDENTITY",
- Boolean.toString(identity.
- isSelected()));
-
- Cache.applicationProperties.setProperty("DEFAULT_COLOUR",
- colour.getSelectedItem().toString());
- Cache.applicationProperties.setProperty("GAP_SYMBOL",
- gapSymbolCB.getSelectedItem().
- toString());
-
- Cache.applicationProperties.setProperty("FONT_NAME",
- fontNameCB.getSelectedItem().
- toString());
- Cache.applicationProperties.setProperty("FONT_STYLE",
- fontStyleCB.getSelectedItem().
- toString());
- Cache.applicationProperties.setProperty("FONT_SIZE",
- fontSizeCB.getSelectedItem().
- toString());
-
- Cache.applicationProperties.setProperty("ID_ITALICS",
- Boolean.toString(idItalics.
- isSelected()));
-
- Cache.applicationProperties.setProperty("ANTI_ALIAS",
- Boolean.toString(smoothFont.
- isSelected()));
-
- Cache.applicationProperties.setProperty("WRAP_ALIGNMENT",
- Boolean.toString(wrap.isSelected()));
+ Cache.applicationProperties.setProperty("SHOW_JVSUFFIX", Boolean
+ .toString(seqLimit.isSelected()));
+ Cache.applicationProperties.setProperty("RIGHT_ALIGN_IDS", Boolean
+ .toString(rightAlign.isSelected()));
+ Cache.applicationProperties.setProperty("SHOW_FULLSCREEN", Boolean
+ .toString(fullScreen.isSelected()));
+ Cache.applicationProperties.setProperty("SHOW_OVERVIEW", Boolean
+ .toString(openoverv.isSelected()));
+ Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS", Boolean
+ .toString(annotations.isSelected()));
+ Cache.applicationProperties.setProperty("SHOW_CONSERVATION", Boolean
+ .toString(conservation.isSelected()));
+ Cache.applicationProperties.setProperty("SHOW_QUALITY", Boolean
+ .toString(quality.isSelected()));
+ Cache.applicationProperties.setProperty("SHOW_IDENTITY", Boolean
+ .toString(identity.isSelected()));
+
+ Cache.applicationProperties.setProperty("DEFAULT_COLOUR", colour
+ .getSelectedItem().toString());
+ Cache.applicationProperties.setProperty("GAP_SYMBOL", gapSymbolCB
+ .getSelectedItem().toString());
+
+ Cache.applicationProperties.setProperty("FONT_NAME", fontNameCB
+ .getSelectedItem().toString());
+ Cache.applicationProperties.setProperty("FONT_STYLE", fontStyleCB
+ .getSelectedItem().toString());
+ Cache.applicationProperties.setProperty("FONT_SIZE", fontSizeCB
+ .getSelectedItem().toString());
+
+ Cache.applicationProperties.setProperty("ID_ITALICS", Boolean
+ .toString(idItalics.isSelected()));
+
+ Cache.applicationProperties.setProperty("ANTI_ALIAS", Boolean
+ .toString(smoothFont.isSelected()));
+
+ Cache.applicationProperties.setProperty("WRAP_ALIGNMENT", Boolean
+ .toString(wrap.isSelected()));
Cache.applicationProperties.setProperty("STARTUP_FILE",
- startupFileTextfield.getText());
- Cache.applicationProperties.setProperty("SHOW_STARTUP_FILE",
- Boolean.
- toString(startupCheckbox.isSelected()));
+ startupFileTextfield.getText());
+ Cache.applicationProperties.setProperty("SHOW_STARTUP_FILE", Boolean
+ .toString(startupCheckbox.isSelected()));
- Cache.applicationProperties.setProperty("SORT_ALIGNMENT",
- sortby.getSelectedItem().toString());
+ Cache.applicationProperties.setProperty("SORT_ALIGNMENT", sortby
+ .getSelectedItem().toString());
if (epsRendering.getSelectedItem().equals("Prompt each time"))
{
}
else
{
- Cache.applicationProperties.setProperty("EPS_RENDERING",
- epsRendering.getSelectedItem().
- toString());
+ Cache.applicationProperties.setProperty("EPS_RENDERING", epsRendering
+ .getSelectedItem().toString());
}
if (defaultBrowser.getText().trim().length() < 1)
else
{
Cache.applicationProperties.setProperty("DEFAULT_BROWSER",
- defaultBrowser.getText());
+ defaultBrowser.getText());
}
jalview.util.BrowserLauncher.resetBrowser();
sequenceURLLinks = new Vector();
for (int i = 0; i < nameLinks.size(); i++)
{
- sequenceURLLinks.addElement(nameLinks.elementAt(i) + "|" +
- urlLinks.elementAt(i));
+ sequenceURLLinks.addElement(nameLinks.elementAt(i) + "|"
+ + urlLinks.elementAt(i));
links.append(sequenceURLLinks.elementAt(i).toString());
links.append("|");
}
// remove last "|"
links.setLength(links.length() - 1);
- Cache.applicationProperties.setProperty("SEQUENCE_LINKS", links.toString());
+ Cache.applicationProperties.setProperty("SEQUENCE_LINKS", links
+ .toString());
}
else
{
Cache.applicationProperties.remove("SEQUENCE_LINKS");
}
- Cache.applicationProperties.setProperty("USE_PROXY",
- Boolean.toString(useProxy.
- isSelected()));
+ Cache.applicationProperties.setProperty("USE_PROXY", Boolean
+ .toString(useProxy.isSelected()));
if (proxyServerTB.getText().trim().length() < 1)
{
}
else
{
- Cache.applicationProperties.setProperty("PROXY_SERVER",
- proxyServerTB.getText());
+ Cache.applicationProperties.setProperty("PROXY_SERVER", proxyServerTB
+ .getText());
}
if (proxyPortTB.getText().trim().length() < 1)
}
else
{
- Cache.applicationProperties.setProperty("PROXY_PORT", proxyPortTB.getText());
+ Cache.applicationProperties.setProperty("PROXY_PORT", proxyPortTB
+ .getText());
}
if (useProxy.isSelected())
System.setProperty("http.proxyPort", "");
}
- Cache.applicationProperties.setProperty("BLC_JVSUFFIX",
- Boolean.toString(blcjv.isSelected()));
- Cache.applicationProperties.setProperty("CLUSTAL_JVSUFFIX",
- Boolean.
- toString(clustaljv.isSelected()));
- Cache.applicationProperties.setProperty("FASTA_JVSUFFIX",
- Boolean.toString(fastajv.isSelected()));
- Cache.applicationProperties.setProperty("MSF_JVSUFFIX",
- Boolean.toString(msfjv.isSelected()));
- Cache.applicationProperties.setProperty("PFAM_JVSUFFIX",
- Boolean.toString(pfamjv.isSelected()));
- Cache.applicationProperties.setProperty("PILEUP_JVSUFFIX",
- Boolean.toString(pileupjv.
- isSelected()));
- Cache.applicationProperties.setProperty("PIR_JVSUFFIX",
- Boolean.toString(pirjv.isSelected()));
- Cache.applicationProperties.setProperty("PIR_MODELLER",
- Boolean.toString(modellerOutput.
- isSelected()));
+ Cache.applicationProperties.setProperty("BLC_JVSUFFIX", Boolean
+ .toString(blcjv.isSelected()));
+ Cache.applicationProperties.setProperty("CLUSTAL_JVSUFFIX", Boolean
+ .toString(clustaljv.isSelected()));
+ Cache.applicationProperties.setProperty("FASTA_JVSUFFIX", Boolean
+ .toString(fastajv.isSelected()));
+ Cache.applicationProperties.setProperty("MSF_JVSUFFIX", Boolean
+ .toString(msfjv.isSelected()));
+ Cache.applicationProperties.setProperty("PFAM_JVSUFFIX", Boolean
+ .toString(pfamjv.isSelected()));
+ Cache.applicationProperties.setProperty("PILEUP_JVSUFFIX", Boolean
+ .toString(pileupjv.isSelected()));
+ Cache.applicationProperties.setProperty("PIR_JVSUFFIX", Boolean
+ .toString(pirjv.isSelected()));
+ Cache.applicationProperties.setProperty("PIR_MODELLER", Boolean
+ .toString(modellerOutput.isSelected()));
jalview.io.PIRFile.useModellerOutput = modellerOutput.isSelected();
- Cache.applicationProperties.setProperty("AUTO_CALC_CONSENSUS",
- Boolean.toString(
- autoCalculateConsCheck.isSelected()));
- Cache.applicationProperties.setProperty("PAD_GAPS",
- Boolean.toString(padGaps.isSelected()));
+ Cache.applicationProperties.setProperty("AUTO_CALC_CONSENSUS", Boolean
+ .toString(autoCalculateConsCheck.isSelected()));
+ Cache.applicationProperties.setProperty("PAD_GAPS", Boolean
+ .toString(padGaps.isSelected()));
dasSource.saveProperties(Cache.applicationProperties);
try
{
frame.setClosed(true);
- }
- catch (Exception ex)
+ } catch (Exception ex)
{
}
}
*/
public void startupFileTextfield_mouseClicked()
{
- 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"
- }, jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));
+ 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" },
+ jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle("Select startup file");
if (value == JalviewFileChooser.APPROVE_OPTION)
{
- jalview.bin.Cache.applicationProperties.setProperty("DEFAULT_FILE_FORMAT",
- chooser.getSelectedFormat());
+ jalview.bin.Cache.applicationProperties.setProperty(
+ "DEFAULT_FILE_FORMAT", chooser.getSelectedFormat());
startupFileTextfield.setText(chooser.getSelectedFile()
- .getAbsolutePath());
+ .getAbsolutePath());
}
}
/**
* DOCUMENT ME!
- *
- * @param e DOCUMENT ME!
+ *
+ * @param e
+ * DOCUMENT ME!
*/
public void cancel_actionPerformed(ActionEvent e)
{
try
{
frame.setClosed(true);
- }
- catch (Exception ex)
+ } catch (Exception ex)
{
}
}
/**
* DOCUMENT ME!
- *
- * @param e DOCUMENT ME!
+ *
+ * @param e
+ * DOCUMENT ME!
*/
public void annotations_actionPerformed(ActionEvent e)
{
while (!valid)
{
if (JOptionPane.showInternalConfirmDialog(Desktop.desktop, link,
- "New sequence URL link",
- JOptionPane.OK_CANCEL_OPTION
- , -1, null)
- == JOptionPane.OK_OPTION)
+ "New sequence URL link", JOptionPane.OK_CANCEL_OPTION, -1,
+ null) == JOptionPane.OK_OPTION)
{
if (link.checkValid())
{
if (index == -1)
{
JOptionPane.showInternalMessageDialog(Desktop.desktop,
- "No link selected!"
- , "No link selected",
- JOptionPane.WARNING_MESSAGE);
+ "No link selected!", "No link selected",
+ JOptionPane.WARNING_MESSAGE);
return;
}
{
if (JOptionPane.showInternalConfirmDialog(Desktop.desktop, link,
- "New sequence URL link",
- JOptionPane.OK_CANCEL_OPTION
- , -1, null)
- == JOptionPane.OK_OPTION)
+ "New sequence URL link", JOptionPane.OK_CANCEL_OPTION, -1,
+ null) == JOptionPane.OK_OPTION)
{
if (link.checkValid())
{
if (index == -1)
{
JOptionPane.showInternalMessageDialog(Desktop.desktop,
- "No link selected!"
- , "No link selected",
- JOptionPane.WARNING_MESSAGE);
+ "No link selected!", "No link selected",
+ JOptionPane.WARNING_MESSAGE);
return;
}
nameLinks.removeElementAt(index);
}
- private void jbInit()
- throws Exception
+ private void jbInit() throws Exception
{
}
}