Search in sources :

Example 1 with FlowException

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

the class IconsController method init.

@PostConstruct
public void init() throws FlowException, VetoException {
    bindAction(burger1);
    bindAction(burger2);
    bindAction(burger3);
    bindAction(burger4);
    snackbar.registerSnackbarContainer(root);
    badge1.setOnMouseClicked((e) -> {
        int value = Integer.parseInt(badge1.getText());
        if (e.getButton() == MouseButton.PRIMARY) {
            value++;
        } else if (e.getButton() == MouseButton.SECONDARY) {
            value--;
        }
        if (value == 0) {
            badge1.setEnabled(false);
        } else {
            badge1.setEnabled(true);
        }
        badge1.setText(String.valueOf(value));
        // trigger snackbar
        if (count++ % 2 == 0) {
            snackbar.fireEvent(new SnackbarEvent("Toast Message " + count));
        } else {
            if (count % 4 == 0) {
                snackbar.fireEvent(new SnackbarEvent("Snackbar Message Persistant " + count, "CLOSE", 3000, true, (b) -> {
                    snackbar.close();
                }));
            } else {
                snackbar.fireEvent(new SnackbarEvent("Snackbar Message " + count, "UNDO", 3000, false, (b) -> {
                }));
            }
        }
    });
}
Also used : JFXSnackbar(com.jfoenix.controls.JFXSnackbar) VetoException(io.datafx.controller.util.VetoException) FXML(javafx.fxml.FXML) MouseButton(javafx.scene.input.MouseButton) JFXBadge(com.jfoenix.controls.JFXBadge) FlowException(io.datafx.controller.flow.FlowException) SnackbarEvent(com.jfoenix.controls.JFXSnackbar.SnackbarEvent) PostConstruct(javax.annotation.PostConstruct) StackPane(javafx.scene.layout.StackPane) FXMLController(io.datafx.controller.FXMLController) JFXHamburger(com.jfoenix.controls.JFXHamburger) SnackbarEvent(com.jfoenix.controls.JFXSnackbar.SnackbarEvent) PostConstruct(javax.annotation.PostConstruct)

Example 2 with FlowException

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

the class SVGLoaderController method init.

@PostConstruct
public void init() throws FlowException, VetoException, Exception {
    final Stage stage = (Stage) context.getRegisteredObject("Stage");
    glyphDetailViewer = new GlyphDetailViewer();
    detailsContainer.getChildren().add(glyphDetailViewer);
    ScrollPane scrollableGlyphs = allGlyphs();
    scrollableGlyphs.setStyle("-fx-background-insets: 0;");
    iconsContainer.getChildren().add(scrollableGlyphs);
    browseFont.setOnAction((action) -> {
        FileChooser fileChooser = new FileChooser();
        FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("SVG files (*.svg)", "*.svg");
        fileChooser.getExtensionFilters().add(extFilter);
        File file = fileChooser.showOpenDialog(stage);
        if (file != null) {
            SVGGlyphLoader.clear();
            try {
                SVGGlyphLoader.loadGlyphsFont(new FileInputStream(file), file.getName());
                ScrollPane newglyphs = allGlyphs();
                newglyphs.setStyle("-fx-background-insets: 0;");
                iconsContainer.getChildren().clear();
                iconsContainer.getChildren().add(newglyphs);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}
Also used : FileChooser(javafx.stage.FileChooser) Stage(javafx.stage.Stage) File(java.io.File) FileInputStream(java.io.FileInputStream) FlowException(io.datafx.controller.flow.FlowException) IOException(java.io.IOException) VetoException(io.datafx.controller.util.VetoException) PostConstruct(javax.annotation.PostConstruct)

Example 3 with FlowException

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

Aggregations

FlowException (io.datafx.controller.flow.FlowException)3 VetoException (io.datafx.controller.util.VetoException)3 PostConstruct (javax.annotation.PostConstruct)3 JFXBadge (com.jfoenix.controls.JFXBadge)1 JFXHamburger (com.jfoenix.controls.JFXHamburger)1 JFXSnackbar (com.jfoenix.controls.JFXSnackbar)1 SnackbarEvent (com.jfoenix.controls.JFXSnackbar.SnackbarEvent)1 FXMLController (io.datafx.controller.FXMLController)1 Flow (io.datafx.controller.flow.Flow)1 FlowHandler (io.datafx.controller.flow.FlowHandler)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 FXML (javafx.fxml.FXML)1 MouseButton (javafx.scene.input.MouseButton)1 StackPane (javafx.scene.layout.StackPane)1 FileChooser (javafx.stage.FileChooser)1 Stage (javafx.stage.Stage)1