private boolean usePromptText() { Object txt = valueProperty.getValue(); txt = validateComboBox(txt); String promptTxt = promptTextProperty.getValue(); boolean isLabelFloat = control.isLabelFloat(); return isLabelFloat || (promptTxt != null && (txt == null || txt.toString().isEmpty()) && !promptTxt.isEmpty() && !promptTextFill.get().equals(Color.TRANSPARENT)); }
private void updateLabelFloat(boolean animation) { if (control.isLabelFloat()) { if (control.isFocused()) { animateFloatingLabel(true, animation); } else { Object text = valueProperty.getValue(); text = validateComboBox(text); animateFloatingLabel(!(text == null || text.toString().isEmpty()), animation); } } }
public static <T> InvalidationListener addDelayedPropertyInvalidationListener(ObservableValue<T> property, Duration delayTime, Consumer<T> justInTimeConsumer, Consumer<T> delayedConsumer) { Wrapper<T> eventWrapper = new Wrapper<>(); PauseTransition holdTimer = new PauseTransition(delayTime); holdTimer.setOnFinished(event -> delayedConsumer.accept(eventWrapper.content)); final InvalidationListener invalidationListener = observable -> { eventWrapper.content = property.getValue(); justInTimeConsumer.accept(eventWrapper.content); holdTimer.playFromStart(); }; property.addListener(invalidationListener); return invalidationListener; }
public static <T> InvalidationListener addDelayedPropertyInvalidationListener(ObservableValue<T> property, Duration delayTime, Consumer<T> consumer) { Wrapper<T> eventWrapper = new Wrapper<>(); PauseTransition holdTimer = new PauseTransition(delayTime); holdTimer.setOnFinished(event -> consumer.accept(eventWrapper.content)); final InvalidationListener invalidationListener = observable -> { eventWrapper.content = property.getValue(); holdTimer.playFromStart(); }; property.addListener(invalidationListener); return invalidationListener; }
private void unFocus() { focusTimer.stop(); scale.setX(initScale); focusedLine.setOpacity(0); if (control.isLabelFloat()) { animatedPromptTextFill.set(promptTextFill.get()); Object text = valueProperty.getValue(); text = validateComboBox(text); if (text == null || text.toString().isEmpty()) { animating = true; runTimer(unfocusTimer, true); } } }
xpathExpression.getValue() );
@Override protected T computeValue() { for(int i = startAt; i < chain.length; ++i) { T val = chain[i].getValue(); if(val != null) { startAt = i; return val; } } startAt = chain.length; return null; }
@Override protected T computeValue() { return o.getValue(); } };
@Override protected void newSubscriber(Consumer<? super T> consumer) { T val = observable.getValue(); if(val != null) { consumer.accept(val); } } };
@Override protected U computeValue() { return f.apply(src.getValue()); } };
@Nonnull @Override public Stream apply(@Nonnull Stream stream) { Function<? super T, ? extends R> m = mapper.getValue(); requireNonNull(m, ERROR_MAPPER_NULL); return stream.map(m); }
/** * {@inheritDoc} */ @Override public T getValue() { return getObservableValue().getValue(); } }
@Override protected final U computeValue() { setupTargetObservable(); return mapped != null ? mapped.getValue() : null; }
private void removeVisibleItem(ObservableValue<R> cellValue) { if (cellValue != null) { visibleValuesDupeCounter.remove(cellValue.getValue()); } } private void initializeListeners() {
@Nonnull @Override public ObjectBinding<T> reduce(@Nonnull final ObservableValue<BinaryOperator<T>> accumulator) { requireNonNull(accumulator, ERROR_ACCUMULATOR); return createObjectBinding(() -> { BinaryOperator<T> a = accumulator.getValue(); requireNonNull(a, ERROR_ACCUMULATOR); return (T) stream().reduce(a).orElse(null); }, dependencies(accumulator)); }
/** * Binds a topic to a property such that a message is sent whenever the observable-value changes. * * @param topicToBind the topic to bind to the observable value. * @param observableValue the value which is to trigger sending message. */ default <T> void bindTopic(Topic<T> topicToBind, ObservableValue<T> observableValue) { observableValue.addListener((observable) -> submitMessage(topicToBind, observableValue.getValue())); }
@Override protected U computeValue() { if(!nestedSelection.isConnected()) { T rootVal = root.getValue(); if(rootVal == null) { return null; } nestedSelection.connect(rootVal); } return nestedSelection.getValue(); }
public static <T> Observable<Optional<T>> fromNullableObservableValue(final ObservableValue<T> fxObservable) { return Observable.create((ObservableEmitter<Optional<T>> emitter) -> { emitter.onNext(Optional.ofNullable(fxObservable.getValue())); final ChangeListener<T> listener = (observableValue, prev, current) -> emitter.onNext(Optional.ofNullable(current)); fxObservable.addListener(listener); emitter.setDisposable(JavaFxSubscriptions.unsubscribeInEventDispatchThread(() -> fxObservable.removeListener(listener))); }); }