package demos;
import com.jfoenix.controls.JFXDecorator;
import com.jfoenix.svg.SVGGlyphLoader;
import demos.gui.main.MainController;
import io.datafx.controller.flow.Flow;
import io.datafx.controller.flow.container.DefaultFlowContainer;
import io.datafx.controller.flow.context.FXMLViewFlowContext;
import io.datafx.controller.flow.context.ViewFlowContext;
import javafx.application.Application;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
public class MainDemo extends Application {
@FXMLViewFlowContext
private ViewFlowContext flowContext;
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) throws Exception {
new Thread(() -> {
try {
SVGGlyphLoader.loadGlyphsFont(MainDemo.class.getResourceAsStream("/fonts/icomoon.svg"),
"icomoon.svg");
} catch (IOException ioExc) {
ioExc.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);
final ObservableList<String> stylesheets = scene.getStylesheets();
stylesheets.addAll(MainDemo.class.getResource("/css/jfoenix-fonts.css").toExternalForm(),
MainDemo.class.getResource("/css/jfoenix-design.css").toExternalForm(),
MainDemo.class.getResource("/css/jfoenix-main-demo.css").toExternalForm());
stage.setMinWidth(700);
stage.setMinHeight(800);
stage.setScene(scene);
stage.show();
}
}