protected void onEval() { Node control = getSrcControl(); if (hasErrors.get()) { if (!control.getStyleClass().contains(errorStyleClass.get())) control.getStyleClass().add(errorStyleClass.get()); } else { control.getStyleClass().remove(errorStyleClass.get()); } }
@Override public void initialize(URL url, ResourceBundle resourceBundle) { Random random = new Random(); random.setSeed(System.currentTimeMillis()); Singleton.INSTANCE.magicNumber = random.nextLong(); Singleton.INSTANCE.rightPairs = new ArrayList<String>(); Singleton.INSTANCE.balloons = FXCollections.observableArrayList(); Singleton.INSTANCE.pontosPlayer1 = 0; Singleton.INSTANCE.pontosPlayer2 = 0; this.imagesGridPane.setDisable(true); this.messagesListView.setDisable(true); this.messageInputField.setDisable(true); this.enviarButton.setDisable(true); for (Node node : this.imagesGridPane.getChildren()) { node.getStyleClass().addAll("imageview", "imageview:hover"); } this.messagesListView.setItems(Singleton.INSTANCE.balloons); this.ipAddressLabel.setText( String.format( "Endereço IP: %s:%d", Singleton.INSTANCE.localIPAddress, Singleton.INSTANCE.localIMServerPort)); }
private void setColors() { Scenario scenario = (Scenario) Applicazione.getInstance().getModello().getBean(Scenario.class.getName()); for (int i = 0; i < chart.getData().size(); i++) { for (Node node : chart.lookupAll(".series" + i)) { node.getStyleClass().remove("default-color" + i); node.getStyleClass() .add("default-color" + mapColor.get(scenario.getToolsList().get(i).getName())); } int item = 0; for (Node node : chart.lookupAll(".chart-legend-item")) { if (node instanceof Label && ((Label) node).getGraphic() != null) { String color = mapColor.get(scenario.getToolsList().get(item).getName()); if (color != null && !color.isEmpty()) { ((Label) node).getGraphic().getStyleClass().remove("default-color" + item); ((Label) node).getGraphic().getStyleClass().add("default-color" + color); } } item++; } } }
public void setContent(Node content) { content.getStyleClass().add("bordered-titled-content"); contentPane.getChildren().add(content); }
public void setIcon(Node icon) { icon.getStyleClass().add("errorIcon"); this.icon.set(icon); }
/** * Add a slide item by managing level. * * @param vbox the layout node * @param item the slide item to add */ protected void addSlideItem(final VBox vbox, final SlideItem item) { Node node = null; if (item.isLink()) { final Hyperlink link = HyperlinkBuilder.create().opacity(1.0).text(item.getValue()).build(); link.getStyleClass().add("link" + item.getLevel()); link.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent e) { final ClipboardContent content = new ClipboardContent(); content.putString("http://" + ((Hyperlink) e.getSource()).getText()); Clipboard.getSystemClipboard().setContent(content); } }); node = link; } else if (item.isHtml()) { final WebView web = WebViewBuilder.create() .fontScale(1.4) // .effect(ReflectionBuilder.create().fraction(0.4).build()) .build(); web.getEngine().loadContent(item.getValue()); VBox.setVgrow(web, Priority.NEVER); node = web; // StackPaneBuilder.create().children(web).style("-fx-border-width:2;-fx-border-color:#000000").build(); } else if (item.getImage() != null) { final Image image = Resources.create(new RelImage(item.getImage())).get(); final ImageView imageViewer = ImageViewBuilder.create() .styleClass(ITEM_CLASS_PREFIX + item.getLevel()) .image(image) // .effect(ReflectionBuilder.create().fraction(0.9).build()) .build(); node = imageViewer; } else { final Text text = TextBuilder.create() .styleClass(ITEM_CLASS_PREFIX + item.getLevel()) .text(item.getValue() == null ? "" : item.getValue()) .build(); node = text; } if (item.getStyle() != null) { node.getStyleClass().add(item.getStyle()); } if (item.getScale() != 1.0) { node.setScaleX(item.getScale()); node.setScaleY(item.getScale()); } vbox.getChildren().add(node); }