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)));
}
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();
}
Aggregations