Search in sources :

Example 76 with Node

use of javafx.scene.Node in project JFoenix by jfoenixadmin.

the class MasonryPaneController method init.

@PostConstruct
public void init() throws FlowException, VetoException {
    ArrayList<Node> children = new ArrayList<>();
    for (int i = 0; i < 20; i++) {
        StackPane child = new StackPane();
        double width = Math.random() * 100 + 100;
        child.setMinWidth(width);
        child.setMaxWidth(width);
        child.setPrefWidth(width);
        double height = Math.random() * 100 + 100;
        child.setMinHeight(height);
        child.setMaxHeight(height);
        child.setPrefHeight(height);
        JFXDepthManager.setDepth(child, 1);
        children.add(child);
        // create content
        VBox content = new VBox();
        StackPane header = new StackPane();
        String headerColor = getDefaultColor(i % 12);
        header.setStyle("-fx-background-radius: 5 5 0 0; -fx-background-color: " + headerColor);
        VBox.setVgrow(header, Priority.ALWAYS);
        StackPane body = new StackPane();
        body.setMinHeight(Math.random() * 20 + 50);
        content.getChildren().addAll(header, body);
        body.setStyle("-fx-background-radius: 0 0 5 5; -fx-background-color: rgb(255,255,255,0.87);");
        // create button
        JFXButton button = new JFXButton("");
        button.setButtonType(ButtonType.RAISED);
        button.setStyle("-fx-background-radius: 40;-fx-background-color: " + getDefaultColor((int) ((Math.random() * 12) % 12)));
        button.setPrefSize(40, 40);
        button.setRipplerFill(Color.valueOf(headerColor));
        button.setScaleX(0);
        button.setScaleY(0);
        SVGGlyph glyph = new SVGGlyph(-1, "test", "M1008 6.286q18.857 13.714 15.429 36.571l-146.286 877.714q-2.857 16.571-18.286 25.714-8 4.571-17.714 4.571-6.286 0-13.714-2.857l-258.857-105.714-138.286 168.571q-10.286 13.143-28 13.143-7.429 0-12.571-2.286-10.857-4-17.429-13.429t-6.571-20.857v-199.429l493.714-605.143-610.857 528.571-225.714-92.571q-21.143-8-22.857-31.429-1.143-22.857 18.286-33.714l950.857-548.571q8.571-5.143 18.286-5.143 11.429 0 20.571 6.286z", Color.WHITE);
        glyph.setSize(20, 20);
        button.setGraphic(glyph);
        button.translateYProperty().bind(Bindings.createDoubleBinding(() -> {
            return header.getBoundsInParent().getHeight() - button.getHeight() / 2;
        }, header.boundsInParentProperty(), button.heightProperty()));
        StackPane.setMargin(button, new Insets(0, 12, 0, 0));
        StackPane.setAlignment(button, Pos.TOP_RIGHT);
        Timeline animation = new Timeline(new KeyFrame(Duration.millis(240), new KeyValue(button.scaleXProperty(), 1, Interpolator.EASE_BOTH), new KeyValue(button.scaleYProperty(), 1, Interpolator.EASE_BOTH)));
        animation.setDelay(Duration.millis(100 * i + (1000)));
        animation.play();
        child.getChildren().addAll(content, button);
    }
    masonryPane.getChildren().addAll(children);
    Platform.runLater(() -> scrollPane.requestLayout());
    JFXScrollPane.smoothScrolling(scrollPane);
}
Also used : Insets(javafx.geometry.Insets) KeyValue(javafx.animation.KeyValue) Node(javafx.scene.Node) ArrayList(java.util.ArrayList) JFXButton(com.jfoenix.controls.JFXButton) Timeline(javafx.animation.Timeline) SVGGlyph(com.jfoenix.svg.SVGGlyph) KeyFrame(javafx.animation.KeyFrame) VBox(javafx.scene.layout.VBox) StackPane(javafx.scene.layout.StackPane) PostConstruct(javax.annotation.PostConstruct)

Example 77 with Node

use of javafx.scene.Node in project JFoenix by jfoenixadmin.

the class JFXPasswordFieldSkinAndroid method showError.

private void showError(ValidatorBase validator) {
    // set text in error label
    errorLabel.setText(validator.getMessage());
    // show error icon
    Node awsomeIcon = validator.getIcon();
    errorIcon.getChildren().clear();
    if (awsomeIcon != null) {
        errorIcon.getChildren().add(awsomeIcon);
        StackPane.setAlignment(awsomeIcon, Pos.TOP_RIGHT);
    }
    // init only once, to fix the text pane from resizing
    if (initYLayout == -1) {
        textPane.setMaxHeight(textPane.getHeight());
        initYLayout = textPane.getBoundsInParent().getMinY();
        initHeight = getSkinnable().getHeight();
        currentFieldHeight = initHeight;
    }
    errorContainer.setVisible(true);
    errorShown = true;
}
Also used : Node(javafx.scene.Node)

Example 78 with Node

use of javafx.scene.Node in project JFoenix by jfoenixadmin.

the class JFXTextAreaSkinAndroid method showError.

private void showError(ValidatorBase validator) {
    // set text in error label
    errorLabel.setText(validator.getMessage());
    // show error icon
    Node awsomeIcon = validator.getIcon();
    errorIcon.getChildren().clear();
    if (awsomeIcon != null) {
        errorIcon.getChildren().add(awsomeIcon);
        StackPane.setAlignment(awsomeIcon, Pos.TOP_RIGHT);
    }
    // init only once, to fix the text pane from resizing
    if (initYLayout == -1) {
        scrollPane.setMaxHeight(scrollPane.getHeight());
        initYLayout = scrollPane.getBoundsInParent().getMinY();
        initHeight = getSkinnable().getHeight();
        currentFieldHeight = initHeight;
    }
    errorContainer.setVisible(true);
    errorShown = true;
}
Also used : Node(javafx.scene.Node)

Example 79 with Node

use of javafx.scene.Node in project JFoenix by jfoenixadmin.

the class JFXTextFieldSkinAndroid method showError.

private void showError(ValidatorBase validator) {
    // set text in error label
    errorLabel.setText(validator.getMessage());
    // show error icon
    Node awsomeIcon = validator.getIcon();
    errorIcon.getChildren().clear();
    if (awsomeIcon != null) {
        errorIcon.getChildren().add(awsomeIcon);
        StackPane.setAlignment(awsomeIcon, Pos.TOP_RIGHT);
    }
    // init only once, to fix the text pane from resizing
    if (initYLayout == -1) {
        textPane.setMaxHeight(textPane.getHeight());
        initYLayout = textPane.getBoundsInParent().getMinY();
        initHeight = getSkinnable().getHeight();
        currentFieldHeight = initHeight;
    }
    errorContainer.setVisible(true);
    errorShown = true;
}
Also used : Node(javafx.scene.Node)

Example 80 with Node

use of javafx.scene.Node in project JFoenix by jfoenixadmin.

the class ValidationFacade method showError.

private void showError(ValidatorBase validator) {
    // set text in error label
    errorLabel.setText(validator.getMessage());
    // show error icon
    Node awsomeIcon = validator.getIcon();
    errorIcon.getChildren().clear();
    if (awsomeIcon != null) {
        errorIcon.getChildren().add(awsomeIcon);
        StackPane.setAlignment(awsomeIcon, Pos.TOP_RIGHT);
    }
    // init only once, to fix the text pane from resizing
    if (initYlayout == -1) {
        initYlayout = getBoundsInParent().getMinY();
        initHeight = getHeight();
        currentFieldHeight = initHeight;
    }
    errorContainer.setVisible(true);
    errorShown = true;
}
Also used : Node(javafx.scene.Node)

Aggregations

Node (javafx.scene.Node)130 Stage (javafx.stage.Stage)25 Parent (javafx.scene.Parent)23 Label (javafx.scene.control.Label)19 ArrayList (java.util.ArrayList)18 ObservableList (javafx.collections.ObservableList)16 Button (javafx.scene.control.Button)16 List (java.util.List)15 Scene (javafx.scene.Scene)15 FXML (javafx.fxml.FXML)14 BorderPane (javafx.scene.layout.BorderPane)13 IOException (java.io.IOException)12 HBox (javafx.scene.layout.HBox)12 Color (javafx.scene.paint.Color)12 Platform (javafx.application.Platform)10 Insets (javafx.geometry.Insets)10 FXCollections (javafx.collections.FXCollections)9 MouseEvent (javafx.scene.input.MouseEvent)9 VBox (javafx.scene.layout.VBox)9 FadeTransition (javafx.animation.FadeTransition)8