JAL-3068 LineartOptions for EPS/HTML/SVG, new preferences, i18n task/JAL-3068lineartDialog
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 17 Jul 2018 15:44:24 +0000 (16:44 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 17 Jul 2018 15:44:24 +0000 (16:44 +0100)
resources/lang/Messages.properties
resources/lang/Messages_es.properties
src/jalview/gui/EPSOptions.java [deleted file]
src/jalview/gui/HTMLOptions.java [deleted file]
src/jalview/gui/LineartOptions.java [new file with mode: 0644]
src/jalview/gui/Preferences.java
src/jalview/gui/SVGOptions.java [deleted file]
src/jalview/gui/TreePanel.java
src/jalview/io/HtmlSvgOutput.java
src/jalview/jbgui/GPreferences.java
src/jalview/util/ImageMaker.java

index daf3d11..88f45d9 100644 (file)
@@ -363,7 +363,8 @@ label.open_saved_vamsas_session = Open a saved VAMSAS session
 label.groovy_console = Groovy Console...
 label.lineart = Lineart
 label.dont_ask_me_again = Don't ask me again
-label.select_eps_character_rendering_style = Select EPS character rendering style
+label.select_character_rendering_style = {0} character rendering style
+label.select_character_style_title = {0} Rendering options
 label.invert_selection = Invert Selection
 label.optimise_order = Optimise Order
 label.seq_sort_by_score = Sequence sort by Score
@@ -600,7 +601,7 @@ label.check_for_questionnaires = Check for questionnaires
 label.check_for_latest_version = Check for latest version
 label.url_linkfrom_sequence_id = URL link from Sequence ID
 label.use_proxy_server = Use a proxy server
-label.eps_rendering_style = EPS rendering style
+label.rendering_style = {0} rendering style
 label.append_start_end = Append /start-end (/15-380)
 label.full_sequence_id = Full Sequence Id
 label.smooth_font = Smooth Font
index b41c855..f92755d 100644 (file)
@@ -331,7 +331,8 @@ label.open_saved_vamsas_session = Abrir una sesi
 label.groovy_console = Consola Groovy 
 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.select_character_rendering_style = Estilo de visualización para carácter {0} 
+label.select_character_style_title = Opciones de visualización {0}
 label.invert_selection = Invertir selección
 label.optimise_order = Optimizar orden
 label.seq_sort_by_score = Ordenar las secuencias por puntuación
@@ -555,7 +556,7 @@ label.check_for_questionnaires = Comprobar los cuestionarios
 label.check_for_latest_version = Comprobar la última versión
 label.url_linkfrom_sequence_id = URL del enlace del ID de la secuencia
 label.use_proxy_server = Utilizar un servidor proxy
-label.eps_rendering_style = Estilo de visualización EPS
+label.rendering_style = Estilo de visualización {0}
 label.append_start_end = Añadir /inicio-fin (/15-380)
 label.full_sequence_id = ID de la secuencia completo
 label.smooth_font = Fuente alargada
diff --git a/src/jalview/gui/EPSOptions.java b/src/jalview/gui/EPSOptions.java
deleted file mode 100644 (file)
index d8f0d9a..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
- * 
- * This file is part of Jalview.
- * 
- * Jalview 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 3
- * of the License, or (at your option) any later version.
- *  
- * Jalview 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 Jalview.  If not, see <http://www.gnu.org/licenses/>.
- * The Jalview Authors are detailed in the 'AUTHORS' file.
- */
-package jalview.gui;
-
-import jalview.util.MessageManager;
-
-import java.awt.BorderLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.BorderFactory;
-import javax.swing.ButtonGroup;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JRadioButton;
-
-public class EPSOptions extends JPanel
-{
-  JDialog dialog;
-
-  public boolean cancelled = false;
-
-  String value;
-
-  public EPSOptions()
-  {
-    try
-    {
-      jbInit();
-    } catch (Exception ex)
-    {
-      ex.printStackTrace();
-    }
-
-    ButtonGroup bg = new ButtonGroup();
-    bg.add(lineart);
-    bg.add(text);
-
-    JOptionPane pane = new JOptionPane(null, JvOptionPane.DEFAULT_OPTION,
-            JvOptionPane.DEFAULT_OPTION, null, new Object[]
-            { this });
-
-    dialog = pane.createDialog(Desktop.desktop, "EPS Rendering options");
-    dialog.setVisible(true);
-
-  }
-
-  private void jbInit() throws Exception
-  {
-    lineart.setFont(JvSwingUtils.getLabelFont());
-    lineart.setText(MessageManager.getString("label.lineart"));
-    text.setFont(JvSwingUtils.getLabelFont());
-    text.setText(MessageManager.getString("action.text"));
-    text.setSelected(true);
-    askAgain.setFont(JvSwingUtils.getLabelFont());
-    askAgain.setText(MessageManager.getString("label.dont_ask_me_again"));
-    ok.setText(MessageManager.getString("action.ok"));
-    ok.addActionListener(new ActionListener()
-    {
-      @Override
-      public void actionPerformed(ActionEvent e)
-      {
-        ok_actionPerformed(e);
-      }
-    });
-    cancel.setText(MessageManager.getString("action.cancel"));
-    cancel.addActionListener(new ActionListener()
-    {
-      @Override
-      public void actionPerformed(ActionEvent e)
-      {
-        cancel_actionPerformed(e);
-      }
-    });
-    jLabel1.setFont(JvSwingUtils.getLabelFont());
-    jLabel1.setText(MessageManager
-            .getString("label.select_eps_character_rendering_style"));
-    this.setLayout(borderLayout1);
-    jPanel3.setBorder(BorderFactory.createEtchedBorder());
-    jPanel2.add(text);
-    jPanel2.add(lineart);
-    jPanel2.add(askAgain);
-    jPanel1.add(ok);
-    jPanel1.add(cancel);
-    jPanel3.add(jLabel1);
-    jPanel3.add(jPanel2);
-    this.add(jPanel3, java.awt.BorderLayout.CENTER);
-    this.add(jPanel1, java.awt.BorderLayout.SOUTH);
-  }
-
-  JRadioButton lineart = new JRadioButton();
-
-  JRadioButton text = new JRadioButton();
-
-  JCheckBox askAgain = new JCheckBox();
-
-  JButton ok = new JButton();
-
-  JButton cancel = new JButton();
-
-  JPanel jPanel1 = new JPanel();
-
-  JLabel jLabel1 = new JLabel();
-
-  JPanel jPanel2 = new JPanel();
-
-  JPanel jPanel3 = new JPanel();
-
-  BorderLayout borderLayout1 = new BorderLayout();
-
-  public void ok_actionPerformed(ActionEvent e)
-  {
-    if (lineart.isSelected())
-    {
-      value = "Lineart";
-    }
-    else
-    {
-      value = "Text";
-    }
-
-    if (!askAgain.isSelected())
-    {
-      jalview.bin.Cache.applicationProperties.remove("EPS_RENDERING");
-    }
-    else
-    {
-      jalview.bin.Cache.setProperty("EPS_RENDERING", value);
-    }
-
-    dialog.setVisible(false);
-  }
-
-  public void cancel_actionPerformed(ActionEvent e)
-  {
-    cancelled = true;
-    dialog.setVisible(false);
-  }
-
-  public String getValue()
-  {
-    return value;
-  }
-}
diff --git a/src/jalview/gui/HTMLOptions.java b/src/jalview/gui/HTMLOptions.java
deleted file mode 100644 (file)
index 9e0f712..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
- * 
- * This file is part of Jalview.
- * 
- * Jalview 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 3
- * of the License, or (at your option) any later version.
- *  
- * Jalview 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 Jalview.  If not, see <http://www.gnu.org/licenses/>.
- * The Jalview Authors are detailed in the 'AUTHORS' file.
- */
-package jalview.gui;
-
-import jalview.util.MessageManager;
-
-import java.awt.BorderLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.BorderFactory;
-import javax.swing.ButtonGroup;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JRadioButton;
-
-public class HTMLOptions extends JPanel
-{
-  JDialog dialog;
-
-  public boolean cancelled = false;
-
-  String value;
-
-  public HTMLOptions()
-  {
-    try
-    {
-      jbInit();
-    } catch (Exception ex)
-    {
-      ex.printStackTrace();
-    }
-
-    ButtonGroup bg = new ButtonGroup();
-    bg.add(lineart);
-    bg.add(text);
-
-    JOptionPane pane = new JOptionPane(null, JvOptionPane.DEFAULT_OPTION,
-            JvOptionPane.DEFAULT_OPTION, null, new Object[]
-            { this });
-
-    dialog = pane.createDialog(Desktop.desktop, "HTML Rendering options");
-    dialog.setVisible(true);
-
-  }
-
-  private void jbInit() throws Exception
-  {
-    lineart.setFont(JvSwingUtils.getLabelFont());
-    lineart.setText(MessageManager.getString("label.lineart"));
-    text.setFont(JvSwingUtils.getLabelFont());
-    text.setText(MessageManager.getString("action.text"));
-    text.setSelected(true);
-    askAgain.setFont(JvSwingUtils.getLabelFont());
-    askAgain.setText(MessageManager.getString("label.dont_ask_me_again"));
-    ok.setText(MessageManager.getString("action.ok"));
-    ok.addActionListener(new ActionListener()
-    {
-      @Override
-      public void actionPerformed(ActionEvent e)
-      {
-        ok_actionPerformed(e);
-      }
-    });
-    cancel.setText(MessageManager.getString("action.cancel"));
-    cancel.addActionListener(new ActionListener()
-    {
-      @Override
-      public void actionPerformed(ActionEvent e)
-      {
-        cancel_actionPerformed(e);
-      }
-    });
-    jLabel1.setFont(JvSwingUtils.getLabelFont());
-    jLabel1.setText("Select HTML character rendering style");
-    this.setLayout(borderLayout1);
-    jPanel3.setBorder(BorderFactory.createEtchedBorder());
-    jPanel2.add(text);
-    jPanel2.add(lineart);
-    jPanel2.add(askAgain);
-    jPanel1.add(ok);
-    jPanel1.add(cancel);
-    jPanel3.add(jLabel1);
-    jPanel3.add(jPanel2);
-    this.add(jPanel3, java.awt.BorderLayout.CENTER);
-    this.add(jPanel1, java.awt.BorderLayout.SOUTH);
-  }
-
-  JRadioButton lineart = new JRadioButton();
-
-  JRadioButton text = new JRadioButton();
-
-  JCheckBox askAgain = new JCheckBox();
-
-  JButton ok = new JButton();
-
-  JButton cancel = new JButton();
-
-  JPanel jPanel1 = new JPanel();
-
-  JLabel jLabel1 = new JLabel();
-
-  JPanel jPanel2 = new JPanel();
-
-  JPanel jPanel3 = new JPanel();
-
-  BorderLayout borderLayout1 = new BorderLayout();
-
-  public void ok_actionPerformed(ActionEvent e)
-  {
-    if (lineart.isSelected())
-    {
-      value = "Lineart";
-    }
-    else
-    {
-      value = "Text";
-    }
-
-    if (!askAgain.isSelected())
-    {
-      jalview.bin.Cache.applicationProperties.remove("HTML_RENDERING");
-    }
-    else
-    {
-      jalview.bin.Cache.setProperty("HTML_RENDERING", value);
-    }
-
-    dialog.setVisible(false);
-  }
-
-  public void cancel_actionPerformed(ActionEvent e)
-  {
-    cancelled = true;
-    dialog.setVisible(false);
-  }
-
-  public String getValue()
-  {
-    return value;
-  }
-}
diff --git a/src/jalview/gui/LineartOptions.java b/src/jalview/gui/LineartOptions.java
new file mode 100644 (file)
index 0000000..1fded80
--- /dev/null
@@ -0,0 +1,188 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * 
+ * This file is part of Jalview.
+ * 
+ * Jalview 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 3
+ * of the License, or (at your option) any later version.
+ *  
+ * Jalview 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 Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import jalview.bin.Cache;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+
+/**
+ * A dialog where the user may choose Text or Lineart rendering, and optionally
+ * save this as a preference
+ */
+public class LineartOptions extends JPanel
+{
+  JDialog dialog;
+
+  public boolean cancelled = false;
+
+  String value;
+
+  JRadioButton lineartRB;
+
+  JCheckBox askAgainCB = new JCheckBox();
+
+  /**
+   * Constructor
+   * 
+   * @param preferencesKey
+   *          the key under which the choice is saved as a user preference, if
+   *          'Don't ask me again' is selected
+   * @param formatType
+   */
+  public LineartOptions(String preferencesKey, String formatType)
+  {
+    try
+    {
+      jbInit(preferencesKey, formatType);
+    } catch (Exception ex)
+    {
+      ex.printStackTrace();
+    }
+
+    JOptionPane pane = new JOptionPane(null, JvOptionPane.DEFAULT_OPTION,
+            JvOptionPane.DEFAULT_OPTION, null, new Object[]
+            { this });
+
+    String theTitle = MessageManager.formatMessage(
+            "label.select_character_style_title", formatType);
+    dialog = pane.createDialog(Desktop.desktop, theTitle);
+    dialog.setVisible(true);
+  }
+
+  private void jbInit(String preferencesKey, String formatType)
+          throws Exception
+  {
+    lineartRB = new JRadioButton(MessageManager.getString("label.lineart"));
+    lineartRB.setFont(JvSwingUtils.getLabelFont());
+    JRadioButton text = new JRadioButton(
+            MessageManager.getString("action.text"));
+    text.setFont(JvSwingUtils.getLabelFont());
+    text.setSelected(true);
+
+    ButtonGroup bg = new ButtonGroup();
+    bg.add(lineartRB);
+    bg.add(text);
+
+    askAgainCB.setFont(JvSwingUtils.getLabelFont());
+    askAgainCB.setText(MessageManager.getString("label.dont_ask_me_again"));
+    JButton ok = new JButton(MessageManager.getString("action.ok"));
+    ok.addActionListener(new ActionListener()
+    {
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        ok_actionPerformed(preferencesKey);
+      }
+    });
+    JButton cancel = new JButton(MessageManager.getString("action.cancel"));
+    cancel.addActionListener(new ActionListener()
+    {
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        cancel_actionPerformed(e);
+      }
+    });
+    JLabel jLabel1 = new JLabel(MessageManager.formatMessage(
+            "label.select_character_rendering_style", formatType));
+    jLabel1.setFont(JvSwingUtils.getLabelFont());
+
+    this.setLayout(new BorderLayout());
+    JPanel jPanel3 = new JPanel();
+    jPanel3.setBorder(BorderFactory.createEtchedBorder());
+    JPanel optionsPanel = new JPanel();
+    optionsPanel.add(text);
+    optionsPanel.add(lineartRB);
+    optionsPanel.add(askAgainCB);
+    JPanel okCancelPanel = new JPanel();
+    okCancelPanel.add(ok);
+    okCancelPanel.add(cancel);
+    jPanel3.add(jLabel1);
+    jPanel3.add(optionsPanel);
+    this.add(jPanel3, BorderLayout.CENTER);
+    this.add(okCancelPanel, BorderLayout.SOUTH);
+  }
+
+  /**
+   * Action on OK is to save the selected option as the <code>value</code> field
+   * and close the dialog. If "Don't ask me again" is selected, it is also saved
+   * as user preference, otherwise the existing user preference (if any) is
+   * removed.
+   * 
+   * @param preferencesKey
+   */
+  protected void ok_actionPerformed(String preferencesKey)
+  {
+    if (lineartRB.isSelected())
+    {
+      value = "Lineart";
+    }
+    else
+    {
+      value = "Text";
+    }
+
+    if (!askAgainCB.isSelected())
+    {
+      Cache.applicationProperties.remove(preferencesKey);
+    }
+    else
+    {
+      Cache.setProperty(preferencesKey, value);
+    }
+    dialog.setVisible(false);
+  }
+
+  /**
+   * Action on Cancel is to hide the dialog
+   * 
+   * @param e
+   */
+  protected void cancel_actionPerformed(ActionEvent e)
+  {
+    cancelled = true;
+    dialog.setVisible(false);
+  }
+
+  /**
+   * Answers "Lineart" or "Text" as selected by the user.
+   * 
+   * @return
+   */
+  public String getValue()
+  {
+    return value;
+  }
+}
index 92854ad..31842e4 100755 (executable)
@@ -54,6 +54,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import javax.help.HelpSetException;
+import javax.swing.JComboBox;
 import javax.swing.JFileChooser;
 import javax.swing.JInternalFrame;
 import javax.swing.JPanel;
@@ -501,23 +502,9 @@ public class Preferences extends GPreferences
     /*
      * Set Output tab defaults
      */
-    epsRendering.addItem(promptEachTimeOpt);
-    epsRendering.addItem(lineArtOpt);
-    epsRendering.addItem(textOpt);
-    String defaultEPS = Cache.getDefault("EPS_RENDERING",
-            "Prompt each time");
-    if (defaultEPS.equalsIgnoreCase("Text"))
-    {
-      epsRendering.setSelectedItem(textOpt);
-    }
-    else if (defaultEPS.equalsIgnoreCase("Lineart"))
-    {
-      epsRendering.setSelectedItem(lineArtOpt);
-    }
-    else
-    {
-      epsRendering.setSelectedItem(promptEachTimeOpt);
-    }
+    setupOutputCombo(epsRendering, "EPS_RENDERING");
+    setupOutputCombo(htmlRendering, "HTML_RENDERING");
+    setupOutputCombo(svgRendering, "SVG_RENDERING");
     autoIdWidth.setSelected(Cache.getDefault("FIGURE_AUTOIDWIDTH", false));
     userIdWidth.setEnabled(!autoIdWidth.isSelected());
     userIdWidthlabel.setEnabled(!autoIdWidth.isSelected());
@@ -549,6 +536,35 @@ public class Preferences extends GPreferences
   }
 
   /**
+   * A helper method that sets the items and initial selection in a character
+   * rendering option list (Prompt each time/Lineart/Text)
+   * 
+   * @param comboBox
+   * @param propertyKey
+   */
+  protected void setupOutputCombo(JComboBox<Object> comboBox,
+          String propertyKey)
+  {
+    comboBox.addItem(promptEachTimeOpt);
+    comboBox.addItem(lineArtOpt);
+    comboBox.addItem(textOpt);
+    String defaultOption = Cache.getDefault(propertyKey,
+            "Prompt each time");
+    if (defaultOption.equalsIgnoreCase("Text"))
+    {
+      comboBox.setSelectedItem(textOpt);
+    }
+    else if (defaultOption.equalsIgnoreCase("Lineart"))
+    {
+      comboBox.setSelectedItem(lineArtOpt);
+    }
+    else
+    {
+      comboBox.setSelectedItem(promptEachTimeOpt);
+    }
+  }
+
+  /**
    * Save user selections on the Preferences tabs to the Cache and write out to
    * file.
    * 
@@ -684,6 +700,10 @@ public class Preferences extends GPreferences
      */
     Cache.applicationProperties.setProperty("EPS_RENDERING",
             ((OptionsParam) epsRendering.getSelectedItem()).getCode());
+    Cache.applicationProperties.setProperty("HTML_RENDERING",
+            ((OptionsParam) htmlRendering.getSelectedItem()).getCode());
+    Cache.applicationProperties.setProperty("SVG_RENDERING",
+            ((OptionsParam) svgRendering.getSelectedItem()).getCode());
 
     /*
      * Save Connections settings
diff --git a/src/jalview/gui/SVGOptions.java b/src/jalview/gui/SVGOptions.java
deleted file mode 100644 (file)
index e3d03a4..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
- * 
- * This file is part of Jalview.
- * 
- * Jalview 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 3
- * of the License, or (at your option) any later version.
- *  
- * Jalview 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 Jalview.  If not, see <http://www.gnu.org/licenses/>.
- * The Jalview Authors are detailed in the 'AUTHORS' file.
- */
-package jalview.gui;
-
-import jalview.util.MessageManager;
-
-import java.awt.BorderLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.BorderFactory;
-import javax.swing.ButtonGroup;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JRadioButton;
-
-public class SVGOptions extends JPanel
-{
-  JDialog dialog;
-
-  public boolean cancelled = false;
-
-  String value;
-
-  public SVGOptions()
-  {
-    try
-    {
-      jbInit();
-    } catch (Exception ex)
-    {
-      ex.printStackTrace();
-    }
-
-    ButtonGroup bg = new ButtonGroup();
-    bg.add(lineart);
-    bg.add(text);
-
-    JOptionPane pane = new JOptionPane(null, JvOptionPane.DEFAULT_OPTION,
-            JvOptionPane.DEFAULT_OPTION, null, new Object[]
-            { this });
-
-    dialog = pane.createDialog(Desktop.desktop, "SVG Rendering options");
-    dialog.setVisible(true);
-
-  }
-
-  private void jbInit() throws Exception
-  {
-    lineart.setFont(JvSwingUtils.getLabelFont());
-    lineart.setText(MessageManager.getString("label.lineart"));
-    text.setFont(JvSwingUtils.getLabelFont());
-    text.setText(MessageManager.getString("action.text"));
-    text.setSelected(true);
-    askAgain.setFont(JvSwingUtils.getLabelFont());
-    askAgain.setText(MessageManager.getString("label.dont_ask_me_again"));
-    ok.setText(MessageManager.getString("action.ok"));
-    ok.addActionListener(new ActionListener()
-    {
-      @Override
-      public void actionPerformed(ActionEvent e)
-      {
-        ok_actionPerformed(e);
-      }
-    });
-    cancel.setText(MessageManager.getString("action.cancel"));
-    cancel.addActionListener(new ActionListener()
-    {
-      @Override
-      public void actionPerformed(ActionEvent e)
-      {
-        cancel_actionPerformed(e);
-      }
-    });
-    jLabel1.setFont(JvSwingUtils.getLabelFont());
-    jLabel1.setText("Select SVG character rendering style");
-    this.setLayout(borderLayout1);
-    jPanel3.setBorder(BorderFactory.createEtchedBorder());
-    jPanel2.add(text);
-    jPanel2.add(lineart);
-    jPanel2.add(askAgain);
-    jPanel1.add(ok);
-    jPanel1.add(cancel);
-    jPanel3.add(jLabel1);
-    jPanel3.add(jPanel2);
-    this.add(jPanel3, java.awt.BorderLayout.CENTER);
-    this.add(jPanel1, java.awt.BorderLayout.SOUTH);
-  }
-
-  JRadioButton lineart = new JRadioButton();
-
-  JRadioButton text = new JRadioButton();
-
-  JCheckBox askAgain = new JCheckBox();
-
-  JButton ok = new JButton();
-
-  JButton cancel = new JButton();
-
-  JPanel jPanel1 = new JPanel();
-
-  JLabel jLabel1 = new JLabel();
-
-  JPanel jPanel2 = new JPanel();
-
-  JPanel jPanel3 = new JPanel();
-
-  BorderLayout borderLayout1 = new BorderLayout();
-
-  public void ok_actionPerformed(ActionEvent e)
-  {
-    if (lineart.isSelected())
-    {
-      value = "Lineart";
-    }
-    else
-    {
-      value = "Text";
-    }
-
-    if (!askAgain.isSelected())
-    {
-      jalview.bin.Cache.applicationProperties.remove("SVG_RENDERING");
-    }
-    else
-    {
-      jalview.bin.Cache.setProperty("SVG_RENDERING", value);
-    }
-
-    dialog.setVisible(false);
-  }
-
-  public void cancel_actionPerformed(ActionEvent e)
-  {
-    cancelled = true;
-    dialog.setVisible(false);
-  }
-
-  public String getValue()
-  {
-    return value;
-  }
-}
index 5795a9f..eb2397c 100755 (executable)
@@ -677,7 +677,7 @@ public class TreePanel extends GTreePanel
             && !(System.getProperty("java.awt.headless") != null && System
                     .getProperty("java.awt.headless").equals("true")))
     {
-      EPSOptions eps = new EPSOptions();
+      LineartOptions eps = new LineartOptions("EPS_RENDERING", "EPS");
       renderStyle = eps.getValue();
 
       if (renderStyle == null || eps.cancelled)
index 948578a..a184185 100644 (file)
@@ -22,7 +22,7 @@ package jalview.io;
 
 import jalview.exceptions.NoFileSelectedException;
 import jalview.gui.AlignmentPanel;
-import jalview.gui.HTMLOptions;
+import jalview.gui.LineartOptions;
 import jalview.gui.OOMWarning;
 import jalview.math.AlignmentDimension;
 import jalview.util.MessageManager;
@@ -251,7 +251,8 @@ public class HtmlSvgOutput extends HTMLOutput
       // Prompt for rendering style
       if (renderStyle.equalsIgnoreCase("Prompt each time") && !isHeadless())
       {
-        HTMLOptions svgOption = new HTMLOptions();
+        LineartOptions svgOption = new LineartOptions("HTML_RENDERING",
+                "HTML");
         renderStyle = svgOption.getValue();
 
         if (renderStyle == null || svgOption.cancelled)
index 327cdc5..5ac592b 100755 (executable)
@@ -231,6 +231,10 @@ public class GPreferences extends JPanel
    */
   protected JComboBox<Object> epsRendering = new JComboBox<>();
 
+  protected JComboBox<Object> htmlRendering = new JComboBox<>();
+
+  protected JComboBox<Object> svgRendering = new JComboBox<>();
+
   protected JLabel userIdWidthlabel = new JLabel();
 
   protected JCheckBox autoIdWidth = new JCheckBox();
@@ -383,7 +387,7 @@ public class GPreferences extends JPanel
   }
 
   /**
-   * Initialises the Output tabbed panel.
+   * Initialises the Output tab
    * 
    * @return
    */
@@ -391,18 +395,35 @@ public class GPreferences extends JPanel
   {
     JPanel outputTab = new JPanel();
     outputTab.setLayout(null);
-    JLabel epsLabel = new JLabel();
+
+    JLabel epsLabel = new JLabel(
+            MessageManager.formatMessage("label.rendering_style", "EPS"));
     epsLabel.setFont(LABEL_FONT);
     epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
-    epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
-    epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
+    epsLabel.setBounds(new Rectangle(9, 31, 160, 24));
     epsRendering.setFont(LABEL_FONT);
-    epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
+    epsRendering.setBounds(new Rectangle(174, 34, 187, 21));
+    JLabel htmlLabel = new JLabel(
+            MessageManager.formatMessage("label.rendering_style", "HTML"));
+    htmlLabel.setFont(LABEL_FONT);
+    htmlLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+    htmlLabel.setBounds(new Rectangle(9, 55, 160, 24));
+    htmlRendering.setFont(LABEL_FONT);
+    htmlRendering.setBounds(new Rectangle(174, 58, 187, 21));
+    JLabel svgLabel = new JLabel(
+            MessageManager.formatMessage("label.rendering_style", "SVG"));
+    svgLabel.setFont(LABEL_FONT);
+    svgLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+    svgLabel.setBounds(new Rectangle(9, 79, 160, 24));
+    svgRendering.setFont(LABEL_FONT);
+    svgRendering.setBounds(new Rectangle(174, 82, 187, 21));
+
     JLabel jLabel1 = new JLabel();
     jLabel1.setFont(LABEL_FONT);
     jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
     jLabel1.setText(MessageManager.getString("label.append_start_end"));
     jLabel1.setFont(LABEL_FONT);
+
     fastajv.setFont(LABEL_FONT);
     fastajv.setHorizontalAlignment(SwingConstants.LEFT);
     clustaljv.setText(MessageManager.getString("label.clustal") + "     ");
@@ -419,7 +440,7 @@ public class GPreferences extends JPanel
     TitledBorder titledBorder2 = new TitledBorder(
             MessageManager.getString("label.file_output"));
     jPanel11.setBorder(titledBorder2);
-    jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
+    jPanel11.setBounds(new Rectangle(30, 120, 196, 182));
     GridLayout gridLayout3 = new GridLayout();
     jPanel11.setLayout(gridLayout3);
     gridLayout3.setRows(8);
@@ -438,7 +459,7 @@ public class GPreferences extends JPanel
             MessageManager.getString("label.automatically_set_id_width"));
     autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
             .getString("label.adjusts_width_generated_eps_png")));
-    autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
+    autoIdWidth.setBounds(new Rectangle(228, 144, 320, 23));
     autoIdWidth.addActionListener(new ActionListener()
     {
 
@@ -456,10 +477,10 @@ public class GPreferences extends JPanel
     userIdWidthlabel.setToolTipText(
             JvSwingUtils.wrapTooltip(true, MessageManager.getString(
                     "label.manually_specify_width_left_column")));
-    userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
+    userIdWidthlabel.setBounds(new Rectangle(236, 168, 320, 23));
     userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
     userIdWidth.setText("");
-    userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
+    userIdWidth.setBounds(new Rectangle(232, 192, 84, 23));
     userIdWidth.addActionListener(new ActionListener()
     {
 
@@ -472,10 +493,10 @@ public class GPreferences extends JPanel
     modellerOutput.setFont(LABEL_FONT);
     modellerOutput
             .setText(MessageManager.getString("label.use_modeller_output"));
-    modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
+    modellerOutput.setBounds(new Rectangle(228, 274, 320, 23));
     embbedBioJSON.setFont(LABEL_FONT);
     embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
-    embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
+    embbedBioJSON.setBounds(new Rectangle(228, 248, 250, 23));
 
     jPanel11.add(jLabel1);
     jPanel11.add(blcjv);
@@ -492,6 +513,10 @@ public class GPreferences extends JPanel
     outputTab.add(embbedBioJSON);
     outputTab.add(epsLabel);
     outputTab.add(epsRendering);
+    outputTab.add(htmlLabel);
+    outputTab.add(htmlRendering);
+    outputTab.add(svgLabel);
+    outputTab.add(svgRendering);
     outputTab.add(jPanel11);
     return outputTab;
   }
index cf5a6b6..284b7be 100755 (executable)
@@ -21,9 +21,8 @@
 package jalview.util;
 
 import jalview.bin.Jalview;
-import jalview.gui.EPSOptions;
 import jalview.gui.IProgressIndicator;
-import jalview.gui.SVGOptions;
+import jalview.gui.LineartOptions;
 import jalview.io.JalviewFileChooser;
 
 import java.awt.Component;
@@ -224,7 +223,7 @@ public class ImageMaker
             && !(System.getProperty("java.awt.headless") != null && System
                     .getProperty("java.awt.headless").equals("true")))
     {
-      EPSOptions eps = new EPSOptions();
+      LineartOptions eps = new LineartOptions("EPS_RENDERING", "EPS");
       renderStyle = eps.getValue();
 
       if (renderStyle == null || eps.cancelled)
@@ -284,7 +283,7 @@ public class ImageMaker
             && !(System.getProperty("java.awt.headless") != null && System
                     .getProperty("java.awt.headless").equals("true")))
     {
-      SVGOptions svgOption = new SVGOptions();
+      LineartOptions svgOption = new LineartOptions("SVG_RENDERING", "SVG");
       renderStyle = svgOption.getValue();
 
       if (renderStyle == null || svgOption.cancelled)