List of usage examples for javafx.scene.control Label textProperty
public final StringProperty textProperty()
From source file:de.chaosfisch.uploader.gui.renderer.ProgressNodeRenderer.java
@Inject public ProgressNodeRenderer(final Configuration configuration) { final Label progressInfo = LabelBuilder.create().build(); progressInfo.textProperty().bind(progressBar.progressProperty().multiply(100).asString("%.2f%%")); progressInfo.setAlignment(Pos.CENTER_LEFT); progressInfo.prefWidthProperty().bind(progressBar.widthProperty().subtract(6)); progressEta.alignmentProperty().set(Pos.CENTER_RIGHT); progressEta.prefWidthProperty().bind(progressBar.widthProperty().subtract(6)); progressFinish.alignmentProperty().set(Pos.CENTER_RIGHT); progressFinish.prefWidthProperty().bind(progressBar.widthProperty().subtract(6)); progressFinish.setVisible(configuration.getBoolean(DISPLAY_PROGRESS, false)); progressBytes.setVisible(configuration.getBoolean(DISPLAY_PROGRESS, false)); progressSpeed.setVisible(!configuration.getBoolean(DISPLAY_PROGRESS, false)); progressEta.setVisible(!configuration.getBoolean(DISPLAY_PROGRESS, false)); getChildren().addAll(progressBar, progressInfo, progressEta, progressSpeed, progressFinish, progressBytes); setOnMouseEntered(new EventHandler<MouseEvent>() { @Override//from w w w . java 2 s . com public void handle(final MouseEvent me) { progressFinish.setVisible(!configuration.getBoolean(DISPLAY_PROGRESS, false)); progressBytes.setVisible(!configuration.getBoolean(DISPLAY_PROGRESS, false)); progressSpeed.setVisible(configuration.getBoolean(DISPLAY_PROGRESS, false)); progressEta.setVisible(configuration.getBoolean(DISPLAY_PROGRESS, false)); } }); setOnMouseExited(new EventHandler<MouseEvent>() { @Override public void handle(final MouseEvent me) { progressFinish.setVisible(configuration.getBoolean(DISPLAY_PROGRESS, false)); progressBytes.setVisible(configuration.getBoolean(DISPLAY_PROGRESS, false)); progressSpeed.setVisible(!configuration.getBoolean(DISPLAY_PROGRESS, false)); progressEta.setVisible(!configuration.getBoolean(DISPLAY_PROGRESS, false)); } }); }
From source file:de.ks.binding.Binding.java
public void registerClearOnRefresh(Label overTime) { clearOnRefresh.add(overTime.textProperty()); }
From source file:gov.va.isaac.gui.preferences.PreferencesViewController.java
public void aboutToShow() { // Using allValid_ to prevent rerunning content of aboutToShow() if (allValid_ == null) { // These listeners are for debug and testing only. They may be removed at any time. UserProfileBindings userProfileBindings = AppContext.getService(UserProfileBindings.class); for (Property<?> property : userProfileBindings.getAll()) { property.addListener(new ChangeListener<Object>() { @Override// w w w . j a v a2 s. c o m public void changed(ObservableValue<? extends Object> observable, Object oldValue, Object newValue) { logger.debug("{} property changed from {} to {}", property.getName(), oldValue, newValue); } }); } // load fields before initializing allValid_ // in case plugin.validationFailureMessageProperty() initialized by getNode() tabPane_.getTabs().clear(); List<PreferencesPluginViewI> sortableList = new ArrayList<>(); Comparator<PreferencesPluginViewI> comparator = new Comparator<PreferencesPluginViewI>() { @Override public int compare(PreferencesPluginViewI o1, PreferencesPluginViewI o2) { if (o1.getTabOrder() == o2.getTabOrder()) { return o1.getName().compareTo(o2.getName()); } else { return o1.getTabOrder() - o2.getTabOrder(); } } }; for (PreferencesPluginViewI plugin : plugins_) { sortableList.add(plugin); } Collections.sort(sortableList, comparator); for (PreferencesPluginViewI plugin : sortableList) { logger.debug("Adding PreferencesPluginView tab \"{}\"", plugin.getName()); Label tabLabel = new Label(plugin.getName()); tabLabel.setMaxHeight(Double.MAX_VALUE); tabLabel.setMaxWidth(Double.MAX_VALUE); Tab pluginTab = new Tab(); pluginTab.setGraphic(tabLabel); Region content = plugin.getContent(); content.setMaxWidth(Double.MAX_VALUE); content.setMaxHeight(Double.MAX_VALUE); content.setPadding(new Insets(5.0)); Label errorMessageLabel = new Label(); errorMessageLabel.textProperty().bind(plugin.validationFailureMessageProperty()); errorMessageLabel.setAlignment(Pos.BOTTOM_CENTER); TextErrorColorHelper.setTextErrorColor(errorMessageLabel); VBox vBox = new VBox(); vBox.getChildren().addAll(errorMessageLabel, content); vBox.setMaxWidth(Double.MAX_VALUE); vBox.setAlignment(Pos.TOP_CENTER); plugin.validationFailureMessageProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { if (newValue != null && !StringUtils.isEmpty(newValue)) { TextErrorColorHelper.setTextErrorColor(tabLabel); } else { TextErrorColorHelper.clearTextErrorColor(tabLabel); } } }); //Initialize, if stored value is wrong if (StringUtils.isNotEmpty(plugin.validationFailureMessageProperty().getValue())) { TextErrorColorHelper.setTextErrorColor(tabLabel); } pluginTab.setContent(vBox); tabPane_.getTabs().add(pluginTab); } allValid_ = new ValidBooleanBinding() { { ArrayList<ReadOnlyStringProperty> pluginValidationFailureMessages = new ArrayList<>(); for (PreferencesPluginViewI plugin : plugins_) { pluginValidationFailureMessages.add(plugin.validationFailureMessageProperty()); } bind(pluginValidationFailureMessages .toArray(new ReadOnlyStringProperty[pluginValidationFailureMessages.size()])); setComputeOnInvalidate(true); } @Override protected boolean computeValue() { for (PreferencesPluginViewI plugin : plugins_) { if (plugin.validationFailureMessageProperty().get() != null && plugin.validationFailureMessageProperty().get().length() > 0) { this.setInvalidReason(plugin.validationFailureMessageProperty().get()); logger.debug("Setting PreferencesView allValid_ to false because \"{}\"", this.getReasonWhyInvalid().get()); return false; } } logger.debug("Setting PreferencesView allValid_ to true"); this.clearInvalidReason(); return true; } }; okButton_.disableProperty().bind(allValid_.not()); // set focus on default // Platform.runLater(...); } // Reload persisted values every time view opened for (PreferencesPluginViewI plugin : plugins_) { plugin.getContent(); } }
From source file:com.rcs.shoe.shop.fx.controller.ui.NewProductController.java
private void setQuantities(List<V_ProductHistory> quantities) { for (V_ProductHistory quantity : quantities) { TextField tx = quantityFields.get("text" + quantity.getSize()); tx.textProperty().setValue(quantity.getQuantity().toString()); Label label = quantityLabels.get("label" + quantity.getSize()); label.textProperty().setValue(quantity.getQuantity().toString()); }//from w w w .j av a 2s . c o m }
From source file:com.rcs.shoe.shop.fx.controller.ui.NewProductController.java
private List<ProductHistory> getProductQuantity() { List<ProductHistory> result = new ArrayList<>(); for (TextField tx : quantityFields.values()) { Label label = quantityLabels.get(tx.getId().replaceFirst("text", "label")); Integer oldValue = new Integer(label.textProperty().getValue().trim()); Integer newValue = new Integer(tx.textProperty().getValue().trim()); if (oldValue > newValue) { ProductHistory quantityHistory = new ProductHistory(); quantityHistory.setProductNum(Integer.parseInt(produstNumber.getText())); if (storedProduct != null) { quantityHistory.setProductCode(storedProduct.getProductCode()); } else { quantityHistory.setProductCode(productCode.getText()); }/*from w w w . j av a2 s . c om*/ quantityHistory.setSize(getSize(tx)); quantityHistory.setType(2); quantityHistory.setQuantity(newValue - oldValue); result.add(quantityHistory); } else if (oldValue < newValue) { ProductHistory quantityHistory = new ProductHistory(); quantityHistory.setProductCode(productCode.getText()); quantityHistory.setProductNum(Integer.parseInt(produstNumber.getText())); if (storedProduct != null) { quantityHistory.setProductCode(storedProduct.getProductCode()); } else { quantityHistory.setProductCode(productCode.getText()); } quantityHistory.setSize(getSize(tx)); quantityHistory.setType(1); quantityHistory.setQuantity(newValue - oldValue); result.add(quantityHistory); } } return result; }
From source file:eu.over9000.skadi.ui.dialogs.PerformUpdateDialog.java
public PerformUpdateDialog(RemoteVersionResult newVersion) { this.chosen = new SimpleObjectProperty<>( Paths.get(SystemUtils.USER_HOME, newVersion.getVersion() + ".jar").toFile()); this.setHeaderText("Updating to " + newVersion.getVersion()); this.setTitle("Skadi Updater"); this.getDialogPane().getStyleClass().add("alert"); this.getDialogPane().getStyleClass().add("information"); final ButtonType restartButtonType = new ButtonType("Start New Version", ButtonBar.ButtonData.OK_DONE); this.getDialogPane().getButtonTypes().addAll(restartButtonType, ButtonType.CANCEL); Node btn = this.getDialogPane().lookupButton(restartButtonType); btn.setDisable(true);/*www .ja v a 2s . c o m*/ Label lbPath = new Label("Save as"); TextField tfPath = new TextField(); tfPath.textProperty() .bind(Bindings.createStringBinding(() -> this.chosen.get().getAbsolutePath(), this.chosen)); tfPath.setPrefColumnCount(40); tfPath.setEditable(false); Button btChangePath = GlyphsDude.createIconButton(FontAwesomeIcons.FOLDER_OPEN, "Browse..."); btChangePath.setOnAction(event -> { FileChooser fc = new FileChooser(); fc.setTitle("Save downloaded jar.."); fc.setInitialFileName(this.chosen.getValue().getName()); fc.getExtensionFilters().add(new FileChooser.ExtensionFilter("Jar File", ".jar")); fc.setInitialDirectory(this.chosen.getValue().getParentFile()); File selected = fc.showSaveDialog(this.getOwner()); if (selected != null) { this.chosen.set(selected); } }); ProgressBar pbDownload = new ProgressBar(0); pbDownload.setDisable(true); pbDownload.setMaxWidth(Double.MAX_VALUE); Label lbDownload = new Label("Download"); Label lbDownloadValue = new Label(); Button btDownload = GlyphsDude.createIconButton(FontAwesomeIcons.DOWNLOAD, "Start"); btDownload.setMaxWidth(Double.MAX_VALUE); btDownload.setOnAction(event -> { btChangePath.setDisable(true); btDownload.setDisable(true); this.downloadService = new DownloadService(newVersion.getDownloadURL(), this.chosen.getValue()); lbDownloadValue.textProperty().bind(this.downloadService.messageProperty()); pbDownload.progressProperty().bind(this.downloadService.progressProperty()); this.downloadService.setOnSucceeded(dlEvent -> { btn.setDisable(false); }); this.downloadService.setOnFailed(dlFailed -> { LOGGER.error("new version download failed", dlFailed.getSource().getException()); lbDownloadValue.textProperty().unbind(); lbDownloadValue.setText("Download failed, check log file for details."); }); this.downloadService.start(); }); final GridPane grid = new GridPane(); grid.setHgap(10); grid.setVgap(10); grid.add(lbPath, 0, 0); grid.add(tfPath, 1, 0); grid.add(btChangePath, 2, 0); grid.add(new Separator(), 0, 1, 3, 1); grid.add(lbDownload, 0, 2); grid.add(pbDownload, 1, 2); grid.add(btDownload, 2, 2); grid.add(lbDownloadValue, 1, 3); this.getDialogPane().setContent(grid); this.setResultConverter(btnType -> { if (btnType == restartButtonType) { return this.chosen.getValue(); } if (btnType == ButtonType.CANCEL) { if (this.downloadService.isRunning()) { this.downloadService.cancel(); } } return null; }); }
From source file:io.bitsquare.app.BitsquareApp.java
private void showFPSWindow() { Label label = new Label(); EventStreams.animationTicks().latestN(100).map(ticks -> { int n = ticks.size() - 1; return n * 1_000_000_000.0 / (ticks.get(n) - ticks.get(0)); }).map(d -> String.format("FPS: %.3f", d)).feedTo(label.textProperty()); Pane root = new StackPane(); root.getChildren().add(label);//from ww w.j ava 2 s.c o m Stage stage = new Stage(); stage.setScene(new Scene(root)); stage.setTitle("FPS"); stage.initModality(Modality.NONE); stage.initStyle(StageStyle.UTILITY); stage.initOwner(scene.getWindow()); stage.setX(primaryStage.getX() + primaryStage.getWidth() + 10); stage.setY(primaryStage.getY()); stage.setWidth(200); stage.setHeight(100); stage.show(); }
From source file:com.rcs.shoe.shop.fx.controller.ui.SaleEnterController.java
private void setQuantities(Map<Integer, V_ProductHistory> map) { for (Label label : quantityLabels.values()) { Button button = quantityButtons.get("button" + getSize(label)); V_ProductHistory quantity = map.get(getSize(label)); if (quantity != null && quantity.getQuantity() > 0) { button.setOnAction(new EventHandler<ActionEvent>() { @Override// w ww . j av a2 s .co m public void handle(ActionEvent e) { enterSale(button); } }); button.setDefaultButton(true); label.textProperty().setValue(quantity.getQuantity().toString()); } else { button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { noQuantitySale(); } }); button.setDefaultButton(false); label.textProperty().setValue("0"); } } }
From source file:AudioPlayer3.java
@Override protected Node initView() { final Label title = createLabel("title"); final Label artist = createLabel("artist"); final Label album = createLabel("album"); final Label year = createLabel("year"); final ImageView albumCover = createAlbumCover(); title.textProperty().bind(songModel.titleProperty()); artist.textProperty().bind(songModel.artistProperty()); album.textProperty().bind(songModel.albumProperty()); year.textProperty().bind(songModel.yearProperty()); albumCover.imageProperty().bind(songModel.albumCoverProperty()); final GridPane gp = new GridPane(); gp.setPadding(new Insets(10)); gp.setHgap(20);/*from w w w .ja v a 2 s . co m*/ gp.add(albumCover, 0, 0, 1, GridPane.REMAINING); gp.add(title, 1, 0); gp.add(artist, 1, 1); gp.add(album, 1, 2); gp.add(year, 1, 3); final ColumnConstraints c0 = new ColumnConstraints(); final ColumnConstraints c1 = new ColumnConstraints(); c1.setHgrow(Priority.ALWAYS); gp.getColumnConstraints().addAll(c0, c1); final RowConstraints r0 = new RowConstraints(); r0.setValignment(VPos.TOP); gp.getRowConstraints().addAll(r0, r0, r0, r0); return gp; }
From source file:mesclasses.view.JourneeController.java
/** * dessine la grid sanctions/*from ww w. java2 s. c o m*/ * @param eleve * @param rowIndex */ private void drawSanctions(Eleve eleve, int rowIndex) { EleveData eleveData = seanceSelect.getValue().getDonnees().get(eleve); drawEleveName(sanctionsGrid, eleve, rowIndex); if (!eleve.isInClasse(currentDate.getValue())) { return; } HBox punitionsBox = new HBox(); punitionsBox.setAlignment(Pos.CENTER_LEFT); TextFlow nbPunitions = new TextFlow(); Label nbPunitionLabel = new Label( "" + eleve.getPunitions().stream().filter(p -> p.getSeance() == seanceSelect.getValue()).count()); nbPunitionLabel.setPrefHeight(20); nbPunitions.getChildren().add(new Label(" (")); nbPunitions.getChildren().add(nbPunitionLabel); nbPunitions.getChildren().add(new Label(")")); nbPunitions.visibleProperty().bind(nbPunitionLabel.textProperty().isNotEqualTo("0")); nbPunitions.managedProperty().bind(nbPunitionLabel.textProperty().isNotEqualTo("0")); Button punitionBtn = Btns.punitionBtn(); punitionBtn.setOnAction((event) -> { if (openPunitionDialog(eleve)) { int nbPunition = Integer.parseInt(nbPunitionLabel.getText()); nbPunitionLabel.setText("" + (nbPunition + 1)); } }); punitionsBox.getChildren().add(punitionBtn); punitionsBox.getChildren().add(nbPunitions); sanctionsGrid.add(punitionsBox, 3, rowIndex, HPos.LEFT); CheckBox motCarnet = new CheckBox(); Label cumulMot = new Label(); motCarnet.setSelected(model.getMotForSeance(eleve, seanceSelect.getValue()) != null); motCarnet.selectedProperty().addListener((ob, o, checked) -> { Mot mot = model.getMotForSeance(eleve, seanceSelect.getValue()); if (checked && mot == null) { model.createMot(eleve, seanceSelect.getValue()); } else if (mot != null) { model.delete(mot); } writeAndMarkInRed(cumulMot, stats.getMotsUntil(eleve, currentDate.getValue()).size(), 3); }); sanctionsGrid.add(motCarnet, 4, rowIndex, null); writeAndMarkInRed(cumulMot, stats.getMotsUntil(eleve, currentDate.getValue()).size(), 3); sanctionsGrid.add(cumulMot, 5, rowIndex, null); CheckBox exclus = new CheckBox(); TextField motif = new TextField(); Bindings.bindBidirectional(exclus.selectedProperty(), eleveData.exclusProperty()); sanctionsGrid.add(exclus, 6, rowIndex, null); exclus.selectedProperty().addListener((o, oldV, newV) -> { if (!newV && StringUtils.isNotBlank(motif.getText()) && ModalUtil.confirm("Effacer le motif ?", "Effacer le motif ?")) { motif.clear(); } }); Bindings.bindBidirectional(motif.textProperty(), eleveData.MotifProperty()); motif.textProperty().addListener((o, oldV, newV) -> { if (StringUtils.isNotBlank(newV)) { exclus.setSelected(true); } }); GridPane.setMargin(motif, new Insets(0, 10, 0, 0)); sanctionsGrid.add(motif, 7, rowIndex, HPos.LEFT); }