X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPreferences.java;h=840598bfd9402db2a9ccb7301d4e3dcc88fd2474;hb=99bd0585b045d25fa719ee007e3310d27e53ac88;hp=8a2650b5d6d1a99f41adb4872094052abb1a6d0e;hpb=97c00be1121a6758439b73ded035c4edbacfa2bc;p=jalview.git diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 8a2650b..840598b 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Copyright (C) 2006 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 @@ -18,8 +18,6 @@ */ package jalview.gui; -import jalview.bin.*; - import jalview.io.*; import jalview.jbgui.*; @@ -45,11 +43,32 @@ import jalview.bin.Cache; public class Preferences extends GPreferences { /** Holds name and link separated with | character. Sequence ID must be $SEQUENCE_ID$ */ - public static Vector sequenceURLLinks = new Vector(); + 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"); + sequenceURLLinks = new Vector(); + + try + { + StringTokenizer st = new StringTokenizer(string, "|"); + while (st.hasMoreElements()) + { + sequenceURLLinks.addElement(st.nextToken() + "|" + st.nextToken()); + } + } + catch (Exception ex) + { + System.out.println(ex + "\nError parsing sequence links"); + } + } Vector nameLinks, urlLinks; JInternalFrame frame; + DasSourceBrowser dasSource; + /** * Creates a new Preferences object. @@ -59,14 +78,25 @@ public class Preferences extends GPreferences frame = new JInternalFrame(); frame.setContentPane(this); - Desktop.addInternalFrame(frame, "Preferences", 480, 390); - frame.setMinimumSize(new Dimension(480,390)); + dasSource = new DasSourceBrowser(); + dasPanel.add(dasSource, BorderLayout.CENTER); + + int width = 500, height = 420; + if(System.getProperty("os.name").startsWith("Mac")) + { + width = 570; + height = 460; + } - fullID.setSelected( Cache.getDefault("SHOW_FULL_ID", true)); + Desktop.addInternalFrame(frame, "Preferences", width, height); + frame.setMinimumSize(new Dimension(width, height)); + + seqLimit.setSelected( Cache.getDefault("SHOW_JVSUFFIX", true)); + rightAlign.setSelected( Cache.getDefault("RIGHT_ALIGN_IDS", false)); fullScreen.setSelected( Cache.getDefault("SHOW_FULLSCREEN", false)); - annotations.setSelected( Cache.getDefault("SHOW_FULL_ID", true)); - conservation.setEnabled( Cache.getDefault("SHOW_ANNOTATIONS", true)); + annotations.setSelected( Cache.getDefault("SHOW_ANNOTATIONS", true)); + conservation.setEnabled( Cache.getDefault("SHOW_ANNOTATIONS", true)); quality.setEnabled(Cache.getDefault("SHOW_ANNOTATIONS", true)); identity.setEnabled(Cache.getDefault("SHOW_ANNOTATIONS", true)); @@ -74,21 +104,14 @@ public class Preferences extends GPreferences quality.setSelected(Cache.getDefault("SHOW_QUALITY", true)); identity.setSelected(Cache.getDefault("SHOW_IDENTITY", true)); - for (int i = 0; i < 12; i++) + for (int i = 0; i < 13; i++) { colour.addItem(ColourSchemeProperty.getColourName(i)); } - String string = Cache.getProperty("DEFAULT_COLOUR"); + String string = Cache.getDefault("DEFAULT_COLOUR", "None"); - if (string != null) - { - colour.setSelectedItem(string); - } - else - { - colour.setSelectedIndex(11); - } + colour.setSelectedItem(string); String[] fonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment() .getAvailableFontFamilyNames(); @@ -111,6 +134,10 @@ public class Preferences extends GPreferences fontSizeCB.setSelectedItem(Cache.getDefault("FONT_SIZE", "10")); fontStyleCB.setSelectedItem(Cache.getDefault("FONT_STYLE", Font.PLAIN + "") ); + smoothFont.setSelected(Cache.getDefault("ANTI_ALIAS", false)); + + wrap.setSelected(Cache.getDefault("WRAP_ALIGNMENT", false)); + gapSymbolCB.addItem("-"); gapSymbolCB.addItem("."); @@ -120,23 +147,32 @@ public class Preferences extends GPreferences startupFileTextfield.setText(Cache.getDefault("STARTUP_FILE", "http://www.jalview.org/examples/exampleFile.jar")); - /**************************************************** - * Set up Connections - */ + sortby.addItem("No sort"); + sortby.addItem("Id"); + sortby.addItem("Pairwise Identity"); + sortby.setSelectedItem( Cache.getDefault("SORT_ALIGNMENT", "No sort") ); - string = Cache.getDefault("SEQUENCE_LINKS", - "SRS|http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:$SEQUENCE_ID$]+-vn+2"); - sequenceURLLinks = new Vector(); + epsRendering.addItem("Prompt each time"); + epsRendering.addItem("Lineart"); + epsRendering.addItem("Text"); + epsRendering.setSelectedItem( Cache.getDefault("EPS_RENDERING", "Prompt each time")); - try{ - StringTokenizer st = new StringTokenizer(string, "|"); - while (st.hasMoreElements()) - { - sequenceURLLinks.addElement(st.nextToken() + "|" + st.nextToken()); - } - }catch(Exception ex) - {System.out.println(ex+"\nError parsing sequence links");} + blcjv.setSelected( Cache.getDefault("BLC_JVSUFFIX", true) ); + clustaljv.setSelected( Cache.getDefault("CLUSTAL_JVSUFFIX", true) ); + fastajv.setSelected( Cache.getDefault("FASTA_JVSUFFIX", true) ); + msfjv.setSelected( Cache.getDefault("MSF_JVSUFFIX", true) ); + pfamjv.setSelected( Cache.getDefault("PFAM_JVSUFFIX", true) ); + pileupjv.setSelected( Cache.getDefault("PILEUP_JVSUFFIX", true) ); + pirjv.setSelected( Cache.getDefault("PIR_JVSUFFIX", true) ); + + modellerOutput.setSelected( Cache.getDefault("PIR_MODELLER", false)); + + autoCalculateConsCheck.setSelected( Cache.getDefault("AUTO_CALC_CONSENSUS", true)); + padGaps.setSelected( Cache.getDefault("PAD_GAPS", false)); + /**************************************************** + * Set up Connections + */ nameLinks = new Vector(); urlLinks = new Vector(); for(int i=0; i0) { @@ -209,18 +263,51 @@ public class Preferences extends GPreferences links.setLength( links.length()-1 ); 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("PROXY_SERVER",proxyServerTB.getText()); - Cache.applicationProperties.setProperty("PROXY_PORT", proxyPortTB.getText()); + + if (proxyServerTB.getText().trim().length() < 1) + Cache.applicationProperties.remove("PROXY_SERVER"); + else + Cache.applicationProperties.setProperty("PROXY_SERVER", + proxyServerTB.getText()); + + if (proxyPortTB.getText().trim().length() < 1) + Cache.applicationProperties.remove("PROXY_PORT"); + else + Cache.applicationProperties.setProperty("PROXY_PORT", proxyPortTB.getText()); if(useProxy.isSelected()) { System.setProperty("http.proxyHost", proxyServerTB.getText()); System.setProperty("http.proxyPort", proxyPortTB.getText()); } + else + { + System.setProperty("http.proxyHost",""); + 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()) ); + 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())); + dasSource.saveProperties(Cache.applicationProperties); Cache.saveProperties(); try