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;
});
}
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);
}
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;
});
}
Aggregations