Search in sources :

Example 1 with JFXTooltip

use of com.jfoenix.controls.JFXTooltip in project JFoenix by jfoenixadmin.

the class MainController method init.

/**
 * init fxml when loaded.
 */
@PostConstruct
public void init() throws Exception {
    // init the title hamburger icon
    final JFXTooltip burgerTooltip = new JFXTooltip("Open drawer");
    drawer.setOnDrawerOpening(e -> {
        final Transition animation = titleBurger.getAnimation();
        burgerTooltip.setText("Close drawer");
        animation.setRate(1);
        animation.play();
    });
    drawer.setOnDrawerClosing(e -> {
        final Transition animation = titleBurger.getAnimation();
        burgerTooltip.setText("Open drawer");
        animation.setRate(-1);
        animation.play();
    });
    titleBurgerContainer.setOnMouseClicked(e -> {
        if (drawer.isClosed() || drawer.isClosing()) {
            drawer.open();
        } else {
            drawer.close();
        }
    });
    FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/ui/popup/MainPopup.fxml"));
    loader.setController(new InputController());
    toolbarPopup = new JFXPopup(loader.load());
    optionsBurger.setOnMouseClicked(e -> toolbarPopup.show(optionsBurger, PopupVPosition.TOP, PopupHPosition.RIGHT, -12, 15));
    JFXTooltip.setVisibleDuration(Duration.millis(3000));
    JFXTooltip.install(titleBurgerContainer, burgerTooltip, Pos.BOTTOM_CENTER);
    // create the inner flow and content
    context = new ViewFlowContext();
    // set the default controller
    Flow innerFlow = new Flow(ButtonController.class);
    final FlowHandler flowHandler = innerFlow.createHandler(context);
    context.register("ContentFlowHandler", flowHandler);
    context.register("ContentFlow", innerFlow);
    final Duration containerAnimationDuration = Duration.millis(320);
    drawer.setContent(flowHandler.start(new ExtendedAnimatedFlowContainer(containerAnimationDuration, SWIPE_LEFT)));
    context.register("ContentPane", drawer.getContent().get(0));
    // side controller will add links to the content flow
    Flow sideMenuFlow = new Flow(SideMenuController.class);
    final FlowHandler sideMenuFlowHandler = sideMenuFlow.createHandler(context);
    drawer.setSidePane(sideMenuFlowHandler.start(new ExtendedAnimatedFlowContainer(containerAnimationDuration, SWIPE_LEFT)));
}
Also used : ExtendedAnimatedFlowContainer(demos.datafx.ExtendedAnimatedFlowContainer) JFXPopup(com.jfoenix.controls.JFXPopup) ViewFlowContext(io.datafx.controller.flow.context.ViewFlowContext) FXMLViewFlowContext(io.datafx.controller.flow.context.FXMLViewFlowContext) Transition(javafx.animation.Transition) Duration(javafx.util.Duration) JFXTooltip(com.jfoenix.controls.JFXTooltip) FlowHandler(io.datafx.controller.flow.FlowHandler) FXMLLoader(javafx.fxml.FXMLLoader) Flow(io.datafx.controller.flow.Flow) PostConstruct(javax.annotation.PostConstruct)

Aggregations

JFXPopup (com.jfoenix.controls.JFXPopup)1 JFXTooltip (com.jfoenix.controls.JFXTooltip)1 ExtendedAnimatedFlowContainer (demos.datafx.ExtendedAnimatedFlowContainer)1 Flow (io.datafx.controller.flow.Flow)1 FlowHandler (io.datafx.controller.flow.FlowHandler)1 FXMLViewFlowContext (io.datafx.controller.flow.context.FXMLViewFlowContext)1 ViewFlowContext (io.datafx.controller.flow.context.ViewFlowContext)1 Transition (javafx.animation.Transition)1 FXMLLoader (javafx.fxml.FXMLLoader)1 Duration (javafx.util.Duration)1 PostConstruct (javax.annotation.PostConstruct)1