Search in sources :

Example 1 with ClientContextFactory

use of com.canoo.platform.remoting.client.ClientContextFactory 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)

Example 2 with ClientContextFactory

use of com.canoo.platform.remoting.client.ClientContextFactory in project dolphin-platform-examples by canoo.

the class Client method createClientContext.

private final ClientContext createClientContext(final URI endpoint) throws Exception {
    final ClientConfiguration clientConfiguration = PlatformClient.getClientConfiguration();
    final ClientContextFactory clientContextFactory = PlatformClient.getService(ClientContextFactory.class);
    return clientContextFactory.create(clientConfiguration, endpoint);
}
Also used : ClientContextFactory(com.canoo.platform.remoting.client.ClientContextFactory) ClientConfiguration(com.canoo.platform.client.ClientConfiguration)

Example 3 with ClientContextFactory

use of com.canoo.platform.remoting.client.ClientContextFactory in project dolphin-platform-examples by canoo.

the class Client method showApp.

private void showApp(final Stage primaryStage) throws Exception {
    final ClientConfiguration clientConfiguration = PlatformClient.getClientConfiguration();
    final ClientContextFactory contextFactory = PlatformClient.getService(ClientContextFactory.class);
    final URI endpoint = new URI("http://localhost:8080/dolphin");
    final ClientContext clientContext = contextFactory.create(clientConfiguration, endpoint);
    clientContext.connect().handle((v, e) -> {
        final UserView view = new UserView(clientContext);
        Platform.runLater(() -> {
            primaryStage.setScene(new Scene(view.getParent()));
            primaryStage.show();
        });
        return null;
    });
}
Also used : ClientContext(com.canoo.platform.remoting.client.ClientContext) Scene(javafx.scene.Scene) ClientContextFactory(com.canoo.platform.remoting.client.ClientContextFactory) URI(java.net.URI) ClientConfiguration(com.canoo.platform.client.ClientConfiguration)

Aggregations

ClientContextFactory (com.canoo.platform.remoting.client.ClientContextFactory)3 ClientConfiguration (com.canoo.platform.client.ClientConfiguration)2 ClientContext (com.canoo.platform.remoting.client.ClientContext)2 Scene (javafx.scene.Scene)2 ToDoView (com.canoo.platform.samples.distribution.client.view.ToDoView)1 URI (java.net.URI)1