String imageSource)
{
final long messageId = System.currentTimeMillis();
+ setStatus(
+ MessageManager.formatMessage(
+ "status.exporting_alignment_as_x_file", imageType),
+ messageId);
/*
* prompt user for output file if not provided
String type = imageType.getName();
try
{
- setStatus(
- MessageManager.formatMessage(
- "status.exporting_alignment_as_x_file", type),
- messageId);
+// setStatus(
+// MessageManager.formatMessage(
+// "status.exporting_alignment_as_x_file", type),
+// messageId);
ImageMaker im = new ImageMaker(imageType, width, height, chosenFile,
title, asLineart);
imageWriter.exportImage(im.getGraphics());
public BioJsHTMLOutput(AlignmentPanel ap)
{
- super(ap);
+ super(ap, "BioJS MSA");
}
public static void refreshVersionInfo(String dirName)
}
- @Override
- protected String getDescription()
- {
- return "BioJS MSA";
- }
-
}
{
protected AlignmentPanel ap;
+ /*
+ * key for progress or status messages
+ */
protected long pSessionId;
+ /*
+ * (optional) place to write progress messages to
+ */
protected IProgressIndicator pIndicator;
protected File generatedFile;
String _bioJson = null;
+ private String description;
+
/**
* Constructor given an alignment panel (which should not be null)
*
* @param ap
+ * @param desc
*/
- public HTMLOutput(AlignmentPanel ap)
+ public HTMLOutput(AlignmentPanel ap, String desc)
{
this.ap = ap;
this.pIndicator = ap.alignFrame;
+ this.description = desc;
+ this.pSessionId = System.currentTimeMillis();
}
/**
/**
* This method provides implementation of consistent behaviour which should
- * occur before a HTML file export. It MUST be called at the start of the
- * exportHTML() method implementation.
- */
- protected void exportStarted()
- {
- pSessionId = System.currentTimeMillis();
- }
-
- /**
- * This method provides implementation of consistent behaviour which should
* occur after a HTML file export. It MUST be called at the end of the
* exportHTML() method implementation.
*/
public void exportHTML(String outputFile)
{
- exportStarted();
+ setProgressMessage(MessageManager.formatMessage(
+ "status.exporting_alignment_as_x_file", getDescription()));
try
{
if (outputFile == null)
*
* @return
*/
- protected abstract String getDescription();
+ protected final String getDescription()
+ {
+ return description;
+ }
}
\ No newline at end of file
{
public HtmlSvgOutput(AlignmentPanel ap)
{
- super(ap);
- }
-
- @Override
- public void exportHTML(String outputFile)
- {
- exportStarted();
- try
- {
- if (outputFile == null)
- {
- outputFile = getOutputFile();
- if (outputFile == null)
- {
- setProgressMessage(MessageManager.formatMessage(
- "status.cancelled_image_export_operation", "HTML"));
- return;
- }
- }
- generatedFile = new File(outputFile);
- } catch (Exception e)
- {
- setProgressMessage(MessageManager
- .formatMessage("info.error_creating_file", "HTML"));
- e.printStackTrace();
- return;
- }
- new Thread(this).start();
+ super(ap, "HTML");
}
public int printUnwrapped(int pwidth, int pheight, int pi,
{
try
{
- setProgressMessage(null);
- setProgressMessage(MessageManager.formatMessage(
- "status.exporting_alignment_as_x_file", getDescription()));
-
String renderStyle = Cache.getDefault("HTML_RENDERING",
"Prompt each time");
AtomicBoolean textOption = new AtomicBoolean(
.formatMessage("info.error_creating_file", getDescription()));
}
}
-
- @Override
- protected String getDescription()
- {
- return "HTML";
- }
}
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SpringLayout;
-import javax.swing.SwingUtilities;
-import javax.swing.border.TitledBorder;
import javax.swing.plaf.basic.BasicFileChooserUI;
/**
return f == null ? selectedFile : f;
}
- /**
- * Overridden for JalviewJS compatibility: only one thread in Javascript,
- * so we can't wait for user choice in another thread and then perform the
- * desired action
- */
@Override
public int showSaveDialog(Component parent) throws HeadlessException
{
this.setAccessory(null);
+ // Java 9,10,11 on OSX - clear selected file so name isn't auto populated
this.setSelectedFile(null);
+
return super.showSaveDialog(parent);
}
}
}
- /**
- * A panel to set as the 'accessory' component to the file chooser dialog,
- * holding a list of recently opened files (if any). These are held as a
- * tab-separated list of file paths under key <code>RECENT_FILE</code> in
- * <code>.jalview_properties</code>. A click in the list calls a method in
- * JalviewFileChooser to set the chosen file as the selection.
- */
class RecentlyOpened extends JPanel
{
private static final long serialVersionUID = 1L;
-
JList<String> list;
RecentlyOpened()
if (historyItems != null)
{
st = new StringTokenizer(historyItems, "\t");
+
while (st.hasMoreTokens())
{
recent.addElement(st.nextToken());
}
});
- this.setBorder(new TitledBorder(
+ this.setBorder(new javax.swing.border.TitledBorder(
MessageManager.getString("label.recently_opened")));
final JScrollPane scroller = new JScrollPane(list);
this.add(scroller);
- SwingUtilities.invokeLater(new Runnable()
+ javax.swing.SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
.setValue(scroller.getHorizontalScrollBar().getMaximum());
}
});
+
}
+
}
@Override