List of usage examples for io.vertx.core Vertx periodicStream
TimeoutStream periodicStream(long delay);
From source file:org.apache.tamaya.examples.distributed.ContentManagerPanel.java
License:Apache License
public ContentManagerPanel(Vertx vertx) { this.vertx = vertx; displayNameField.setMinHeight(30.0); displayNameField.setMinWidth(200.0); displayNameField.setId("displayNameField"); titleField.setMinHeight(30.0);//www. j av a 2s . c o m titleField.setMinWidth(200.0); titleField.setId("title"); titleField.setFont(Font.font("Arial", FontWeight.BOLD, 24)); titleField.setStyle("-fx-text-fill: #EFEFEF; -fx-background-color: black;"); contentField.setId("scene"); contentField.setFont(Font.font("Arial", FontWeight.LIGHT, 18)); getChildren().addAll(selector, new Label("Title"), titleField, new Label("content"), contentField, new Label("Display Name"), displayNameField, new Separator(Orientation.VERTICAL), sendButton); sendButton.setOnAction(h -> { String selection = (String) selector.getSelectionModel().getSelectedItem(); if (selection != null) { String uuid = selection.split("::")[1]; DisplayContent content = new DisplayContent(); content.getContent().put(Display.CONTENT_FIELD, contentField.getText()); content.setTitle(titleField.getText()); content.setDisplayId(uuid); content.setDisplayName(displayNameField.getText()); vertx.eventBus().publish(Display.DISPLAY_SHOW_TOPIC, Json.encode(content)); } }); selector.setOnAction(h -> { String selection = (String) selector.getSelectionModel().getSelectedItem(); if (selection != null) { displayNameField.setText(selection.split("::")[0]); } }); updateList(); vertx.periodicStream(5000).handler(h -> { updateList(); }); }