Search in sources :

Example 1 with JFXDialogEvent

use of com.jfoenix.controls.events.JFXDialogEvent in project JFoenix by jfoenixadmin.

the class JFXDialog method close.

/**
	 * close the dialog
	 */
public void close() {
    animation.setRate(-1);
    animation.play();
    animation.setOnFinished((e) -> {
        resetProperties();
        onDialogClosedProperty.get().handle(new JFXDialogEvent(JFXDialogEvent.CLOSED));
        dialogContainer.getChildren().remove(this);
    });
}
Also used : JFXDialogEvent(com.jfoenix.controls.events.JFXDialogEvent)

Example 2 with JFXDialogEvent

use of com.jfoenix.controls.events.JFXDialogEvent in project JFoenix by jfoenixadmin.

the class JFXDialog method getShowAnimation.

/***************************************************************************
	 *                                                                         *
	 * Transitions                                                             *
	 *                                                                         *
	 **************************************************************************/
private Transition getShowAnimation(DialogTransition transitionType) {
    Transition animation = null;
    if (contentHolder != null) {
        switch(transitionType) {
            case LEFT:
                contentHolder.setScaleX(1);
                contentHolder.setScaleY(1);
                contentHolder.setTranslateX(-offsetX);
                animation = new LeftTransition();
                break;
            case RIGHT:
                contentHolder.setScaleX(1);
                contentHolder.setScaleY(1);
                contentHolder.setTranslateX(offsetX);
                animation = new RightTransition();
                break;
            case TOP:
                contentHolder.setScaleX(1);
                contentHolder.setScaleY(1);
                contentHolder.setTranslateY(-offsetY);
                animation = new TopTransition();
                break;
            case BOTTOM:
                contentHolder.setScaleX(1);
                contentHolder.setScaleY(1);
                contentHolder.setTranslateY(offsetY);
                animation = new BottomTransition();
                break;
            default:
                contentHolder.setScaleX(0);
                contentHolder.setScaleY(0);
                animation = new CenterTransition();
                break;
        }
    }
    if (animation != null)
        animation.setOnFinished((finish) -> onDialogOpenedProperty.get().handle(new JFXDialogEvent(JFXDialogEvent.OPENED)));
    return animation;
}
Also used : EventHandler(javafx.event.EventHandler) Pos(javafx.geometry.Pos) Color(javafx.scene.paint.Color) ObjectProperty(javafx.beans.property.ObjectProperty) javafx.scene.layout(javafx.scene.layout) MouseEvent(javafx.scene.input.MouseEvent) javafx.animation(javafx.animation) JFXDialogEvent(com.jfoenix.controls.events.JFXDialogEvent) ArrayList(java.util.ArrayList) CachedTransition(com.jfoenix.transitions.CachedTransition) Parent(javafx.scene.Parent) BooleanProperty(javafx.beans.property.BooleanProperty) Duration(javafx.util.Duration) List(java.util.List) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) javafx.css(javafx.css) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) DialogTransitionConverter(com.jfoenix.converters.DialogTransitionConverter) JFXDepthManager(com.jfoenix.effects.JFXDepthManager) DefaultProperty(javafx.beans.DefaultProperty) Collections(java.util.Collections) JFXDialogEvent(com.jfoenix.controls.events.JFXDialogEvent) CachedTransition(com.jfoenix.transitions.CachedTransition)

Aggregations

JFXDialogEvent (com.jfoenix.controls.events.JFXDialogEvent)2 DialogTransitionConverter (com.jfoenix.converters.DialogTransitionConverter)1 JFXDepthManager (com.jfoenix.effects.JFXDepthManager)1 CachedTransition (com.jfoenix.transitions.CachedTransition)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 List (java.util.List)1 javafx.animation (javafx.animation)1 DefaultProperty (javafx.beans.DefaultProperty)1 BooleanProperty (javafx.beans.property.BooleanProperty)1 ObjectProperty (javafx.beans.property.ObjectProperty)1 SimpleBooleanProperty (javafx.beans.property.SimpleBooleanProperty)1 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)1 javafx.css (javafx.css)1 EventHandler (javafx.event.EventHandler)1 Pos (javafx.geometry.Pos)1 Parent (javafx.scene.Parent)1 MouseEvent (javafx.scene.input.MouseEvent)1 javafx.scene.layout (javafx.scene.layout)1 Color (javafx.scene.paint.Color)1