From: tcofoegbu Date: Thu, 26 May 2016 17:18:59 +0000 (+0100) Subject: JAL-1911 improvement to bugfix - do not save i18n text in preference file X-Git-Tag: Release_2_10_0~213 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=4545f574a1239ddd27d754f2bafbc3efb4d8bbfa;p=jalview.git JAL-1911 improvement to bugfix - do not save i18n text in preference file --- diff --git a/resources/lang/Messages_es.properties b/resources/lang/Messages_es.properties index 8943860..b3da568 100644 --- a/resources/lang/Messages_es.properties +++ b/resources/lang/Messages_es.properties @@ -321,7 +321,7 @@ action.save_vamsas_session = Guardar Sesi label.select_vamsas_session_opened_as_new_vamsas_session= Selecciones una sesión vamsas para abrirla como una nueva sesión. label.open_saved_vamsas_session = Abrir una sesión VAMSAS guardada label.groovy_console = Consola Groovy -label.lineart = lineart +label.lineart = Lineart label.dont_ask_me_again = No volver a preguntar label.select_eps_character_rendering_style = Seleccionar el carácter EPS como estilo de visualización label.invert_selection = Invertir selección diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index ea090a3..84baa1c 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -359,12 +359,29 @@ public class Preferences extends GPreferences /* * Set Output tab defaults */ - epsRendering -.addItem("Prompt each time"); - epsRendering.addItem(MessageManager.getString("label.lineart")); - epsRendering.addItem(MessageManager.getString("action.text")); - epsRendering.setSelectedItem(Cache.getDefault("EPS_RENDERING", - "Prompt each time")); + epsRendering.addItem(new OptionsParam(MessageManager + .getString("label.prompt_each_time"), "Prompt each time")); + epsRendering.addItem(new OptionsParam(MessageManager + .getString("label.lineart"), "Lineart")); + epsRendering.addItem(new OptionsParam(MessageManager + .getString("action.text"), "Text")); + String defaultEPS = Cache.getDefault("EPS_RENDERING", + "Prompt each time"); + if (defaultEPS.equalsIgnoreCase("Text")) + { + epsRendering.setSelectedItem(new OptionsParam(MessageManager + .getString("action.text"), "Text")); + } + else if (defaultEPS.equalsIgnoreCase("Lineart")) + { + epsRendering.setSelectedItem(new OptionsParam(MessageManager + .getString("label.lineart"), "Lineart")); + } + else + { + epsRendering.setSelectedItem(new OptionsParam(MessageManager + .getString("label.prompt_each_time"), "Prompt each time")); + } autoIdWidth.setSelected(Cache.getDefault("FIGURE_AUTOIDWIDTH", false)); userIdWidth.setEnabled(!autoIdWidth.isSelected()); userIdWidthlabel.setEnabled(!autoIdWidth.isSelected()); @@ -521,8 +538,8 @@ public class Preferences extends GPreferences } else { - Cache.applicationProperties.setProperty("EPS_RENDERING", epsRendering - .getSelectedItem().toString()); + Cache.applicationProperties.setProperty("EPS_RENDERING", + ((OptionsParam) epsRendering.getSelectedItem()).getCode()); } /* @@ -983,4 +1000,57 @@ public class Preferences extends GPreferences } } + public class OptionsParam + { + private String name; + + private String code; + + public OptionsParam(String name, String code) + { + this.name = name; + this.code = code; + } + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public String getCode() + { + return code; + } + + public void setCode(String code) + { + this.code = code; + } + + @Override + public String toString() + { + return name; + } + + @Override + public boolean equals(Object that) + { + if (!(that instanceof OptionsParam)) + { + return false; + } + return this.code.equalsIgnoreCase(((OptionsParam) that).code); + } + + @Override + public int hashCode(){ + return name.hashCode() + code.hashCode(); + } + } } diff --git a/src/jalview/gui/TreePanel.java b/src/jalview/gui/TreePanel.java index ae73baa..d78350d 100755 --- a/src/jalview/gui/TreePanel.java +++ b/src/jalview/gui/TreePanel.java @@ -723,8 +723,7 @@ public class TreePanel extends GTreePanel // If we need to prompt, and if the GUI is visible then // Prompt for EPS rendering style - if (renderStyle.equalsIgnoreCase(MessageManager - .getString("label.prompt_each_time")) + if (renderStyle.equalsIgnoreCase("Prompt each time") && !(System.getProperty("java.awt.headless") != null && System .getProperty("java.awt.headless").equals("true"))) { diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index c4c737c..25727d0 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -201,7 +201,7 @@ public class GPreferences extends JPanel /* * Output tab components */ - protected JComboBox epsRendering = new JComboBox(); + protected JComboBox epsRendering = new JComboBox(); protected JLabel userIdWidthlabel = new JLabel();