X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FLineartOptions.java;h=8a530acf390e6b1ca324883e54fece85f53cc627;hb=12098b3de3f7a7858cdf50bbcc51a2afc7568e76;hp=1dd030ba7374861a84b7c620e55fca933eafec06;hpb=fe8a4b9cb2b7242c902259aab79ecc0637c6c370;p=jalview.git diff --git a/src/jalview/gui/LineartOptions.java b/src/jalview/gui/LineartOptions.java index 1dd030b..8a530ac 100644 --- a/src/jalview/gui/LineartOptions.java +++ b/src/jalview/gui/LineartOptions.java @@ -20,13 +20,10 @@ */ package jalview.gui; -import jalview.bin.Cache; -import jalview.util.MessageManager; -import jalview.util.dialogrunner.RunResponse; - import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.util.concurrent.Callable; import java.util.concurrent.atomic.AtomicBoolean; import javax.swing.BorderFactory; @@ -36,12 +33,17 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; +import jalview.bin.Cache; +import jalview.util.MessageManager; + /** * A dialog where the user may choose Text or Lineart rendering, and optionally - * save this as a preference + * save this as a preference ("Don't ask me again") */ public class LineartOptions extends JPanel { + static final String PROMPT_EACH_TIME = "Prompt each time"; + JvOptionPane dialog; public boolean cancelled = false; @@ -61,22 +63,22 @@ public class LineartOptions extends JPanel * mutable boolean object. User action in the dialog should update this * object, and the same object should be used in any action handler * set by calling setResponseAction. + *

+ * If the user chooses an option and also "Don't ask me again", the chosen + * option is saved as a property with key type_RENDERING i.e. "EPS_RENDERING", + * "SVG_RENDERING" or "HTML_RENDERING". * - * @param preferencesKey - * the key under which the choice is saved as a user preference, if - * 'Don't ask me again' is selected * @param formatType * image type e.g. EPS, SVG * @param textOption * true to select Text, false for Lineart */ - public LineartOptions(String preferencesKey, String formatType, - AtomicBoolean textOption) + public LineartOptions(String formatType, AtomicBoolean textOption) { this.asText = textOption; dialogTitle = MessageManager.formatMessage( "label.select_character_style_title", formatType); - + String preferencesKey = formatType + "_RENDERING"; try { jbInit(preferencesKey, formatType); @@ -94,9 +96,9 @@ public class LineartOptions extends JPanel * * @param action */ - public void setResponseAction(RunResponse action) + public void setResponseAction(Object response, Callable action) { - dialog.response(action); + dialog.setResponseHandler(response, action); } /**