/** * Exposes the size of this collection as a value. */ public synchronized ValueView<Integer> sizeView () { if (_sizeView == null) { _sizeView = Value.create(size()); } return _sizeView; }
public final Value<Element<?>> selected = Value.create(null);
/** * Exposes the size of this collection as a value. */ public synchronized ValueView<Integer> sizeView () { if (_sizeView == null) { _sizeView = Value.create(size()); } return _sizeView; }
/** Returns a value that indicates whether this future has completed. */ public ValueView<Boolean> isComplete () { if (_isCompleteView == null) { final Value<Boolean> isCompleteView = Value.create(false); onComplete(new SignalView.Listener<Try<T>>() { public void onEmit (Try<T> result) { isCompleteView.update(true); } }); _isCompleteView = isCompleteView; } return _isCompleteView; }
/** Returns a value that indicates whether this future has completed. */ public ValueView<Boolean> isComplete () { if (_isCompleteView == null) { final Value<Boolean> isCompleteView = Value.create(false); onComplete(new SignalView.Listener<Try<T>>() { public void onEmit (Try<T> result) { isCompleteView.update(true); } }); _isCompleteView = isCompleteView; } return _isCompleteView; }
protected Screen (Game game) { _game = game; _sizeValue = Value.create(size()); }
public Slider (float value, float min, float max) { this.value = Value.create(value); range = Value.create(new Range(min, max)); // update our display if the slider value is changed externally UnitSlot updateThumb = new UnitSlot () { @Override public void onEmit () { updateThumb(); }}; this.value.connect(updateThumb); range.connect(updateThumb); }
public Screen (Game game) { layer.setName(Screen.this + " layer"); _game = game; _sizeValue = Value.create(size()); }
/** * Exposes the specified property as a {@link Value}. The supplied default value will be used * if the property has no current value. Updates to the value will be written back to the * storage system. Note that each call to this method yields a new {@link Value} and those * values will not coordinate with one another, so the caller must be sure to only call this * method once for a given property and share that value properly. */ public <E extends Enum<E>> Value<E> valueFor (final String key, E defval) { Value<E> value = Value.create(get(key, defval)); value.connect(new Slot<E>() { @Override public void onEmit (E value) { set(key, value); } }); return value; }
/** * Exposes the specified property as a {@link Value}. The supplied default value will be used * if the property has no current value. Updates to the value will be written back to the * storage system. Note that each call to this method yields a new {@link Value} and those * values will not coordinate with one another, so the caller must be sure to only call this * method once for a given property and share that value properly. */ public Value<String> valueFor (final String key, String defval) { Value<String> value = Value.create(get(key, defval)); value.connect(new Slot<String>() { @Override public void onEmit (String value) { set(key, value); } }); return value; }
/** * Exposes the specified property as a {@link Value}. The supplied default value will be used * if the property has no current value. Updates to the value will be written back to the * storage system. Note that each call to this method yields a new {@link Value} and those * values will not coordinate with one another, so the caller must be sure to only call this * method once for a given property and share that value properly. */ public Value<Long> valueFor (final String key, long defval) { Value<Long> value = Value.create(get(key, defval)); value.connect(new Slot<Long>() { @Override public void onEmit (Long value) { set(key, value); } }); return value; }
/** * Exposes the specified property as a {@link Value}. The supplied default value will be used * if the property has no current value. Updates to the value will be written back to the * storage system. Note that each call to this method yields a new {@link Value} and those * values will not coordinate with one another, so the caller must be sure to only call this * method once for a given property and share that value properly. */ public Value<Double> valueFor (final String key, double defval) { Value<Double> value = Value.create(get(key, defval)); value.connect(new Slot<Double>() { @Override public void onEmit (Double value) { set(key, value); } }); return value; }
/** * Exposes the specified property as a {@link Value}. The supplied default value will be used * if the property has no current value. Updates to the value will be written back to the * storage system. Note that each call to this method yields a new {@link Value} and those * values will not coordinate with one another, so the caller must be sure to only call this * method once for a given property and share that value properly. */ public Value<Boolean> valueFor (final String key, boolean defval) { Value<Boolean> value = Value.create(get(key, defval)); value.connect(new Slot<Boolean>() { @Override public void onEmit (Boolean value) { set(key, value); } }); return value; }
public Field (String initialText, Styles styles) { setStyles(styles); text = Value.create(""); _finishedEditing = Signal.create(); if (hasNative()) { _finishedEditing.connect(new Slot<Boolean>() { @Override public void onEmit (Boolean event) { if (!_fullTimeNative) updateMode(false); } }); } this.text.update(initialText); this.text.connect(textDidChange()); }