Add functionality for opening generated html in a browser
This commit is contained in:
parent
866f4aa6a3
commit
f049f09e97
1 changed files with 11 additions and 0 deletions
|
@ -1,9 +1,12 @@
|
|||
package de.vanitasvitae.imi.codes;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.List;
|
||||
|
||||
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();
|
||||
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) {
|
||||
|
|
Loading…
Reference in a new issue