Files
new-shapes/src/main/java/ovh/gasser/newshapes/HTMLExporter.java
2026-03-19 19:06:12 +01:00

43 lines
1.2 KiB
Java

package ovh.gasser.newshapes;
import ovh.gasser.newshapes.shapes.SCollection;
import ovh.gasser.newshapes.shapes.SRectangle;
import ovh.gasser.newshapes.ui.visitors.*;
import java.awt.*;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
public class HTMLExporter {
private final SCollection model;
private HTMLExporter() {
this(SCollection.of(
SRectangle.create(10, 10, 40, 60, Color.RED),
SRectangle.create(70, 10, 40, 60),
SCollection.of(
SRectangle.create(100, 200, 40, 60, Color.MAGENTA),
SRectangle.create(150, 200, 40, 60, Color.MAGENTA)
)
));
}
public HTMLExporter(SCollection model){
this.model = model;
}
public void export() throws FileNotFoundException {
try (final PrintWriter html = new PrintWriter("out.html")) {
try (final PrintWriter css = new PrintWriter("style.css")) {
HTMLDraftman draftman = new HTMLDraftman(html, css);
draftman.generateHTML(this.model);
}
}
}
public static void main(String[] args) throws FileNotFoundException {
new HTMLExporter().export();
}
}