Add HTML export action
This commit is contained in:
@@ -2,6 +2,7 @@ package ovh.gasser.newshapes.ui;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import ovh.gasser.newshapes.HTMLExporter;
|
||||
import ovh.gasser.newshapes.Selection;
|
||||
import ovh.gasser.newshapes.attributes.ColorAttributes;
|
||||
import ovh.gasser.newshapes.shapes.SCollection;
|
||||
@@ -12,6 +13,7 @@ import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.Optional;
|
||||
|
||||
public class Controller {
|
||||
@@ -74,10 +76,20 @@ public class Controller {
|
||||
case KeyEvent.VK_DELETE -> deleteSelected();
|
||||
case KeyEvent.VK_C -> copySelection();
|
||||
case KeyEvent.VK_A -> changeSelectionColor();
|
||||
case KeyEvent.VK_H -> exportHtml();
|
||||
default -> logger.warn("Pressed unhandled key: {}", evt.getKeyChar());
|
||||
}
|
||||
}
|
||||
|
||||
private void exportHtml() {
|
||||
logger.info("Exporting view to html");
|
||||
try {
|
||||
new HTMLExporter(this.model).export();
|
||||
} catch (FileNotFoundException e) {
|
||||
logger.error("Unable to export html: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void changeSelectionColor(){
|
||||
if (selection == null) {
|
||||
logger.debug("No selection to change color of");
|
||||
|
||||
Reference in New Issue
Block a user