X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPreferences.java;h=c7e13324920417d097c6723c5881dbb1d6a964f9;hb=b44b99801b03025f1d769f20476bc90823d92499;hp=ee0316496a773b8b8470d66d1c7c79bc4214943a;hpb=ab43013b7e357b84b4abade0dba949668dfb2a0e;p=jalview.git diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index ee03164..c7e1332 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1) - * Copyright (C) 2014 The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * @@ -23,13 +23,14 @@ package jalview.gui; import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; import jalview.bin.Cache; import jalview.gui.Help.HelpId; -import jalview.gui.StructureViewer.Viewer; +import jalview.gui.StructureViewer.ViewerType; import jalview.io.JalviewFileChooser; import jalview.io.JalviewFileView; import jalview.jbgui.GPreferences; import jalview.jbgui.GSequenceLink; import jalview.schemes.ColourSchemeProperty; import jalview.util.MessageManager; +import jalview.ws.sifts.SiftsSettings; import java.awt.BorderLayout; import java.awt.Color; @@ -61,6 +62,15 @@ import ext.edu.ucsf.rbvi.strucviz2.StructureManager; */ public class Preferences extends GPreferences { + public static final String ENABLE_SPLIT_FRAME = "ENABLE_SPLIT_FRAME"; + + public static final String SCALE_PROTEIN_TO_CDNA = "SCALE_PROTEIN_TO_CDNA"; + + public static final String DEFAULT_COLOUR = "DEFAULT_COLOUR"; + + public static final String DEFAULT_COLOUR_PROT = "DEFAULT_COLOUR_PROT"; + + public static final String DEFAULT_COLOUR_NUC = "DEFAULT_COLOUR_NUC"; public static final String ADD_TEMPFACT_ANN = "ADD_TEMPFACT_ANN"; @@ -165,11 +175,11 @@ public class Preferences extends GPreferences dasTab.add(dasSource, BorderLayout.CENTER); wsPrefs = new WsPreferences(); wsTab.add(wsPrefs, BorderLayout.CENTER); - int width = 500, height = 420; + int width = 500, height = 450; if (new jalview.util.Platform().isAMac()) { width = 570; - height = 460; + height = 480; } Desktop.addInternalFrame(frame, @@ -225,6 +235,8 @@ public class Preferences extends GPreferences + "")); smoothFont.setSelected(Cache.getDefault("ANTI_ALIAS", false)); + scaleProteinToCdna.setSelected(Cache.getDefault(SCALE_PROTEIN_TO_CDNA, + false)); idItalics.setSelected(Cache.getDefault("ID_ITALICS", true)); @@ -252,8 +264,7 @@ public class Preferences extends GPreferences sortAutocalc.addItem("Autocalculated first"); sortAutocalc.addItem("Autocalculated last"); - final boolean showAbove = Cache.getDefault(SHOW_AUTOCALC_ABOVE, - true); + final boolean showAbove = Cache.getDefault(SHOW_AUTOCALC_ABOVE, true); sortAutocalc.setSelectedItem(showAbove ? sortAutocalc.getItemAt(0) : sortAutocalc.getItemAt(1)); startupCheckbox @@ -267,10 +278,14 @@ public class Preferences extends GPreferences */ for (int i = ColourSchemeProperty.FIRST_COLOUR; i <= ColourSchemeProperty.LAST_COLOUR; i++) { - colour.addItem(ColourSchemeProperty.getColourName(i)); + protColour.addItem(ColourSchemeProperty.getColourName(i)); + nucColour.addItem(ColourSchemeProperty.getColourName(i)); } - String string = Cache.getDefault("DEFAULT_COLOUR", "None"); - colour.setSelectedItem(string); + String oldProp = Cache.getDefault(DEFAULT_COLOUR, "None"); + String newProp = Cache.getDefault(DEFAULT_COLOUR_PROT, null); + protColour.setSelectedItem(newProp != null ? newProp : oldProp); + newProp = Cache.getDefault(DEFAULT_COLOUR_NUC, null); + nucColour.setSelectedItem(newProp != null ? newProp : oldProp); minColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN", Color.orange)); maxColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX", @@ -283,13 +298,12 @@ public class Preferences extends GPreferences structFromPdb.setSelected(structSelected); useRnaView.setSelected(Cache.getDefault(USE_RNAVIEW, false)); useRnaView.setEnabled(structSelected); - addSecondaryStructure - .setSelected(Cache.getDefault(ADD_SS_ANN, false)); + addSecondaryStructure.setSelected(Cache.getDefault(ADD_SS_ANN, false)); addSecondaryStructure.setEnabled(structSelected); addTempFactor.setSelected(Cache.getDefault(ADD_TEMPFACT_ANN, false)); addTempFactor.setEnabled(structSelected); structViewer.setSelectedItem(Cache.getDefault(STRUCTURE_DISPLAY, - Viewer.JMOL.name())); + ViewerType.JMOL.name())); chimeraPath.setText(Cache.getDefault(CHIMERA_PATH, "")); chimeraPath.addActionListener(new ActionListener() { @@ -300,6 +314,18 @@ public class Preferences extends GPreferences } }); + if (Cache.getDefault("MAP_WITH_SIFTS", false)) + { + siftsMapping.setSelected(true); + } + else + { + nwMapping.setSelected(true); + } + + SiftsSettings + .setMapWithSifts(Cache.getDefault("MAP_WITH_SIFTS", false)); + /* * Set Connections tab defaults */ @@ -338,8 +364,8 @@ public class Preferences extends GPreferences epsRendering.setSelectedItem(Cache.getDefault("EPS_RENDERING", "Prompt each time")); autoIdWidth.setSelected(Cache.getDefault("FIGURE_AUTOIDWIDTH", false)); - userIdWidth.setEnabled(autoIdWidth.isSelected()); - userIdWidthlabel.setEnabled(autoIdWidth.isSelected()); + userIdWidth.setEnabled(!autoIdWidth.isSelected()); + userIdWidthlabel.setEnabled(!autoIdWidth.isSelected()); Integer wi = Cache.getIntegerProperty("FIGURE_USERIDWIDTH"); userIdWidth.setText(wi == null ? "" : wi.toString()); blcjv.setSelected(Cache.getDefault("BLC_JVSUFFIX", true)); @@ -350,6 +376,8 @@ public class Preferences extends GPreferences pileupjv.setSelected(Cache.getDefault("PILEUP_JVSUFFIX", true)); pirjv.setSelected(Cache.getDefault("PIR_JVSUFFIX", true)); modellerOutput.setSelected(Cache.getDefault("PIR_MODELLER", false)); + embbedBioJSON.setSelected(Cache.getDefault("EXPORT_EMBBED_BIOJSON", + true)); /* * Set Editing tab defaults @@ -369,6 +397,7 @@ public class Preferences extends GPreferences * * @param e */ + @Override public void ok_actionPerformed(ActionEvent e) { if (!validateSettings()) @@ -420,6 +449,8 @@ public class Preferences extends GPreferences Boolean.toString(showConsensLogo.isSelected())); Cache.applicationProperties.setProperty("ANTI_ALIAS", Boolean.toString(smoothFont.isSelected())); + Cache.applicationProperties.setProperty(SCALE_PROTEIN_TO_CDNA, + Boolean.toString(scaleProteinToCdna.isSelected())); Cache.applicationProperties.setProperty("SHOW_NPFEATS_TOOLTIP", Boolean.toString(showNpTooltip.isSelected())); Cache.applicationProperties.setProperty("SHOW_DBREFS_TOOLTIP", @@ -446,13 +477,15 @@ public class Preferences extends GPreferences } final boolean showAutocalcFirst = sortAutocalc.getSelectedIndex() == 0; - Cache.applicationProperties.setProperty(SHOW_AUTOCALC_ABOVE, - Boolean.valueOf(showAutocalcFirst).toString()); + Cache.applicationProperties.setProperty(SHOW_AUTOCALC_ABOVE, Boolean + .valueOf(showAutocalcFirst).toString()); /* * Save Colours settings */ - Cache.applicationProperties.setProperty("DEFAULT_COLOUR", colour + Cache.applicationProperties.setProperty(DEFAULT_COLOUR_PROT, protColour + .getSelectedItem().toString()); + Cache.applicationProperties.setProperty(DEFAULT_COLOUR_NUC, nucColour .getSelectedItem().toString()); Cache.setColourProperty("ANNOTATIONCOLOUR_MIN", minColour.getBackground()); @@ -473,6 +506,9 @@ public class Preferences extends GPreferences Cache.applicationProperties.setProperty(STRUCTURE_DISPLAY, structViewer .getSelectedItem().toString()); Cache.setOrRemove(CHIMERA_PATH, chimeraPath.getText()); + Cache.applicationProperties.setProperty("MAP_WITH_SIFTS", + Boolean.toString(siftsMapping.isSelected())); + SiftsSettings.setMapWithSifts(siftsMapping.isSelected()); /* * Save Output settings @@ -570,6 +606,8 @@ public class Preferences extends GPreferences Boolean.toString(pirjv.isSelected())); Cache.applicationProperties.setProperty("PIR_MODELLER", Boolean.toString(modellerOutput.isSelected())); + Cache.applicationProperties.setProperty("EXPORT_EMBBED_BIOJSON", + Boolean.toString(embbedBioJSON.isSelected())); jalview.io.PIRFile.useModellerOutput = modellerOutput.isSelected(); Cache.applicationProperties.setProperty("FIGURE_AUTOIDWIDTH", @@ -622,20 +660,22 @@ public class Preferences extends GPreferences return validateChimeraPath(); } + /** * DOCUMENT ME! */ + @Override 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("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(MessageManager.getString("label.select_startup_file")); + chooser.setDialogTitle(MessageManager + .getString("label.select_startup_file")); int value = chooser.showOpenDialog(this); @@ -654,6 +694,7 @@ public class Preferences extends GPreferences * @param e * DOCUMENT ME! */ + @Override public void cancel_actionPerformed(ActionEvent e) { try @@ -672,6 +713,7 @@ public class Preferences extends GPreferences * @param e * DOCUMENT ME! */ + @Override public void annotations_actionPerformed(ActionEvent e) { conservation.setEnabled(annotations.isSelected()); @@ -685,6 +727,7 @@ public class Preferences extends GPreferences && (identity.isSelected() || showGroupConsensus.isSelected())); } + @Override public void newLink_actionPerformed(ActionEvent e) { @@ -711,6 +754,7 @@ public class Preferences extends GPreferences } } + @Override public void editLink_actionPerformed(ActionEvent e) { GSequenceLink link = new GSequenceLink(); @@ -752,6 +796,7 @@ public class Preferences extends GPreferences } } + @Override public void deleteLink_actionPerformed(ActionEvent e) { int index = linkNameList.getSelectedIndex(); @@ -774,10 +819,12 @@ public class Preferences extends GPreferences linkURLList.setListData(urlLinks); } + @Override public void defaultBrowser_mouseClicked(MouseEvent e) { JFileChooser chooser = new JFileChooser("."); - chooser.setDialogTitle(MessageManager.getString("label.select_default_browser")); + chooser.setDialogTitle(MessageManager + .getString("label.select_default_browser")); int value = chooser.showOpenDialog(this); @@ -795,6 +842,7 @@ public class Preferences extends GPreferences * jalview.jbgui.GPreferences#showunconserved_actionPerformed(java.awt.event * .ActionEvent) */ + @Override protected void showunconserved_actionPerformed(ActionEvent e) { // TODO Auto-generated method stub @@ -810,7 +858,8 @@ public class Preferences extends GPreferences public void minColour_actionPerformed(JPanel panel) { Color col = JColorChooser.showDialog(this, - MessageManager.getString("label.select_colour_minimum_value"), minColour.getBackground()); + MessageManager.getString("label.select_colour_minimum_value"), + minColour.getBackground()); if (col != null) { panel.setBackground(col); @@ -822,7 +871,8 @@ public class Preferences extends GPreferences public void maxColour_actionPerformed(JPanel panel) { Color col = JColorChooser.showDialog(this, - MessageManager.getString("label.select_colour_maximum_value"), maxColour.getBackground()); + MessageManager.getString("label.select_colour_maximum_value"), + maxColour.getBackground()); if (col != null) { panel.setBackground(col); @@ -847,12 +897,10 @@ public class Preferences extends GPreferences } } catch (NumberFormatException x) { - JOptionPane - .showInternalMessageDialog( - Desktop.desktop, - MessageManager.getString("warn.user_defined_width_requirements"), - MessageManager.getString("label.invalid_id_column_width"), - JOptionPane.WARNING_MESSAGE); + JOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager + .getString("warn.user_defined_width_requirements"), + MessageManager.getString("label.invalid_id_column_width"), + JOptionPane.WARNING_MESSAGE); userIdWidth.setText(""); } } @@ -892,7 +940,7 @@ public class Preferences extends GPreferences @Override protected void structureViewer_actionPerformed(String selectedItem) { - if (!selectedItem.equals(Viewer.CHIMERA.name())) + if (!selectedItem.equals(ViewerType.CHIMERA.name())) { return; } @@ -913,14 +961,13 @@ public class Preferences extends GPreferences } if (!found) { - String[] options = - { "OK", "Help" }; + String[] options = { "OK", "Help" }; int showHelp = JOptionPane.showInternalOptionDialog( Desktop.desktop, JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.chimera_missing")), - "", JOptionPane.YES_NO_OPTION, - JOptionPane.WARNING_MESSAGE, null, options, options[0]); + "", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, + null, options, options[0]); if (showHelp == JOptionPane.NO_OPTION) { try