X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPreferences.java;h=c9c5f6ddad14d6dc34b59fb2cb4291b90ce10ddc;hb=153dd62dc91da13ae732600e6ea55ddbe15eab39;hp=26d7260b2b9eba9715fb54ee463a8f5b1a685b9b;hpb=2de8acfae59aced665e4c37ad0f7dcc2ed68818e;p=jalview.git diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 26d7260..c9c5f6d 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -1,20 +1,19 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1) - * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6) + * Copyright (C) 2010 J Procter, AM Waterhouse, 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 file is part of Jalview. * - * 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. + * Jalview 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 3 of the License, or (at your option) any later version. * - * 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 + * Jalview 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 Jalview. If not, see . */ package jalview.gui; @@ -29,6 +28,7 @@ import jalview.bin.*; import jalview.io.*; import jalview.jbgui.*; import jalview.schemes.*; +import jalview.ws.EnfinEnvision2OneWay; /** * DOCUMENT ME! @@ -44,6 +44,16 @@ public class Preferences extends GPreferences * $SEQUENCE_ID$ or $SEQUENCE_ID=/.possible | chars ./=$ */ public static Vector sequenceURLLinks; + + /** + * Holds name and link separated with | character. Sequence IDS and Sequences + * must be $SEQUENCEIDS$ or $SEQUENCEIDS=/.possible | chars ./=$ and + * $SEQUENCES$ or $SEQUENCES=/.possible | chars ./=$ and separation character + * for first and second token specified after a pipe character at end |,|. + * (TODO: proper escape for using | to separate ids or sequences + */ + + public static Vector groupURLLinks; static { String string = Cache @@ -71,6 +81,15 @@ public class Preferences extends GPreferences { System.out.println(ex + "\nError parsing sequence links"); } + /** + * TODO: reformulate groupURL encoding so two or more can be stored in the + * .properties file as '|' separated strings + */ + + groupURLLinks = new Vector(); + // groupURLLinks.addElement("UNIPROT|EnVision2|http://www.ebi.ac.uk/enfin-srv/envision2/pages/linkin.jsf?tool=Jalview&workflow=Default&datasetName=JalviewIDs$DATASETID$&input=$SEQUENCEIDS$&inputType=0|,"); + // groupURLLinks.addElement("Seqs|EnVision2|http://www.ebi.ac.uk/enfin-srv/envision2/pages/linkin.jsf?tool=Jalview&workflow=Default&datasetName=JalviewSeqs$DATASETID$&input=$SEQUENCES=/([A-Za-z]+)+/=$&inputType=1|,"); + } Vector nameLinks, urlLinks; @@ -79,6 +98,8 @@ public class Preferences extends GPreferences DasSourceBrowser dasSource; + private WsPreferences wsPrefs; + /** * Creates a new Preferences object. */ @@ -89,7 +110,8 @@ public class Preferences extends GPreferences frame.setContentPane(this); dasSource = new DasSourceBrowser(); dasPanel.add(dasSource, BorderLayout.CENTER); - + wsPrefs = new WsPreferences(); + wsPanel.add(wsPrefs, BorderLayout.CENTER); int width = 500, height = 420; if (new jalview.util.Platform().isAMac()) { @@ -105,17 +127,18 @@ public class Preferences extends GPreferences fullScreen.setSelected(Cache.getDefault("SHOW_FULLSCREEN", false)); 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)); - conservation.setSelected(Cache.getDefault("SHOW_CONSERVATION", true)); 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++) + showUnconserved + .setSelected(Cache.getDefault("SHOW_UNCONSERVED", false)); + showNpTooltip.setSelected(Cache + .getDefault("SHOW_NPFEATS_TOOLTIP", true)); + showDbRefTooltip.setSelected(Cache.getDefault("SHOW_DBREFS_TOOLTIP", + true)); + + for (int i = ColourSchemeProperty.FIRST_COLOUR; i <= ColourSchemeProperty.LAST_COLOUR; i++) { colour.addItem(ColourSchemeProperty.getColourName(i)); } @@ -185,6 +208,15 @@ public class Preferences extends GPreferences autoCalculateConsCheck.setSelected(Cache.getDefault( "AUTO_CALC_CONSENSUS", true)); + showGroupConsensus.setSelected(Cache.getDefault("SHOW_GROUP_CONSENSUS", + false)); + showGroupConservation.setSelected(Cache.getDefault( + "SHOW_GROUP_CONSERVATION", false)); + showConsensHistogram.setSelected(Cache.getDefault( + "SHOW_CONSENSUS_HISTOGRAM", true)); + showConsensLogo.setSelected(Cache.getDefault("SHOW_CONSENSUS_LOGO", + false)); + padGaps.setSelected(Cache.getDefault("PAD_GAPS", false)); /*************************************************************************** @@ -208,6 +240,17 @@ public class Preferences extends GPreferences proxyPortTB.setText(Cache.getDefault("PROXY_PORT", "")); defaultBrowser.setText(Cache.getDefault("DEFAULT_BROWSER", "")); + + usagestats.setSelected(Cache.getDefault("USAGESTATS", false)); + questionnaire + .setSelected(Cache.getProperty("NOQUESTIONNAIRES") == null); // note + // antisense + // here + versioncheck.setSelected(Cache.getDefault("VERSION_CHECK", true)); // default + // is + // true + annotations_actionPerformed(null); // update the display of the annotation + // settings try { jbInit(); @@ -222,7 +265,7 @@ public class Preferences extends GPreferences * DOCUMENT ME! * * @param e - * DOCUMENT ME! + * DOCUMENT ME! */ public void ok_actionPerformed(ActionEvent e) { @@ -258,9 +301,22 @@ public class Preferences extends GPreferences Cache.applicationProperties.setProperty("ID_ITALICS", Boolean .toString(idItalics.isSelected())); - Cache.applicationProperties.setProperty("SHOW_UNCONSERVED",Boolean.toString(showUnconserved.isSelected())); + Cache.applicationProperties.setProperty("SHOW_UNCONSERVED", Boolean + .toString(showUnconserved.isSelected())); + Cache.applicationProperties.setProperty("SHOW_GROUP_CONSENSUS", Boolean + .toString(showGroupConsensus.isSelected())); + Cache.applicationProperties.setProperty("SHOW_GROUP_CONSERVATION", + Boolean.toString(showGroupConservation.isSelected())); + Cache.applicationProperties.setProperty("SHOW_CONSENSUS_HISTOGRAM", + Boolean.toString(showConsensHistogram.isSelected())); + Cache.applicationProperties.setProperty("SHOW_CONSENSUS_LOGO", Boolean + .toString(showConsensLogo.isSelected())); Cache.applicationProperties.setProperty("ANTI_ALIAS", Boolean .toString(smoothFont.isSelected())); + Cache.applicationProperties.setProperty("SHOW_NPFEATS_TOOLTIP", Boolean + .toString(showNpTooltip.isSelected())); + Cache.applicationProperties.setProperty("SHOW_DBREFS_TOOLTIP", Boolean + .toString(showDbRefTooltip.isSelected())); Cache.applicationProperties.setProperty("WRAP_ALIGNMENT", Boolean .toString(wrap.isSelected())); @@ -349,7 +405,24 @@ public class Preferences extends GPreferences System.setProperty("http.proxyHost", ""); System.setProperty("http.proxyPort", ""); } - + Cache.setProperty("VERSION_CHECK", Boolean.toString(versioncheck + .isSelected())); + if (Cache.getProperty("USAGESTATS") != null || usagestats.isSelected()) + { + // default is false - we only set this if the user has actively agreed + Cache.setProperty("USAGESTATS", Boolean.toString(usagestats + .isSelected())); + } + if (!questionnaire.isSelected()) + { + Cache.setProperty("NOQUESTIONNAIRES", "true"); + } + else + { + // special - made easy to edit a property file to disable questionnaires + // by just adding the given line + Cache.removeProperty("NOQUESTIONNAIRES"); + } Cache.applicationProperties.setProperty("BLC_JVSUFFIX", Boolean .toString(blcjv.isSelected())); Cache.applicationProperties.setProperty("CLUSTAL_JVSUFFIX", Boolean @@ -374,7 +447,7 @@ public class Preferences extends GPreferences .toString(padGaps.isSelected())); dasSource.saveProperties(Cache.applicationProperties); - + wsPrefs.updateAndRefreshWsMenuConfig(false); Cache.saveProperties(); try { @@ -413,12 +486,13 @@ public class Preferences extends GPreferences * DOCUMENT ME! * * @param e - * DOCUMENT ME! + * DOCUMENT ME! */ public void cancel_actionPerformed(ActionEvent e) { try { + wsPrefs.updateWsMenuConfig(true); frame.setClosed(true); } catch (Exception ex) { @@ -429,13 +503,19 @@ public class Preferences extends GPreferences * DOCUMENT ME! * * @param e - * DOCUMENT ME! + * DOCUMENT ME! */ public void annotations_actionPerformed(ActionEvent e) { conservation.setEnabled(annotations.isSelected()); quality.setEnabled(annotations.isSelected()); identity.setEnabled(annotations.isSelected()); + showGroupConsensus.setEnabled(annotations.isSelected()); + showGroupConservation.setEnabled(annotations.isSelected()); + showConsensHistogram.setEnabled(annotations.isSelected() + && (identity.isSelected() || showGroupConsensus.isSelected())); + showConsensLogo.setEnabled(annotations.isSelected() + && (identity.isSelected() || showGroupConsensus.isSelected())); } public void newLink_actionPerformed(ActionEvent e) @@ -538,8 +618,13 @@ public class Preferences extends GPreferences } } - /* (non-Javadoc) - * @see jalview.jbgui.GPreferences#showunconserved_actionPerformed(java.awt.event.ActionEvent) + + /* + * (non-Javadoc) + * + * @see + * jalview.jbgui.GPreferences#showunconserved_actionPerformed(java.awt.event + * .ActionEvent) */ protected void showunconserved_actionPerformed(ActionEvent e) { @@ -550,4 +635,9 @@ public class Preferences extends GPreferences private void jbInit() throws Exception { } + + public static Collection getGroupURLLinks() + { + return groupURLLinks; + } }