Search in sources :

Example 1 with ToDoView

use of com.canoo.platform.samples.distribution.client.view.ToDoView in project dolphin-platform-examples by canoo.

the class DistributionClient method connect.

private void connect(final Stage primaryStage, final URI endpoint) {
    final ClientContextFactory clientContextFactory = PlatformClient.getService(ClientContextFactory.class);
    final ClientContext clientContext = clientContextFactory.create(PlatformClient.getClientConfiguration(), endpoint);
    clientContext.connect().handle((v, e) -> {
        if (e != null) {
            e.printStackTrace();
            System.exit(-1);
        }
        Platform.runLater(() -> {
            try {
                ToDoView viewController = new ToDoView(clientContext);
                Scene scene = new Scene(viewController.getParent());
                scene.getStylesheets().add(DistributionClient.class.getResource("style.css").toExternalForm());
                primaryStage.setScene(scene);
            } catch (Exception e1) {
                e1.printStackTrace();
                System.exit(-1);
            }
        });
        return null;
    });
}
Also used : ClientContext(com.canoo.platform.remoting.client.ClientContext) Scene(javafx.scene.Scene) ClientContextFactory(com.canoo.platform.remoting.client.ClientContextFactory) ToDoView(com.canoo.platform.samples.distribution.client.view.ToDoView)

Aggregations

ClientContext (com.canoo.platform.remoting.client.ClientContext)1 ClientContextFactory (com.canoo.platform.remoting.client.ClientContextFactory)1 ToDoView (com.canoo.platform.samples.distribution.client.view.ToDoView)1 Scene (javafx.scene.Scene)1