Search in sources :

Example 1 with AnimatedFlowContainer

use of demos.datafx.AnimatedFlowContainer in project JFoenix by jfoenixadmin.

the class MainController method init.

@PostConstruct
public void init() throws FlowException, VetoException {
    // init the title hamburger icon
    drawer.setOnDrawerOpening((e) -> {
        titleBurger.getAnimation().setRate(1);
        titleBurger.getAnimation().play();
    });
    drawer.setOnDrawerClosing((e) -> {
        titleBurger.getAnimation().setRate(-1);
        titleBurger.getAnimation().play();
    });
    titleBurgerContainer.setOnMouseClicked((e) -> {
        if (drawer.isHidden() || drawer.isHidding())
            drawer.open();
        else
            drawer.close();
    });
    try {
        FXMLLoader loader = new FXMLLoader(getClass().getResource("/resources/fxml/ui/popup/MainPopup.fxml"));
        loader.setController(new InputController());
        toolbarPopup = new JFXPopup(loader.load());
    } catch (IOException e1) {
        e1.printStackTrace();
    }
    optionsBurger.setOnMouseClicked((e) -> {
        toolbarPopup.show(optionsBurger, PopupVPosition.TOP, PopupHPosition.RIGHT, -12, 15);
    });
    // create the inner flow and content
    context = new ViewFlowContext();
    // set the default controller 
    Flow innerFlow = new Flow(ButtonController.class);
    flowHandler = innerFlow.createHandler(context);
    context.register("ContentFlowHandler", flowHandler);
    context.register("ContentFlow", innerFlow);
    drawer.setContent(flowHandler.start(new AnimatedFlowContainer(Duration.millis(320), ContainerAnimations.SWIPE_LEFT)));
    context.register("ContentPane", drawer.getContent().get(0));
    // side controller will add links to the content flow
    Flow sideMenuFlow = new Flow(SideMenuController.class);
    sideMenuFlowHandler = sideMenuFlow.createHandler(context);
    drawer.setSidePane(sideMenuFlowHandler.start(new AnimatedFlowContainer(Duration.millis(320), ContainerAnimations.SWIPE_LEFT)));
}
Also used : ViewFlowContext(io.datafx.controller.flow.context.ViewFlowContext) FXMLViewFlowContext(io.datafx.controller.flow.context.FXMLViewFlowContext) IOException(java.io.IOException) FXMLLoader(javafx.fxml.FXMLLoader) Flow(io.datafx.controller.flow.Flow) AnimatedFlowContainer(demos.datafx.AnimatedFlowContainer) PostConstruct(javax.annotation.PostConstruct)

Aggregations

AnimatedFlowContainer (demos.datafx.AnimatedFlowContainer)1 Flow (io.datafx.controller.flow.Flow)1 FXMLViewFlowContext (io.datafx.controller.flow.context.FXMLViewFlowContext)1 ViewFlowContext (io.datafx.controller.flow.context.ViewFlowContext)1 IOException (java.io.IOException)1 FXMLLoader (javafx.fxml.FXMLLoader)1 PostConstruct (javax.annotation.PostConstruct)1