use of net.sf.latexdraw.command.UpdateTemplates in project latexdraw by arnobl.
the class TemplateManager method configureBindings.
@Override
protected void configureBindings() {
buttonBinder().toProduce(() -> new UpdateTemplates(templatePane, svgGen, true)).on(updateTemplates).bind();
nodeBinder().usingInteraction(DnD::new).toProduce(i -> new LoadTemplate(svgGen, drawing, new File((String) i.getSrcObject().orElseThrow().getUserData()), statusController.getProgressBar(), statusController.getLabel(), app)).on(templatePane).first(c -> templatePane.setCursor(Cursor.CLOSED_HAND)).then((i, c) -> {
final Node srcObj = i.getSrcObject().orElseThrow();
final Point3D pt3d = i.getTgtObject().orElseThrow().sceneToLocal(srcObj.localToScene(i.getTgtLocalPoint())).subtract(Canvas.ORIGIN.getX() + srcObj.getLayoutX(), Canvas.ORIGIN.getY() + srcObj.getLayoutY(), 0d);
c.setPosition(ShapeFactory.INST.createPoint(pt3d));
}).when(i -> i.getSrcObject().orElse(null) instanceof ImageView && i.getSrcObject().get().getUserData() instanceof String && i.getTgtObject().orElse(null) instanceof Canvas).endOrCancel(i -> templatePane.setCursor(Cursor.MOVE)).bind();
}
use of net.sf.latexdraw.command.UpdateTemplates in project latexdraw by arnobl.
the class TemplateManager method initialize.
@Override
public void initialize(final URL location, final ResourceBundle resources) {
mainPane.managedProperty().bind(mainPane.visibleProperty());
emptyLabel.managedProperty().bind(emptyLabel.visibleProperty());
emptyLabel.visibleProperty().bind(Bindings.createBooleanBinding(() -> templatePane.getChildren().isEmpty(), templatePane.getChildren()));
emptyLabel.setFont(Font.font(emptyLabel.getFont().getFamily(), FontPosture.ITALIC, emptyLabel.getFont().getSize()));
Command.executeAndFlush(new UpdateTemplates(templatePane, svgGen, false));
setActivated(true);
templatePane.setCursor(Cursor.MOVE);
}
Aggregations