JPro-one / jpro-routing

Small web-framework for JPro
https://www.jpro.one
Apache License 2.0
6 stars 0 forks source link

Can we move RouteApp code to an Interface? #14

Open mitvitaminen opened 1 year ago

mitvitaminen commented 1 year ago

Hi,

could you move the RouteApp code to an inteface? This is because my javafx application class is extending a class so DI with guice is initialized.

Could this file work? I do a pull request if you want me to. ` public interface RouteApp {

Route createRoute(Stage stage);

default WebAPI getWebAPI(Stage stage) { return WebAPI.isBrowser() ? WebAPI.getWebAPI(stage) : null; }

default void startRoute(Stage stage) { final RouteNode routeNode = new RouteNode(stage);

  // Add node between RouteNode and Scene, so Popups work correctly with
  // ScenicView
  final StackPane root = new StackPane(routeNode);

  final Scene scene = new Scene(root);
  stage.setScene(scene);
  routeNode.setRoute(createRoute(stage));
  stage.show();
  routeNode.start(SessionManager.getDefault(routeNode, stage));

} }

`

sandec-bot commented 1 year ago

I don't think this will work - but you can just test it, right? Im also suspicious when this is connected to guice - it doesn't seem right to me. But when we have some time, we can make a sample how to integrate the routing with DI.

Am Mo., 22. Mai 2023 um 08:43 Uhr schrieb Christian Rocholl < @.***>:

Hi,

could you move the RouteApp code to an inteface? This is because my javafx application class is extending a class so DI with guice is initialized.

Could this work? I do a pull request if you want me to ` public interface RouteApp {

Route createRoute();

default WebAPI getWebAPI(Stage stage) { return WebAPI.isBrowser() ? WebAPI.getWebAPI(stage) : null; }

default void startRoute(Stage stage) { final RouteNode routeNode = new RouteNode(stage);

final StackPane root = new StackPane(routeNode);

final Scene scene = new Scene(root); stage.setScene(scene); routeNode.setRoute(createRoute()); stage.show(); routeNode.start(SessionManager.getDefault(routeNode, stage));

} } `

— Reply to this email directly, view it on GitHub https://github.com/JPro-one/jpro-routing/issues/14, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6XXUKN4UTZKDDXBXXZFQ3XHMDJHANCNFSM6AAAAAAYJ7EOTI . You are receiving this because you are subscribed to this thread.Message ID: @.***>