X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPreferences.java;h=cccdd2e2a0878b612f307c7cce6828e5a2c38b07;hb=refs%2Fheads%2Ffeature%2FJAL-2587;hp=c5bff31fa57fec733810f968ddc12d0ca8315147;hpb=a1bf90058be8be92554ecbc5868982dcdbed5a80;p=jalview.git diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index c5bff31..cccdd2e 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -29,7 +29,9 @@ import jalview.io.JalviewFileChooser; import jalview.io.JalviewFileView; import jalview.jbgui.GPreferences; import jalview.jbgui.GSequenceLink; -import jalview.schemes.ColourSchemeProperty; +import jalview.schemes.ColourSchemeI; +import jalview.schemes.ColourSchemes; +import jalview.schemes.ResidueColourScheme; import jalview.urls.UrlLinkTableModel; import jalview.urls.api.UrlProviderFactoryI; import jalview.urls.api.UrlProviderI; @@ -105,6 +107,8 @@ public class Preferences extends GPreferences public static final String SHOW_AUTOCALC_ABOVE = "SHOW_AUTOCALC_ABOVE"; + public static final String SHOW_OCCUPANCY = "SHOW_OCCUPANCY"; + private static final int MIN_FONT_SIZE = 1; private static final int MAX_FONT_SIZE = 30; @@ -208,6 +212,7 @@ public class Preferences extends GPreferences openoverv.setSelected(Cache.getDefault("SHOW_OVERVIEW", false)); showUnconserved .setSelected(Cache.getDefault("SHOW_UNCONSERVED", false)); + showOccupancy.setSelected(Cache.getDefault(SHOW_OCCUPANCY, false)); showGroupConsensus.setSelected(Cache.getDefault("SHOW_GROUP_CONSENSUS", false)); showGroupConservation.setSelected(Cache.getDefault( @@ -284,12 +289,16 @@ public class Preferences extends GPreferences /* * Set Colours tab defaults */ - for (int i = ColourSchemeProperty.FIRST_COLOUR; i <= ColourSchemeProperty.LAST_COLOUR; i++) + protColour.addItem(ResidueColourScheme.NONE); + nucColour.addItem(ResidueColourScheme.NONE); + for (ColourSchemeI cs : ColourSchemes.getInstance().getColourSchemes()) { - protColour.addItem(ColourSchemeProperty.getColourName(i)); - nucColour.addItem(ColourSchemeProperty.getColourName(i)); + String name = cs.getSchemeName(); + protColour.addItem(name); + nucColour.addItem(name); } - String oldProp = Cache.getDefault(DEFAULT_COLOUR, "None"); + String oldProp = Cache.getDefault(DEFAULT_COLOUR, + ResidueColourScheme.NONE); String newProp = Cache.getDefault(DEFAULT_COLOUR_PROT, null); protColour.setSelectedItem(newProp != null ? newProp : oldProp); newProp = Cache.getDefault(DEFAULT_COLOUR_NUC, null); @@ -459,8 +468,6 @@ public class Preferences extends GPreferences useProxy.setSelected(Cache.getDefault("USE_PROXY", false)); useProxy_actionPerformed(); // make sure useProxy is correctly initialised - proxyServerTB.setEnabled(useProxy.isSelected()); - proxyPortTB.setEnabled(useProxy.isSelected()); proxyServerTB.setText(Cache.getDefault("PROXY_SERVER", "")); proxyPortTB.setText(Cache.getDefault("PROXY_PORT", "")); @@ -568,6 +575,8 @@ public class Preferences extends GPreferences Boolean.toString(idItalics.isSelected())); Cache.applicationProperties.setProperty("SHOW_UNCONSERVED", Boolean.toString(showUnconserved.isSelected())); + Cache.applicationProperties.setProperty(SHOW_OCCUPANCY, + Boolean.toString(showOccupancy.isSelected())); Cache.applicationProperties.setProperty("SHOW_GROUP_CONSENSUS", Boolean.toString(showGroupConsensus.isSelected())); Cache.applicationProperties.setProperty("SHOW_GROUP_CONSERVATION", @@ -809,7 +818,7 @@ public class Preferences extends GPreferences if (format != null) { Cache.applicationProperties.setProperty("DEFAULT_FILE_FORMAT", - format.toString()); + format.getName()); } startupFileTextfield.setText(chooser.getSelectedFile() .getAbsolutePath()); @@ -847,6 +856,7 @@ public class Preferences extends GPreferences conservation.setEnabled(annotations.isSelected()); quality.setEnabled(annotations.isSelected()); identity.setEnabled(annotations.isSelected()); + showOccupancy.setEnabled(annotations.isSelected()); showGroupConsensus.setEnabled(annotations.isSelected()); showGroupConservation.setEnabled(annotations.isSelected()); showConsensHistogram.setEnabled(annotations.isSelected() @@ -902,8 +912,13 @@ public class Preferences extends GPreferences return; } - link.setName(linkUrlTable.getValueAt(index, 0).toString()); - link.setURL(linkUrlTable.getValueAt(index, 1).toString()); + int nameCol = ((UrlLinkTableModel) linkUrlTable.getModel()) + .getNameColumn(); + int urlCol = ((UrlLinkTableModel) linkUrlTable.getModel()) + .getUrlColumn(); + String oldName = linkUrlTable.getValueAt(index, nameCol).toString(); + link.setName(oldName); + link.setURL(linkUrlTable.getValueAt(index, urlCol).toString()); boolean valid = false; while (!valid) @@ -914,11 +929,12 @@ public class Preferences extends GPreferences { if (link.checkValid()) { - if (((UrlLinkTableModel) linkUrlTable.getModel()) - .isUniqueName(link.getName())) + if ((oldName.equals(link.getName())) + || (((UrlLinkTableModel) linkUrlTable.getModel()) + .isUniqueName(link.getName()))) { - linkUrlTable.setValueAt(link.getName(), index, 0); - linkUrlTable.setValueAt(link.getURL(), index, 1); + linkUrlTable.setValueAt(link.getName(), index, nameCol); + linkUrlTable.setValueAt(link.getURL(), index, urlCol); valid = true; } else