public Boolean apply (Iterable<? extends ValueView<Boolean>> values) { for (ValueView<Boolean> value : values) { if (value.get()) return true; } return false; } };
public Boolean apply (Iterable<? extends ValueView<Boolean>> values) { for (ValueView<Boolean> value : values) { if (value.get()) return true; } return false; } };
public Boolean apply (Iterable<? extends ValueView<Boolean>> values) { for (ValueView<Boolean> value : values) { if (!value.get()) return false; } return true; } };
public Boolean apply (Iterable<? extends ValueView<Boolean>> values) { for (ValueView<Boolean> value : values) { if (!value.get()) return false; } return true; } };
/** Whether this layer has been disposed. If true, the layer can no longer be used. */ public boolean disposed() { return state.get() == State.DISPOSED; }
@Override public String toString () { return "VLabel(" + text.get() + ")"; } @Override protected Class<?> getStyleClass () { return Label.class; }
@Override protected String text () { return String.valueOf(text.get()); } @Override protected Icon icon () { return null; }
/** * Returns a reactive value which is triggered when either of {@code a, b, c} emits an event. * The mapped value will retain connections to {@code a+b+c} only while it itself has * connections. */ public static <A,B,C> ValueView<T3<A,B,C>> join (final ValueView<A> a, final ValueView<B> b, final ValueView<C> c) { return new MappedValue<T3<A,B,C>>() { @Override public T3<A,B,C> get () { return _current; } @Override protected Connection connect () { return Connection.join( a.connect(_trigger), b.connect(_trigger), c.connect(_trigger)); } protected final UnitSlot _trigger = new UnitSlot() { public void onEmit () { T3<A,B,C> ovalue = _current; _current = new T3<A,B,C>(a.get(), b.get(), c.get()); notifyChange(_current, ovalue); } }; protected T3<A,B,C> _current = new T3<A,B,C>(a.get(), b.get(), c.get()); }; }
/** * Returns a reactive value which is triggered when either of {@code a, b, c} emits an event. * The mapped value will retain connections to {@code a+b+c} only while it itself has * connections. */ public static <A,B,C> ValueView<T3<A,B,C>> join (final ValueView<A> a, final ValueView<B> b, final ValueView<C> c) { return new MappedValue<T3<A,B,C>>() { @Override public T3<A,B,C> get () { return _current; } @Override protected Connection connect () { return Connection.join( a.connect(_trigger), b.connect(_trigger), c.connect(_trigger)); } protected final UnitSlot _trigger = new UnitSlot() { public void onEmit () { T3<A,B,C> ovalue = _current; _current = new T3<A,B,C>(a.get(), b.get(), c.get()); notifyChange(_current, ovalue); } }; protected T3<A,B,C> _current = new T3<A,B,C>(a.get(), b.get(), c.get()); }; }
/** * Returns a reactive value which is triggered when either of {@code a, b} emits an event. The * mapped value will retain connections to {@code a+b} only while it itself has connections. */ public static <A,B> ValueView<T2<A,B>> join (final ValueView<A> a, final ValueView<B> b) { return new MappedValue<T2<A,B>>() { @Override public T2<A,B> get () { return _current; } @Override protected Connection connect () { return Connection.join(a.connect(_trigger), b.connect(_trigger)); } protected final UnitSlot _trigger = new UnitSlot() { public void onEmit () { T2<A,B> ovalue = _current; _current = new T2<A,B>(a.get(), b.get()); notifyChange(_current, ovalue); } }; protected T2<A,B> _current = new T2<A,B>(a.get(), b.get()); }; }
/** * Returns a reactive value which is triggered when either of {@code a, b} emits an event. The * mapped value will retain connections to {@code a+b} only while it itself has connections. */ public static <A,B> ValueView<T2<A,B>> join (final ValueView<A> a, final ValueView<B> b) { return new MappedValue<T2<A,B>>() { @Override public T2<A,B> get () { return _current; } @Override protected Connection connect () { return Connection.join(a.connect(_trigger), b.connect(_trigger)); } protected final UnitSlot _trigger = new UnitSlot() { public void onEmit () { T2<A,B> ovalue = _current; _current = new T2<A,B>(a.get(), b.get()); notifyChange(_current, ovalue); } }; protected T2<A,B> _current = new T2<A,B>(a.get(), b.get()); }; }
@Override protected Connection connect () { conn = mapped.connect(new UnitSlot() { public void onEmit () { reconnect(); } }); return mapped.get().connect(new Listener<M>() { @Override public void onChange (M value, M ovalue) { notifyChange(value, ovalue); } }); } @Override protected void disconnect () {
@Override protected Connection connect () { conn = mapped.connect(new UnitSlot() { public void onEmit () { reconnect(); } }); return mapped.get().connect(new Listener<M>() { @Override public void onChange (M value, M ovalue) { notifyChange(value, ovalue); } }); } @Override protected void disconnect () {
/** * Adds a layer to the bottom of the group. Because the {@link Layer} hierarchy is a tree, if * {@code child} is already a child of another {@link GroupLayer}, it will be removed before * being added to this {@link GroupLayer}. */ public void add(Layer child) { // optimization if we're requested to add a child that's already added GroupLayer parent = child.parent(); if (parent == this) return; // if this child has equal or greater depth to the last child, we can append directly and avoid // a log(N) search; this is helpful when all children have the same depth int count = children.size(), index; if (count == 0 || children.get(count-1).depth() <= child.depth()) index = count; // otherwise find the appropriate insertion point via binary search else index = findInsertion(child.depth()); // remove the child from any existing parent, preventing multiple parents if (parent != null) parent.remove(child); children.add(index, child); child.setParent(this); if (state.get() == State.ADDED) child.onAdd(); // if this child is active, we need to become active if (child.interactive()) setInteractive(true); }