X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPreferences.java;h=b16ae32d6a5ab9ab3f4fae4575adf3836ac8e753;hb=588042b69abf8e60bcc950b24c283933c7dd422f;hp=4708ced014fc49932b5ae629944bbbdd8e9e30d5;hpb=5cd8e373c75fb348ecda4d94d8a46468fb92756d;p=jalview.git diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 4708ced..b16ae32 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -1,127 +1,69 @@ /* -* Jalview - A Sequence Alignment Editor and Viewer -* Copyright (C) 2005 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 -*/ - + * Jalview - A Sequence Alignment Editor and Viewer + * Copyright (C) 2005 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 + */ package jalview.gui; -import jalview.jbgui.*; -import jalview.schemes.*; -import jalview.io.*; - -import jalview.bin.Cache; -import javax.swing.*; -import java.awt.event.ActionEvent; import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import jalview.bin.*; +import jalview.io.*; +import jalview.jbgui.*; +import jalview.schemes.*; -public class Preferences extends GPreferences +public class Preferences + extends GPreferences { - static boolean preferencesLoaded=false; - - public static boolean showFullscreen=false; - public static boolean showFullId=true; - public static boolean showAnnotation=true; - public static boolean showConservation=true; - public static boolean showQuality=true; - public static boolean showIdentity=true; - public static String fontName="SansSerif"; - public static String fontSize="10"; - public static String fontStyle=Font.PLAIN+""; - public static char gapSymbol='-'; - public static String defaultColour=null; - public static boolean showStartupFile=true; - public static String startupFile = "http://www.jalview.org/examples/exampleFile.jar"; - + static boolean preferencesLoaded = false; + public static boolean showFullscreen = false; + public static boolean showFullId = true; + public static boolean showAnnotation = true; + public static boolean showConservation = true; + public static boolean showQuality = true; + public static boolean showIdentity = true; + public static String fontName = "SansSerif"; + public static String fontSize = "10"; + public static String fontStyle = Font.PLAIN + ""; + public static char gapSymbol = '-'; + public static String defaultColour = null; + public static boolean showStartupFile = true; + public static String startupFile = + "http://www.jalview.org/examples/exampleFile.jar"; JInternalFrame frame; - public static void initPreferences() - { - String string = Cache.getProperty("SHOW_FULL_ID"); - if(string!=null) - showFullId = Boolean.valueOf(string).booleanValue(); - - string = Cache.getProperty("SHOW_FULLSCREEN"); - if(string!=null) - showFullscreen = Boolean.valueOf(string).booleanValue(); - - string = Cache.getProperty("SHOW_ANNOTATIONS"); - if(string!=null) - showAnnotation = Boolean.valueOf(string).booleanValue(); - - string = Cache.getProperty("SHOW_CONSERVATION"); - if(string!=null) - showConservation = Boolean.valueOf(string).booleanValue(); - string = Cache.getProperty("SHOW_QUALITY"); - if(string!=null) - showQuality = Boolean.valueOf(string).booleanValue(); - string = Cache.getProperty("SHOW_IDENTITY"); - if(string!=null) - showIdentity = Boolean.valueOf(string).booleanValue(); - - string = Cache.getProperty("GAP_SYMBOL"); - if(string!=null) - gapSymbol = string.charAt(0); - - string = Cache.getProperty("SHOW_FULL_ID"); - if(string!=null) - showFullId = Boolean.valueOf(string).booleanValue(); - - string = Cache.getProperty("FONT_NAME"); - if (string != null) - fontName = string; - - string = Cache.getProperty("FONT_STYLE"); - if (string != null) - fontStyle = string; - - string = Cache.getProperty("FONT_SIZE"); - if (string != null) - fontSize = string; - - - string = Cache.getProperty("DEFAULT_COLOUR"); - if(string!=null) - defaultColour = string; - - string = Cache.getProperty("STARTUP_FILE"); - if(string!=null) - startupFile = string; - - string = Cache.getProperty("SHOW_STARTUP_FILE"); - if(string!=null) - showStartupFile = Boolean.valueOf(string).booleanValue(); - - preferencesLoaded = true; - } - public Preferences() { initPreferences(); frame = new JInternalFrame(); frame.setContentPane(this); - Desktop.addInternalFrame(frame, "Preferences", 480,390 ); + Desktop.addInternalFrame(frame, "Preferences", 480, 390); fullID.setSelected(showFullId); + String string = Cache.getProperty("SHOW_FULLSCREEN"); boolean value = false; - if(string!=null) - value = Boolean.valueOf(string).booleanValue(); + + if (string != null) + { + value = Boolean.valueOf(string).booleanValue(); + } fullScreen.setSelected(value); annotations.setSelected(showAnnotation); @@ -134,43 +76,158 @@ public class Preferences extends GPreferences quality.setSelected(showQuality); identity.setSelected(showIdentity); - for(int i=0; i<12; i++) - colour.addItem( ColourSchemeProperty.getColourName(i) ); + for (int i = 0; i < 12; i++) + { + colour.addItem(ColourSchemeProperty.getColourName(i)); + } string = Cache.getProperty("DEFAULT_COLOUR"); - if(string!=null) - colour.setSelectedItem( string ); + + if (string != null) + { + colour.setSelectedItem(string); + } else - colour.setSelectedIndex( 11 ); + { + colour.setSelectedIndex(11); + } - String fonts[] = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); - for(int i=0; i