Search in sources :

Example 1 with Flow

use of io.datafx.controller.flow.Flow 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 Flow

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

the class SideMenuController method init.

@PostConstruct
public void init() throws FlowException, VetoException {
    FlowHandler contentFlowHandler = (FlowHandler) context.getRegisteredObject("ContentFlowHandler");
    sideList.propagateMouseEventsToParent();
    sideList.getSelectionModel().selectedItemProperty().addListener((o, oldVal, newVal) -> {
        if (newVal != null) {
            try {
                contentFlowHandler.handle(newVal.getId());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
    Flow contentFlow = (Flow) context.getRegisteredObject("ContentFlow");
    bindNodeToController(button, ButtonController.class, contentFlow, contentFlowHandler);
    bindNodeToController(checkbox, CheckboxController.class, contentFlow, contentFlowHandler);
    bindNodeToController(combobox, ComboBoxController.class, contentFlow, contentFlowHandler);
    bindNodeToController(dialogs, DialogController.class, contentFlow, contentFlowHandler);
    bindNodeToController(icons, IconsController.class, contentFlow, contentFlowHandler);
    bindNodeToController(listview, ListViewController.class, contentFlow, contentFlowHandler);
    bindNodeToController(treetableview, TreeTableViewController.class, contentFlow, contentFlowHandler);
    bindNodeToController(progressbar, ProgressBarController.class, contentFlow, contentFlowHandler);
    bindNodeToController(radiobutton, RadioButtonController.class, contentFlow, contentFlowHandler);
    bindNodeToController(slider, SliderController.class, contentFlow, contentFlowHandler);
    bindNodeToController(spinner, SpinnerController.class, contentFlow, contentFlowHandler);
    bindNodeToController(textfield, TextFieldController.class, contentFlow, contentFlowHandler);
    bindNodeToController(togglebutton, ToggleButtonController.class, contentFlow, contentFlowHandler);
    bindNodeToController(popup, PopupController.class, contentFlow, contentFlowHandler);
    bindNodeToController(svgLoader, SVGLoaderController.class, contentFlow, contentFlowHandler);
    bindNodeToController(pickers, PickersController.class, contentFlow, contentFlowHandler);
    bindNodeToController(masonry, MasonryPaneController.class, contentFlow, contentFlowHandler);
    bindNodeToController(scrollpane, ScrollPaneController.class, contentFlow, contentFlowHandler);
}
Also used : FlowHandler(io.datafx.controller.flow.FlowHandler) FlowException(io.datafx.controller.flow.FlowException) VetoException(io.datafx.controller.util.VetoException) Flow(io.datafx.controller.flow.Flow) PostConstruct(javax.annotation.PostConstruct)

Example 3 with Flow

use of io.datafx.controller.flow.Flow 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)3 FXMLViewFlowContext (io.datafx.controller.flow.context.FXMLViewFlowContext)2 ViewFlowContext (io.datafx.controller.flow.context.ViewFlowContext)2 PostConstruct (javax.annotation.PostConstruct)2 JFXDecorator (com.jfoenix.controls.JFXDecorator)1 AnimatedFlowContainer (demos.datafx.AnimatedFlowContainer)1 FlowException (io.datafx.controller.flow.FlowException)1 FlowHandler (io.datafx.controller.flow.FlowHandler)1 DefaultFlowContainer (io.datafx.controller.flow.container.DefaultFlowContainer)1 VetoException (io.datafx.controller.util.VetoException)1 IOException (java.io.IOException)1 FXMLLoader (javafx.fxml.FXMLLoader)1 Scene (javafx.scene.Scene)1