Add functionality for opening generated html in a browser
This commit is contained in:
parent
866f4aa6a3
commit
f049f09e97
|
@ -1,9 +1,12 @@
|
||||||
package de.vanitasvitae.imi.codes;
|
package de.vanitasvitae.imi.codes;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import de.vanitasvitae.imi.codes.input.Arguments;
|
import de.vanitasvitae.imi.codes.input.Arguments;
|
||||||
|
@ -91,6 +94,14 @@ public class Main {
|
||||||
|
|
||||||
String html = new HtmlTableStringBuilder("IMI Sample Tube Code Generator", codes).toString();
|
String html = new HtmlTableStringBuilder("IMI Sample Tube Code Generator", codes).toString();
|
||||||
writeHtml(html, outputPath);
|
writeHtml(html, outputPath);
|
||||||
|
|
||||||
|
if (externalBrowser && Desktop.isDesktopSupported()) {
|
||||||
|
try {
|
||||||
|
Desktop.getDesktop().browse(new URI("file://" + outputPath.getAbsolutePath()));
|
||||||
|
} catch (IOException | URISyntaxException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void writeHtml(String html, File destination) {
|
private static void writeHtml(String html, File destination) {
|
||||||
|
|
Loading…
Reference in New Issue