javafx.beans.value.ObservableStringValue Java Examples

The following examples show how to use javafx.beans.value.ObservableStringValue. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Bindings.java    From SmartModInserter with GNU Lesser General Public License v3.0 7 votes vote down vote up
/**
 * Returns a new observable string which contains either the contents of ifTrue, or ifFalse, depending on the condition
 * @param condition
 * @param ifTrue
 * @param ifFalse
 * @return
 */
public static ObservableStringValue decision(ObservableBooleanValue condition,
                                             ObservableStringValue ifTrue,
                                             ObservableStringValue ifFalse) {
    StringProperty ret = new SimpleStringProperty();
    condition.addListener((obs, ov, nv) -> {
        ret.set(nv ? ifTrue.get() : ifFalse.get());
    });
    ifTrue.addListener((obs, ov, nv) -> {
        if (condition.get()) {
            ret.set(nv);
        }
    });
    ifFalse.addListener((obs, ov, nv) -> {
        if (!condition.get()) {
            ret.set(nv);
        }
    });
    ret.set(condition.get() ? ifTrue.get() : ifFalse.get());

    return ret;
}
 
Example #2
Source File: PositionDescriptionTool.java    From VocabHunter with Apache License 2.0 5 votes vote down vote up
public ObservableStringValue createBinding(final PositionModel position, final ProgressModel progress) {
    return createStringBinding(
        () -> describe(position, progress),
        position.positionIndexProperty(),
        position.sizeProperty(),
        position.analysisModeProperty(),
        position.editableProperty(),
        progress.unseenFilteredProperty());
}
 
Example #3
Source File: StringBinding.java    From ReactFX with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * @deprecated Use {@link Val#suspendable(javafx.beans.value.ObservableValue)}.
 */
@Deprecated
public static StringBinding wrap(ObservableStringValue source) {
    return new StringBinding() {
        { bind(source); }

        @Override
        protected String computeValue() { return source.get(); }
    };
}
 
Example #4
Source File: MetaPanel.java    From paintera with GNU General Public License v2.0 4 votes vote down vote up
public double[] asArray(final ObservableStringValue... values)
{
	return Arrays.stream(values).map(ObservableValue::getValue).mapToDouble(Double::parseDouble).toArray();
}
 
Example #5
Source File: GenericBackendDialogN5.java    From paintera with GNU General Public License v2.0 4 votes vote down vote up
public ObservableStringValue nameProperty()
{
	return name;
}
 
Example #6
Source File: PositionDescriptionToolTest.java    From VocabHunter with Apache License 2.0 4 votes vote down vote up
private void validate(final String s) {
    ObservableStringValue result = target.createBinding(position, progress);

    assertEquals(s, result.getValue());
}
 
Example #7
Source File: BackendDialog.java    From paintera with GNU General Public License v2.0 votes vote down vote up
public ObservableStringValue nameProperty();