git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-4239 Using own id generation to avoid Random.nextLong() not implemented in jalviewjs
[jalview.git]
/
src
/
jalview
/
io
/
HTMLOutput.java
diff --git
a/src/jalview/io/HTMLOutput.java
b/src/jalview/io/HTMLOutput.java
index
54e7e4b
..
711c465
100644
(file)
--- a/
src/jalview/io/HTMLOutput.java
+++ b/
src/jalview/io/HTMLOutput.java
@@
-20,21
+20,25
@@
*/
package jalview.io;
*/
package jalview.io;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.Objects;
+
import jalview.api.AlignExportSettingsI;
import jalview.bin.Cache;
import jalview.api.AlignExportSettingsI;
import jalview.bin.Cache;
+import jalview.bin.Jalview;
import jalview.datamodel.AlignExportSettingsAdapter;
import jalview.datamodel.AlignmentExportData;
import jalview.gui.AlignmentPanel;
import jalview.gui.IProgressIndicator;
import jalview.datamodel.AlignExportSettingsAdapter;
import jalview.datamodel.AlignmentExportData;
import jalview.gui.AlignmentPanel;
import jalview.gui.IProgressIndicator;
+import jalview.io.exceptions.ImageOutputException;
+import jalview.util.IdUtils;
+import jalview.util.IdUtils.IdType;
import jalview.util.MessageManager;
import jalview.util.MessageManager;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.Objects;
-
public abstract class HTMLOutput implements Runnable
{
protected AlignmentPanel ap;
public abstract class HTMLOutput implements Runnable
{
protected AlignmentPanel ap;
@@
-59,14
+63,14
@@
public abstract class HTMLOutput implements Runnable
* Constructor given an alignment panel (which should not be null)
*
* @param ap
* Constructor given an alignment panel (which should not be null)
*
* @param ap
- * @param desc
+ * @param desc
*/
public HTMLOutput(AlignmentPanel ap, String desc)
{
this.ap = ap;
this.pIndicator = ap.alignFrame;
this.description = desc;
*/
public HTMLOutput(AlignmentPanel ap, String desc)
{
this.ap = ap;
this.pIndicator = ap.alignFrame;
this.description = desc;
- this.pSessionId = System.currentTimeMillis();
+ this.pSessionId = IdUtils.newId(IdType.PROGRESS);
}
/**
}
/**
@@
-237,7
+241,7
@@
public abstract class HTMLOutput implements Runnable
}
else
{
}
else
{
- System.out.println(message);
+ jalview.bin.Console.outPrintln(message);
}
}
}
}
@@
-261,14
+265,17
@@
public abstract class HTMLOutput implements Runnable
{
if (isLaunchInBrowserAfterExport() && !isHeadless())
{
{
if (isLaunchInBrowserAfterExport() && !isHeadless())
{
+ /*
try
{
try
{
- jalview.util.BrowserLauncher
- .openURL("file:///" + getExportedFile());
+ */
+ jalview.util.BrowserLauncher.openURL("file:///" + getExportedFile());
+ /*
} catch (IOException e)
{
e.printStackTrace();
}
} catch (IOException e)
{
e.printStackTrace();
}
+ */
}
}
}
}
@@
-298,10
+305,16
@@
public abstract class HTMLOutput implements Runnable
return generatedFile;
}
return generatedFile;
}
- public void exportHTML(String outputFile)
+ public void exportHTML(String outputFile) throws ImageOutputException
+ {
+ exportHTML(outputFile, null);
+ }
+
+ public void exportHTML(String outputFile, String renderer)
+ throws ImageOutputException
{
setProgressMessage(MessageManager.formatMessage(
{
setProgressMessage(MessageManager.formatMessage(
- "status.exporting_alignment_as_x_file", getDescription()));
+ "status.exporting_alignment_as_x_file", getDescription()));
try
{
if (outputFile == null)
try
{
if (outputFile == null)
@@
-326,8
+339,15
@@
public abstract class HTMLOutput implements Runnable
e.printStackTrace();
return;
}
e.printStackTrace();
return;
}
- new Thread(this).start();
-
+ if (Jalview.isHeadlessMode())
+ {
+ this.run(renderer);
+ }
+ else
+ {
+ new Thread(this).start();
+ }
+
}
/**
}
/**
@@
-338,6
+358,9
@@
public abstract class HTMLOutput implements Runnable
*/
protected final String getDescription()
{
*/
protected final String getDescription()
{
- return description;
+ return description;
}
}
+
+ // used to pass an option such as render to run
+ public abstract void run(String string) throws ImageOutputException;
}
\ No newline at end of file
}
\ No newline at end of file