* @param vbox the layout node
* @param item the slide item to add
*/
protected void addSlideItem(final VBox vbox, final SlideItem item) {
Node node = null;
if (item.getLink()) {
final Hyperlink link = HyperlinkBuilder.create()
.opacity(1.0)
.text(item.getValue())
.build();
link.getStyleClass().add("link" + item.getLevel());
link.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(final ActionEvent e) {
final ClipboardContent content = new ClipboardContent();
content.putString("http://" + ((Hyperlink) e.getSource()).getText());
Clipboard.getSystemClipboard().setContent(content);
}
});
node = link;
} else if (item.getHtml()) {
final WebView web = WebViewBuilder.create()
.fontScale(1.4)
// .effect(ReflectionBuilder.create().fraction(0.4).build())
.build();
web.getEngine().loadContent(item.getValue());
VBox.setVgrow(web, Priority.NEVER);
node = web; // StackPaneBuilder.create().children(web).style("-fx-border-width:2;-fx-border-color:#000000").build();
} else if (item.getImage() != null) {
final Image image = Resources.create(new LocalImage(item.getImage())).get();
final ImageView imageViewer = ImageViewBuilder.create()
.styleClass(ITEM_CLASS_PREFIX + item.getLevel())
.image(image)
// .effect(ReflectionBuilder.create().fraction(0.9).build())
.build();
node = imageViewer;
} else {
final Text text = TextBuilder.create()
.styleClass(ITEM_CLASS_PREFIX + item.getLevel())
.text(item.getValue() == null ? "" : item.getValue())
.build();
node = text;
}
if (item.getStyle() != null) {
node.getStyleClass().add(item.getStyle());
}
if (item.getScale() != 1.0) {
node.setScaleX(item.getScale());
node.setScaleY(item.getScale());
}
vbox.getChildren().add(node);
}