use of net.sf.latexdraw.models.interfaces.shape.TextPosition in project latexdraw by arnobl.
the class ShapeTextCustomiser method update.
@Override
protected void update(final IGroup shape) {
if (shape.isTypeOf(ITextProp.class)) {
setActivated(true);
final TextPosition tp = shape.getTextPosition();
bButton.setSelected(tp == TextPosition.BOT);
brButton.setSelected(tp == TextPosition.BOT_RIGHT);
blButton.setSelected(tp == TextPosition.BOT_LEFT);
tButton.setSelected(tp == TextPosition.TOP);
trButton.setSelected(tp == TextPosition.TOP_RIGHT);
tlButton.setSelected(tp == TextPosition.TOP_LEFT);
centreButton.setSelected(tp == TextPosition.CENTER);
lButton.setSelected(tp == TextPosition.LEFT);
rButton.setSelected(tp == TextPosition.RIGHT);
// Otherwise it means that this field is currently being edited and must not be updated.
if (!packagesField.isFocused()) {
packagesField.setText(LaTeXGenerator.getPackages());
}
// Updating the log field.
Platform.runLater(() -> shape.getShapes().stream().filter(sh -> sh instanceof IText && canvas.getViewFromShape(sh).orElse(null) instanceof ViewText && ((ViewText) canvas.getViewFromShape(sh).get()).getCompilationData().isPresent()).findFirst().ifPresent(txt -> {
final ViewText view = (ViewText) canvas.getViewFromShape(txt).get();
final Future<?> currentCompil = view.getCurrentCompilation();
if (currentCompil != null) {
try {
currentCompil.get();
} catch (final InterruptedException | ExecutionException ex) {
BadaboomCollector.INSTANCE.add(ex);
}
}
logField.setText(view.getCompilationData().orElse(""));
}));
} else {
setActivated(false);
}
}
Aggregations