X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPreferences.java;h=aa4d19389aad102314e643d6ae7f9786bb695920;hb=d2e7e2612a39826b30cf92889441ce99b36e7a40;hp=722628380658b2170a422b19e9219c5c88042d36;hpb=9251be6d459585e39e85310336b89f3c8834837b;p=jalview.git diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 7226283..aa4d193 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -1,17 +1,17 @@ /* - * 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 @@ -22,6 +22,7 @@ import java.util.*; import java.awt.*; import java.awt.event.*; + import javax.swing.*; import jalview.bin.*; @@ -31,19 +32,24 @@ import jalview.schemes.*; /** * 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$ or $SEQUENCE_ID=/.possible | chars ./=$ */ + + /** + * 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 @@ -51,18 +57,17 @@ public class Preferences StringTokenizer st = new StringTokenizer(string, "|"); while (st.hasMoreElements()) { - String name=st.nextToken(); - String url= 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) + 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"); } @@ -108,6 +113,7 @@ public class Preferences quality.setSelected(Cache.getDefault("SHOW_QUALITY", true)); identity.setSelected(Cache.getDefault("SHOW_IDENTITY", true)); openoverv.setSelected(Cache.getDefault("SHOW_OVERVIEW", false)); + showUnconserved.setSelected(Cache.getDefault("SHOW_UNCONSERVED", false)); for (int i = 0; i < 13; i++) { @@ -118,8 +124,8 @@ public class Preferences 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++) { @@ -137,7 +143,8 @@ public class Preferences 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)); @@ -150,9 +157,10 @@ public class Preferences 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"); @@ -163,7 +171,7 @@ public class Preferences 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)); @@ -175,10 +183,11 @@ public class Preferences 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(); @@ -202,8 +211,7 @@ public class Preferences try { jbInit(); - } - catch (Exception ex) + } catch (Exception ex) { ex.printStackTrace(); } @@ -212,71 +220,58 @@ public class Preferences /** * 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("SHOW_UNCONSERVED",Boolean.toString(showUnconserved.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")) { @@ -284,9 +279,8 @@ public class Preferences } else { - Cache.applicationProperties.setProperty("EPS_RENDERING", - epsRendering.getSelectedItem(). - toString()); + Cache.applicationProperties.setProperty("EPS_RENDERING", epsRendering + .getSelectedItem().toString()); } if (defaultBrowser.getText().trim().length() < 1) @@ -296,7 +290,7 @@ public class Preferences else { Cache.applicationProperties.setProperty("DEFAULT_BROWSER", - defaultBrowser.getText()); + defaultBrowser.getText()); } jalview.util.BrowserLauncher.resetBrowser(); @@ -307,23 +301,23 @@ public class Preferences 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) { @@ -331,8 +325,8 @@ public class Preferences } else { - Cache.applicationProperties.setProperty("PROXY_SERVER", - proxyServerTB.getText()); + Cache.applicationProperties.setProperty("PROXY_SERVER", proxyServerTB + .getText()); } if (proxyPortTB.getText().trim().length() < 1) @@ -341,7 +335,8 @@ public class Preferences } else { - Cache.applicationProperties.setProperty("PROXY_PORT", proxyPortTB.getText()); + Cache.applicationProperties.setProperty("PROXY_PORT", proxyPortTB + .getText()); } if (useProxy.isSelected()) @@ -355,32 +350,28 @@ public class Preferences 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); @@ -388,8 +379,7 @@ public class Preferences try { frame.setClosed(true); - } - catch (Exception ex) + } catch (Exception ex) { } } @@ -399,18 +389,12 @@ public class Preferences */ 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"); @@ -418,33 +402,34 @@ public class Preferences 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) { @@ -461,10 +446,8 @@ public class Preferences 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()) { @@ -489,9 +472,8 @@ public class Preferences 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; } @@ -503,10 +485,8 @@ public class Preferences { 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()) { @@ -530,9 +510,8 @@ public class Preferences 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); @@ -559,9 +538,16 @@ public class Preferences } } + /* (non-Javadoc) + * @see jalview.jbgui.GPreferences#showunconserved_actionPerformed(java.awt.event.ActionEvent) + */ + protected void showunconserved_actionPerformed(ActionEvent e) + { + // TODO Auto-generated method stub + super.showunconserved_actionPerformed(e); + } - private void jbInit() - throws Exception + private void jbInit() throws Exception { } }