+/*\r
+* Jalview - A Sequence Alignment Editor and Viewer\r
+* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+*\r
+* This program is free software; you can redistribute it and/or\r
+* modify it under the terms of the GNU General Public License\r
+* as published by the Free Software Foundation; either version 2\r
+* of the License, or (at your option) any later version.\r
+*\r
+* This program is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with this program; if not, write to the Free Software\r
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+*/\r
+\r
package jalview.gui;\r
\r
import jalview.jbgui.*;\r
import jalview.schemes.*;\r
+import jalview.io.*;\r
\r
import jalview.bin.Cache;\r
import javax.swing.*;\r
import java.awt.event.ActionEvent;\r
import java.awt.*;\r
\r
+\r
public class Preferences extends GPreferences\r
{\r
static boolean preferencesLoaded=false;\r
public static boolean showConservation=true;\r
public static boolean showQuality=true;\r
public static boolean showIdentity=true;\r
- public static String fontName;\r
- public static String fontSize;\r
- public static String fontStyle;\r
+ public static String fontName="SansSerif";\r
+ public static String fontSize="10";\r
+ public static String fontStyle=Font.PLAIN+"";\r
public static char gapSymbol='-';\r
public static String defaultColour=null;\r
+ public static boolean showStartupFile=true;\r
+ public static String startupFile = "http://www.jalview.org/examples/exampleFile.jar";\r
\r
JInternalFrame frame;\r
\r
if(string!=null)\r
showFullscreen = Boolean.valueOf(string).booleanValue();\r
\r
-\r
string = Cache.getProperty("SHOW_ANNOTATIONS");\r
if(string!=null)\r
showAnnotation = Boolean.valueOf(string).booleanValue();\r
if(string!=null)\r
showFullId = Boolean.valueOf(string).booleanValue();\r
\r
- fontName = Cache.getProperty("FONT_NAME");\r
- fontStyle = Cache.getProperty("FONT_STYLE");\r
- fontSize = Cache.getProperty("FONT_SIZE");\r
+ string = Cache.getProperty("FONT_NAME");\r
+ if (string != null)\r
+ fontName = string;\r
+\r
+ string = Cache.getProperty("FONT_STYLE");\r
+ if (string != null)\r
+ fontStyle = string;\r
+\r
+ string = Cache.getProperty("FONT_SIZE");\r
+ if (string != null)\r
+ fontSize = string;\r
+\r
\r
string = Cache.getProperty("DEFAULT_COLOUR");\r
if(string!=null)\r
defaultColour = string;\r
\r
+ string = Cache.getProperty("STARTUP_FILE");\r
+ if(string!=null)\r
+ startupFile = string;\r
+\r
+ string = Cache.getProperty("SHOW_STARTUP_FILE");\r
+ if(string!=null)\r
+ showStartupFile = Boolean.valueOf(string).booleanValue();\r
\r
preferencesLoaded = true;\r
}\r
\r
public Preferences()\r
{\r
- if(!preferencesLoaded)\r
- initPreferences();\r
+ initPreferences();\r
\r
frame = new JInternalFrame();\r
frame.setContentPane(this);\r
- Desktop.addInternalFrame(frame, "Preferences", 480,350 );\r
+ Desktop.addInternalFrame(frame, "Preferences", 480,390 );\r
\r
fullID.setSelected(showFullId);\r
String string = Cache.getProperty("SHOW_FULLSCREEN");\r
\r
gapSymbolCB.setSelectedItem( gapSymbol+"" );\r
\r
+ startupCheckbox.setSelected(showStartupFile);\r
+ startupFileTextfield.setText(startupFile);\r
+\r
}\r
\r
public void ok_actionPerformed(ActionEvent e)\r
fontName = fontNameCB.getSelectedItem().toString();\r
fontSize = fontSizeCB.getSelectedItem().toString();\r
fontStyle = fontStyleCB.getSelectedItem().toString();\r
+ startupFile = startupFileTextfield.getText();\r
+ showStartupFile = startupCheckbox.isSelected();\r
\r
Cache.setProperty("SHOW_FULL_ID", Boolean.toString(showFullId));\r
Cache.setProperty("SHOW_FULLSCREEN", Boolean.toString( showFullscreen ) );\r
Cache.setProperty("FONT_STYLE", fontStyle);\r
Cache.setProperty("FONT_SIZE", fontSize);\r
\r
+ Cache.setProperty("STARTUP_FILE", startupFile);\r
+ Cache.setProperty("SHOW_STARTUP_FILE", Boolean.toString(showStartupFile));\r
+\r
+\r
+\r
try {\r
frame.setClosed(true);\r
} catch (Exception ex) {}\r
\r
}\r
\r
+ public void startupFileTextfield_mouseClicked()\r
+ {\r
+ JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty("LAST_DIRECTORY"),\r
+ new String[]{"fa, fasta, fastq", "aln", "pfam", "msf", "pir","blc","jar"},\r
+ new String[]{"Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview"}\r
+ ,jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));\r
+ chooser.setFileView(new JalviewFileView());\r
+ chooser.setDialogTitle("Select startup file");\r
+ int value = chooser.showOpenDialog(this);\r
+ if(value == JalviewFileChooser.APPROVE_OPTION)\r
+ {\r
+ jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT", chooser.getSelectedFormat());\r
+ startupFileTextfield.setText( chooser.getSelectedFile().getAbsolutePath() );\r
+ }\r
+ }\r
+\r
+\r
public void cancel_actionPerformed(ActionEvent e)\r
{\r
try{\r