Search in sources :

Example 1 with ViewFlowContext

use of io.datafx.controller.flow.context.ViewFlowContext 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)

Example 2 with ViewFlowContext

use of io.datafx.controller.flow.context.ViewFlowContext in project JFoenix by jfoenixadmin.

the class MainDemo method start.

public void start(Stage stage) throws Exception {
    new Thread(() -> {
        try {
            SVGGlyphLoader.loadGlyphsFont(MainDemo.class.getResourceAsStream("/resources/fonts/icomoon.svg"), "icomoon.svg");
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }).start();
    Flow flow = new Flow(MainController.class);
    DefaultFlowContainer container = new DefaultFlowContainer();
    flowContext = new ViewFlowContext();
    flowContext.register("Stage", stage);
    flow.createHandler(flowContext).start(container);
    JFXDecorator decorator = new JFXDecorator(stage, container.getView());
    decorator.setCustomMaximize(true);
    Scene scene = new Scene(decorator, 800, 850);
    scene.getStylesheets().add(MainDemo.class.getResource("/resources/css/jfoenix-fonts.css").toExternalForm());
    scene.getStylesheets().add(MainDemo.class.getResource("/resources/css/jfoenix-design.css").toExternalForm());
    scene.getStylesheets().add(MainDemo.class.getResource("/resources/css/jfoenix-main-demo.css").toExternalForm());
    //		stage.initStyle(StageStyle.UNDECORATED);
    //		stage.setFullScreen(true);
    stage.setMinWidth(700);
    stage.setMinHeight(800);
    stage.setScene(scene);
    stage.show();
}
Also used : DefaultFlowContainer(io.datafx.controller.flow.container.DefaultFlowContainer) ViewFlowContext(io.datafx.controller.flow.context.ViewFlowContext) FXMLViewFlowContext(io.datafx.controller.flow.context.FXMLViewFlowContext) JFXDecorator(com.jfoenix.controls.JFXDecorator) Scene(javafx.scene.Scene) Flow(io.datafx.controller.flow.Flow)

Aggregations

Flow (io.datafx.controller.flow.Flow)2 FXMLViewFlowContext (io.datafx.controller.flow.context.FXMLViewFlowContext)2 ViewFlowContext (io.datafx.controller.flow.context.ViewFlowContext)2 JFXDecorator (com.jfoenix.controls.JFXDecorator)1 AnimatedFlowContainer (demos.datafx.AnimatedFlowContainer)1 DefaultFlowContainer (io.datafx.controller.flow.container.DefaultFlowContainer)1 IOException (java.io.IOException)1 FXMLLoader (javafx.fxml.FXMLLoader)1 Scene (javafx.scene.Scene)1 PostConstruct (javax.annotation.PostConstruct)1