@@ -60,6 +60,7 @@ public static <A, B> MappedList<B, A> mapBacked(ObservableList<A> source, Functi
6060
6161 public static <T , U > ObservableList <U > map (ObservableValue <T > source , Function <T , List <U >> mapper ) {
6262 PreboundBinding <List <U >> binding = new PreboundBinding <List <U >>(source ) {
63+
6364 @ Override
6465 protected List <U > computeValue () {
6566 return mapper .apply (source .getValue ());
@@ -103,10 +104,10 @@ public static <A, B> void bindBidirectional(ObservableValue<A> propertyA, Observ
103104
104105 public static <A , B > void bindContentBidirectional (ObservableList <A > propertyA , ListProperty <B > propertyB , Consumer <ObservableList <B >> updateA , Consumer <List <A >> updateB ) {
105106 bindContentBidirectional (
106- propertyA ,
107- (ObservableValue <ObservableList <B >>) propertyB ,
108- updateA ,
109- updateB );
107+ propertyA ,
108+ (ObservableValue <ObservableList <B >>) propertyB ,
109+ updateA ,
110+ updateB );
110111 }
111112
112113 public static <A , B > void bindContentBidirectional (ObservableList <A > propertyA , ObservableValue <B > propertyB , Consumer <B > updateA , Consumer <List <A >> updateB ) {
@@ -124,10 +125,10 @@ public static <A, B> void bindContentBidirectional(ListProperty<A> listProperty,
124125 Consumer <List <A >> updateB = newValueList -> property .setValue (mapToB .apply (newValueList ));
125126
126127 bindContentBidirectional (
127- listProperty ,
128- property ,
129- updateList ,
130- updateB );
128+ listProperty ,
129+ property ,
130+ updateList ,
131+ updateB );
131132 }
132133
133134 public static <A , V , B > void bindContentBidirectional (ObservableMap <A , V > propertyA , ObservableValue <B > propertyB , Consumer <B > updateA , Consumer <Map <A , V >> updateB ) {
@@ -143,14 +144,15 @@ public static <A, V, B> void bindContentBidirectional(ObservableMap<A, V> proper
143144 public static <A , V , B > void bindContentBidirectional (ObservableMap <A , V > propertyA , Property <B > propertyB , Consumer <B > updateA , Function <Map <A , V >, B > mapToB ) {
144145 Consumer <Map <A , V >> updateB = newValueList -> propertyB .setValue (mapToB .apply (newValueList ));
145146 bindContentBidirectional (
146- propertyA ,
147- propertyB ,
148- updateA ,
149- updateB );
147+ propertyA ,
148+ propertyB ,
149+ updateA ,
150+ updateB );
150151 }
151152
152153 public static <T > ObservableValue <T > constantOf (T value ) {
153154 return new ObjectBinding <T >() {
155+
154156 @ Override
155157 protected T computeValue () {
156158 return value ;
@@ -160,6 +162,7 @@ protected T computeValue() {
160162
161163 public static ObservableValue <Boolean > constantOf (boolean value ) {
162164 return new BooleanBinding () {
165+
163166 @ Override
164167 protected boolean computeValue () {
165168 return value ;
@@ -169,13 +172,21 @@ protected boolean computeValue() {
169172
170173 public static ObservableValue <? extends String > emptyString () {
171174 return new StringBinding () {
175+
172176 @ Override
173177 protected String computeValue () {
174178 return "" ;
175179 }
176180 };
177181 }
178182
183+ /**
184+ * Returns a wrapper around the given list that posts changes on the JavaFX thread.
185+ */
186+ public static <T > ObservableList <T > forUI (ObservableList <T > list ) {
187+ return new UiThreadList <>(list );
188+ }
189+
179190 private static class BidirectionalBinding <A , B > {
180191
181192 private final ObservableValue <A > propertyA ;
0 commit comments