Package com.diffplug.common.swt
Class SwtRx
- java.lang.Object
-
- com.diffplug.common.swt.SwtRx
-
public class SwtRx extends java.lang.ObjectUtilities that convert SWT events into Rx-friendly Observables.
-
-
Constructor Summary
Constructors Constructor Description SwtRx()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static kotlinx.coroutines.flow.Flow<Event>addListener(Widget widget, int... events)Subscribes to the given widget and pipes the events to anFlow<Event>.static kotlinx.coroutines.flow.Flow<Event>addListener(Widget widget, java.util.Collection<java.lang.Integer> events)Subscribes to the given widget and pipes the events to anFlow<Event>.static kotlinx.coroutines.flow.Flow<Event>addListener(Widget widget, java.util.stream.Stream<java.lang.Integer> events)Subscribes to the given widget and pipes the events to anFlow<Event>.static Chitchit(ControlWrapper wrapper)Wraps the givenControlWrapperin anChit.static Chitchit(Widget guard)static <T> RxBox<T>combo(Combo combo, ImmutableList<T> values, java.util.function.Function<T,java.lang.String> converter)Populates a Combo returns an `RxBox` which is bidirectionally bound to the given combo. static <T> voidcombo(Combo combo, ImmutableList<T> values, java.util.function.Function<T,java.lang.String> converter, RxBox<T> box)Populates a Combo and bidirectionally binds it to an `RxBox`. static kotlinx.coroutines.flow.Flow<Point>rightClickGlobal(Control ctl)Returns anFlow<Point> of the right-click mouse-up on the given control, in global coordinates.static kotlinx.coroutines.flow.Flow<Point>rightClickLocal(Control ctl)Returns anFlow<Point> of the right-click mouse-up on the given control, in local coordinates.static RxBox<java.lang.String>textConfirmed(Text text)Returns an RxBoxwhich contains the content of the text box only when it has been confirmed by: programmer setting the RxBox user hitting enter focus leaving the text static RxBox<java.lang.String>textImmediate(Text text)Returns an RxBoxwhich contains the content of the text box. static RxBox<java.lang.Boolean>toggle(Button btn)Returns an `RxBox` for the toggle state of the given button as an RxBox.
-
-
-
Method Detail
-
addListener
public static kotlinx.coroutines.flow.Flow<Event> addListener(Widget widget, int... events)
Subscribes to the given widget and pipes the events to anFlow<Event>.
-
addListener
public static kotlinx.coroutines.flow.Flow<Event> addListener(Widget widget, java.util.Collection<java.lang.Integer> events)
Subscribes to the given widget and pipes the events to anFlow<Event>.
-
addListener
public static kotlinx.coroutines.flow.Flow<Event> addListener(Widget widget, java.util.stream.Stream<java.lang.Integer> events)
Subscribes to the given widget and pipes the events to anFlow<Event>.
-
rightClickGlobal
public static kotlinx.coroutines.flow.Flow<Point> rightClickGlobal(Control ctl)
Returns anFlow<Point> of the right-click mouse-up on the given control, in global coordinates.
-
rightClickLocal
public static kotlinx.coroutines.flow.Flow<Point> rightClickLocal(Control ctl)
Returns anFlow<Point> of the right-click mouse-up on the given control, in local coordinates.
-
textImmediate
public static RxBox<java.lang.String> textImmediate(Text text)
Returns an RxBoxwhich contains the content of the text box.
-
textConfirmed
public static RxBox<java.lang.String> textConfirmed(Text text)
Returns an RxBoxwhich contains the content of the text box only when it has been confirmed by: - programmer setting the RxBox
- user hitting enter
- focus leaving the text
-
toggle
public static RxBox<java.lang.Boolean> toggle(Button btn)
Returns an `RxBox` for the toggle state of the given button as an RxBox. Applicable to SWT.TOGGLE, SWT.CHECK, and SWT.RADIO.
-
combo
public static <T> RxBox<T> combo(Combo combo, ImmutableList<T> values, java.util.function.Function<T,java.lang.String> converter)
Populates a Combo returns an `RxBox` which is bidirectionally bound to the given combo. - Parameters:
combo- The combo which is being bound.values- The values which the RxBox can take on. Must match combo.getItems().- Returns:
- An `RxBox
` which is bound bidirectionally to the given combo.
-
combo
public static <T> void combo(Combo combo, ImmutableList<T> values, java.util.function.Function<T,java.lang.String> converter, RxBox<T> box)
Populates a Combo and bidirectionally binds it to an `RxBox`. - Parameters:
combo- The combo which is being bound.values- The values which the RxBox can take on.converter- A function for mapping values to strings.values- The values which the RxBox can take on.
-
chit
public static Chit chit(ControlWrapper wrapper)
Wraps the givenControlWrapperin anChit.
-
-