/*************************************************************************** * * Setters / Getters * * **************************************************************************/ public void setControl(Node control) { if (control != null) { this.control = control; this.badge = new Group(); this.getChildren().add(control); this.getChildren().add(badge); // if the control got resized the badge must be rest if (control instanceof Region) { ((Region) control).widthProperty().addListener((o, oldVal, newVal) -> refreshBadge()); ((Region) control).heightProperty().addListener((o, oldVal, newVal) -> refreshBadge()); } text.addListener((o, oldVal, newVal) -> refreshBadge()); } }
/** * @param changeListener */ public void addValueChangeListner(ChangeListener changeListener) { if (owner != null) { owner.initialInternalValueProperty().addListener(changeListener); } }
public InlineHTML() { getStyleClass().add("inline-html"); view = new WebView(); getChildren().add(view); content.addListener((observable, oldValue, newValue) -> view.getEngine().loadContent(newValue)); }
/** * Can be used to bind a double property to a string property */ @Nonnull public static Property<String> double2stringBiDirectional(@Nonnull DoubleProperty doubleProperty) { SimpleStringProperty stringProperty = new SimpleStringProperty(); stringProperty.addListener((observable, oldValue, newValue) -> { try { double doubleValue = string2double(newValue); doubleProperty.setValue(doubleValue); } catch (ParseException e) { //Enforce the old values if can not be parsed stringProperty.setValue(oldValue); } }); doubleProperty.addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { try { double oldValueFromString = string2double(stringProperty.get()); if (oldValueFromString == newValue.doubleValue()) { return; } } catch (ParseException ignore) { } stringProperty.setValue(NumberFormat.getInstance().format(newValue.doubleValue())); } }); return stringProperty; }
/** * @{inheritedDoc} */ @Override public void build(IInputComponentWrapper inputComponentWrapper) { super.build(inputComponentWrapper); // the type of value to display treatFlow(inputComponentWrapper.getCurrentInternalValue()); inputComponentWrapper.currentInternalValueProperty().addListener((ChangeListener<String>) (observable, oldValue, newValue) -> { treatFlow(newValue); }); }
/*************************************************************************** * * Setters / Getters * * **************************************************************************/ public void setControl(Node control) { if (control != null) { this.control = control; this.badge = new Group(); this.getChildren().add(control); this.getChildren().add(badge); // if the control got resized the badge must be rest if (control instanceof Region) { ((Region) control).widthProperty().addListener((o, oldVal, newVal) -> refreshBadge()); ((Region) control).heightProperty().addListener((o, oldVal, newVal) -> refreshBadge()); } text.addListener((o, oldVal, newVal) -> refreshBadge()); } }
/** * @{inheritedDoc} */ @Override public void build(IInputComponentWrapper inputComponentWrapper) { super.build(inputComponentWrapper); // NodeHelper.styleClassAddAll(label, getConfiguration(), "viewStyleClass", "form-info-value"); process("/Application"); if(AbstractApplicationRunner.isDesktop()) { // TODO HANDLE TOOLTIP b.setMaxWidth(400); b.setAlignment(Pos.CENTER_RIGHT); } inputComponentWrapper.currentInternalValueProperty().addListener((ChangeListener<String>) (observable, oldValue, newValue) -> { //label.setText(((StringConverter) inputComponentWrapper.getConverter()).toDisplay(newValue)); }); }
/** * @{inheritedDoc} */ @Override public void build(IInputComponentWrapper inputComponentWrapper) { super.build(inputComponentWrapper); // NodeHelper.styleClassAddAll(label, getConfiguration(), "viewStyleClass", "form-info-value"); process("/Application"); if(AbstractApplicationRunner.isDesktop()) { // TODO HANDLE TOOLTIP b.setMaxWidth(400); b.setAlignment(Pos.CENTER_RIGHT); } inputComponentWrapper.currentInternalValueProperty().addListener((ChangeListener<String>) (observable, oldValue, newValue) -> { //label.setText(((StringConverter) inputComponentWrapper.getConverter()).toDisplay(newValue)); }); }
DownloadVersion.oldVersionProperty.addListener((v, o, n) ->{ taskSync(()->{ oldVersion.setText(n); }); }); DownloadVersion.newVersionProperty.addListener((v, o, n) ->{ taskSync(()->{ newVersion.setText(n); }); }); DownloadVersion.relativeFilePathProperty.addListener((v, o, n) ->{ taskSync(()->{ relativeFilePath.setText(n);
/** * @{inheritedDoc} */ @Override public void build(IInputComponentWrapper inputComponentWrapper) { super.build(inputComponentWrapper); label.textProperty().unbind(); label.setWrapText(true); NodeHelper.styleClassAddAll(label, getConfiguration(), "viewStyleClass", "form-info-value"); inputComponentWrapper.currentInternalValueProperty().addListener((ChangeListener<String>) (observable, oldValue, newValue) -> { updateValue(newValue); }); final String stringDatePeriod = inputComponentWrapper.getCurrentInternalValue(); updateValue(stringDatePeriod); }
public Fieldset() { getStyleClass().add("fieldset"); syncOrientationState(); // Add legend label when text is populated textProperty().addListener((observable, oldValue, newValue) -> { if (newValue != null && !newValue.isEmpty() ) addLegend(); }); // Add legend when icon is populated iconProperty().addListener(((observable1, oldValue1, newValue) -> { if (newValue != null) addLegend(); })); // Make sure input children get the configured HBox.hgrow property syncHgrow(); // Register/deregister with parent Form parentProperty().addListener( (observable, oldParent, newParent) -> { if( !(oldParent instanceof Form) ) { Form oldParentForm = NodeHelper.findParentOfType(oldParent, Form.class); if( oldParentForm != null ) { oldParentForm.getChildren().remove(this); } } if( !(newParent instanceof Form ) ) { Form newParentForm = NodeHelper.findParentOfType(newParent, Form.class); if( newParentForm != null ) { newParentForm.getChildren().remove(this); } } }); }
/** * @{inheritedDoc} */ @Override public void build(IInputComponentWrapper inputComponentWrapper) { super.build(inputComponentWrapper); NodeHelper.styleClassAddAll(label, getConfiguration(), "viewStyleClass", "form-info-value"); label.setText(((StringConverter) inputComponentWrapper.getConverter()).toDisplay(inputComponentWrapper.getCurrentInternalValue())); if(AbstractApplicationRunner.isDesktop()) { // TODO HANDLE TOOLTIP label.setMaxWidth(400); } inputComponentWrapper.currentInternalValueProperty().addListener((ChangeListener<String>) (observable, oldValue, newValue) -> { label.setText(((StringConverter) inputComponentWrapper.getConverter()).toDisplay(newValue)); }); }
/** * @{inheritedDoc} */ @Override public void build(IInputComponentWrapper inputComponentWrapper) { super.build(inputComponentWrapper); label.textProperty().unbind(); label.setWrapText(true); NodeHelper.styleClassAddAll(label, getConfiguration(), "viewStyleClass", "form-info-value"); // convert saved date to displayed date LocalDate currval = (LocalDate) inputComponentWrapper.getConverter().fromString(inputComponentWrapper.getCurrentInternalValue()); label.setText(toDisplayFormat(currval)); inputComponentWrapper.currentInternalValueProperty().addListener((ChangeListener) (observable, oldValue, newValue) -> { LocalDate val = (LocalDate) inputComponentWrapper.getConverter().fromString((String) newValue); label.setText(toDisplayFormat(val)); }); }