Example usage for javafx.scene Group visibleProperty

List of usage examples for javafx.scene Group visibleProperty

Introduction

In this page you can find the example usage for javafx.scene Group visibleProperty.

Prototype

public final BooleanProperty visibleProperty() 

Source Link

Usage

From source file:at.ac.tuwien.qse.sepm.gui.control.ImageTile.java

public ImageTile() {
    getStyleClass().add("imageTile");

    Group overlay = new Group();
    HBox overlayBox = new HBox();
    overlayBox.getStyleClass().add("hoverlay");
    overlayBox.getChildren().addAll(overLayIcon, name);
    overlay.getChildren().add(overlayBox);

    StackPane.setAlignment(overlay, Pos.CENTER);

    placeHolder.setGlyphSize(ImageSize.LARGE.pixels() * 0.6);

    setMinHeight(0);//from  w  ww  .  j  a va  2  s  .c o  m
    setMinWidth(0);
    imageView.setPreserveRatio(false);

    getChildren().add(placeHolder);
    getChildren().add(imageView);
    getChildren().add(overlay);

    setAlignment(overlay, Pos.CENTER);

    setOnMouseEntered((event) -> {
        if (photos.size() > 0) {
            setCursor(Cursor.HAND);
        }
    });

    setOnMouseExited((event -> setCursor(Cursor.DEFAULT)));

    imageView.visibleProperty().bind(photosProperty.emptyProperty().not());
    overlay.visibleProperty().bind(photosProperty.emptyProperty().not().and(name.textProperty().isNotEmpty()));
    placeHolder.visibleProperty().bind(photosProperty.emptyProperty());

    heightProperty().addListener(this::handleSizeChange);
    widthProperty().addListener(this::handleSizeChange);
}