Implement SVG export
This commit is contained in:
@@ -15,7 +15,6 @@ import ovh.gasser.newshapes.ui.listeners.SelectionListener;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.Optional;
|
||||
|
||||
public class App {
|
||||
private final static Logger logger = LoggerFactory.getLogger(App.class);
|
||||
@@ -82,6 +81,7 @@ public class App {
|
||||
JMenuItem addRectItem = new JMenuItem("Add SRectangle");
|
||||
JMenuItem addCircleItem = new JMenuItem("Add SCircle");
|
||||
JMenuItem htmlExportItem = new JMenuItem("Export to HTML");
|
||||
JMenuItem svgExportItem = new JMenuItem("Export to SVG");
|
||||
JMenuItem exitItem = new JMenuItem("Exit");
|
||||
addRectItem.addActionListener(new MenuAddListener("SRectangle", model, sview));
|
||||
addCircleItem.addActionListener(new MenuAddListener("SCircle", model, sview));
|
||||
@@ -92,11 +92,19 @@ public class App {
|
||||
logger.error("Could not export as html: {}", e.getMessage());
|
||||
}
|
||||
});
|
||||
svgExportItem.addActionListener(evt -> {
|
||||
try {
|
||||
new SVGExporter(model).export();
|
||||
} catch (FileNotFoundException e) {
|
||||
logger.error("Could not export as html: {}", e.getMessage());
|
||||
}
|
||||
});
|
||||
exitItem.addActionListener(evt -> System.exit(0));
|
||||
menuFile.add(addRectItem);
|
||||
menuFile.add(addCircleItem);
|
||||
menuFile.addSeparator();
|
||||
menuFile.add(htmlExportItem);
|
||||
menuFile.add(svgExportItem);
|
||||
menuFile.add(exitItem);
|
||||
return menuFile;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user