use of net.sf.latexdraw.model.api.shape.TextPosition in project latexdraw by arnobl.
the class ShapeTextCustomiser method initialize.
@Override
public void initialize(final URL location, final ResourceBundle resources) {
super.initialize(location, resources);
mainPane.managedProperty().bind(mainPane.visibleProperty());
final Map<TextPosition, Image> cachePos = new EnumMap<>(TextPosition.class);
// NON-NLS
cachePos.put(TextPosition.TOP_LEFT, new Image("/res/textPosTL.png"));
// NON-NLS
cachePos.put(TextPosition.TOP, new Image("/res/textPosT.png"));
// NON-NLS
cachePos.put(TextPosition.TOP_RIGHT, new Image("/res/textPosTR.png"));
// NON-NLS
cachePos.put(TextPosition.RIGHT, new Image("/res/textPosRight.png"));
// NON-NLS
cachePos.put(TextPosition.BOT_RIGHT, new Image("/res/textPosBR.png"));
// NON-NLS
cachePos.put(TextPosition.BOT, new Image("/res/textPosB.png"));
// NON-NLS
cachePos.put(TextPosition.BOT_LEFT, new Image("/res/textPosBL.png"));
// NON-NLS
cachePos.put(TextPosition.LEFT, new Image("/res/textPosLeft.png"));
// NON-NLS
cachePos.put(TextPosition.CENTER, new Image("/res/textPosCentre.png"));
initComboBox(textPos, cachePos, TextPosition.values());
}
use of net.sf.latexdraw.model.api.shape.TextPosition in project latexdraw by arnobl.
the class ShapeTextCustomiser method updateOnTextPropShape.
private void updateOnTextPropShape(final Group shape) {
final TextPosition tp = shape.getTextPosition();
textPos.getSelectionModel().select(tp);
// Otherwise it means that this field is currently being edited and must not be updated.
if (!packagesField.isFocused()) {
packagesField.setText(latexData.getPackages());
}
// Updating the log field.
shape.getShapes().stream().filter(sh -> sh instanceof Text && canvas.getViewFromShape(sh).orElse(null) instanceof ViewText && ((ViewText) canvas.getViewFromShape(sh).orElseThrow()).getCompilationData().isPresent()).findFirst().ifPresent(txt -> {
final ViewText view = (ViewText) canvas.getViewFromShape(txt).orElseThrow();
final Future<?> currentCompil = view.getCurrentCompilation();
if (currentCompil != null) {
try {
currentCompil.get();
} catch (final InterruptedException ex) {
Thread.currentThread().interrupt();
BadaboomCollector.INSTANCE.add(ex);
} catch (final ExecutionException ex) {
BadaboomCollector.INSTANCE.add(ex);
}
}
logField.setText(view.getCompilationData().orElse(""));
});
}
Aggregations