Skip to content

Commit f50d218

Browse files
Merge
2 parents aefed81 + 208d828 commit f50d218

File tree

12 files changed

+187
-84
lines changed

12 files changed

+187
-84
lines changed

modules/javafx.base/src/main/java/javafx/beans/value/ObservableValue.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@
4343
* this library support lazy evaluation.
4444
* <p>
4545
* An {@code ObservableValue} generates two types of events: change events and
46-
* invalidation events. A change event indicates that the value has changed. An
46+
* invalidation events. A change event indicates that the value has changed.
47+
* Current implementing classes in JavaFX check for a change using reference
48+
* equality (and not object equality, {@code Object#equals(Object)}) of the value. An
4749
* invalidation event is generated if the current value is not valid anymore.
4850
* This distinction becomes important if the {@code ObservableValue} supports
4951
* lazy evaluation, because for a lazily evaluated value one does not know if an

modules/javafx.base/src/main/java/javafx/collections/FXCollections.java

+28-20
Original file line numberDiff line numberDiff line change
@@ -102,22 +102,24 @@ public static <E> ObservableList<E> observableList(List<E> list) {
102102
}
103103

104104
/**
105-
* Constructs an ObservableList that is backed by the specified list.
106-
* Mutation operations on the ObservableList instance will be reported
107-
* to observers that have registered on that instance.<br>
108-
* Note that mutation operations made directly to the underlying list are
109-
* <em>not</em> reported to observers of any ObservableList that
105+
* Constructs an {@code ObservableList} that is backed by the specified list and listens to changes in observables of its items.
106+
* Mutation operations made directly to the underlying list are
107+
* <em>not</em> reported to observers of any {@code ObservableList} that
110108
* wraps it.
111-
* <br>
112-
* This list also reports mutations of the elements in it by using <code>extractor</code>.
113-
* Observable objects returned by extractor (applied to each list element) are listened for changes
114-
* and transformed into "update" change of ListChangeListener.
109+
* <p>
110+
* The {@code extractor} returns observables (usually properties) of the objects in the created list. These observables are
111+
* listened for changes, and the user is notified of these through an
112+
* {@linkplain ListChangeListener.Change#wasUpdated() update} change of an attached {@code ListChangeListener}. These changes
113+
* are unrelated to the changes made to the observable list itself using methods such as {@code add} and {@code remove}.
114+
* <p>
115+
* For example, a list of {@code Shape}s can listen to changes in the shapes' {@code fill} property.
115116
*
116-
* @param <E> The type of List to be wrapped
117-
* @param list a concrete List that backs this ObservableList
118-
* @param extractor element to Observable[] convertor
117+
* @param <E> The type of {@code List} to be wrapped
118+
* @param list a concrete {@code List} that backs this {@code ObservableList}
119+
* @param extractor element to {@code Observable[]} converter
120+
* @return a newly created {@code ObservableList}
121+
* @see #observableArrayList(javafx.util.Callback)
119122
* @since JavaFX 2.1
120-
* @return a newly created ObservableList
121123
*/
122124
public static <E> ObservableList<E> observableList(List<E> list, Callback<E, Observable[]> extractor) {
123125
if (list == null || extractor == null) {
@@ -307,7 +309,7 @@ public static ObservableFloatArray observableFloatArray(ObservableFloatArray arr
307309
}
308310

309311
/**
310-
* Creates a new empty observable list that is backed by an arraylist.
312+
* Creates a new empty observable list that is backed by an array list.
311313
* @see #observableList(java.util.List)
312314
* @param <E> The type of List to be wrapped
313315
* @return a newly created ObservableList
@@ -318,14 +320,20 @@ public static <E> ObservableList<E> observableArrayList() {
318320
}
319321

320322
/**
321-
* Creates a new empty observable list backed by an arraylist.
323+
* Creates a new empty {@code ObservableList} that is backed by an array list and listens to changes in observables of its items.
324+
* <p>
325+
* The {@code extractor} returns observables (usually properties) of the objects in the created list. These observables are
326+
* listened for changes and the user is notified of these through an
327+
* {@linkplain ListChangeListener.Change#wasUpdated() update} change of an attached {@code ListChangeListener}. These changes
328+
* are unrelated to the changes made to the observable list itself using methods such as {@code add} and {@code remove}.
329+
* <p>
330+
* For example, a list of {@code Shape}s can listen to changes in the shapes' {@code fill} property.
322331
*
323-
* This list reports element updates.
324-
* @param <E> The type of List to be wrapped
325-
* @param extractor element to Observable[] convertor. Observable objects are listened for changes on the element.
332+
* @param <E> The type of {@code List} to be wrapped
333+
* @param extractor element to {@code Observable[]} converter
334+
* @return a newly created {@code ObservableList}
326335
* @see #observableList(java.util.List, javafx.util.Callback)
327336
* @since JavaFX 2.1
328-
* @return a newly created ObservableList
329337
*/
330338
public static <E> ObservableList<E> observableArrayList(Callback<E, Observable[]> extractor) {
331339
return observableList(new ArrayList(), extractor);
@@ -369,7 +377,7 @@ public static <K,V> ObservableMap<K,V> observableHashMap() {
369377

370378
/**
371379
* Concatenates more observable lists into one. The resulting list
372-
* would be backed by an arraylist.
380+
* would be backed by an array list.
373381
* @param <E> The type of List to be wrapped
374382
* @param lists lists to concatenate
375383
* @return new observable array list concatenated from the arguments

modules/javafx.base/src/main/java/javafx/collections/ObservableList.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
import javafx.collections.transformation.SortedList;
3737

3838
/**
39-
* A list that allows listeners to track changes when they occur.
39+
* A list that allows listeners to track changes when they occur. Implementations can be created using methods in {@link FXCollections}
40+
* such as {@link FXCollections#observableArrayList() observableArrayList}, or with a
41+
* {@link javafx.beans.property.SimpleListProperty SimpleListProperty}.
4042
*
4143
* @see ListChangeListener
4244
* @see ListChangeListener.Change

modules/javafx.base/src/main/java/javafx/collections/ObservableMap.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,14 @@
3030
import javafx.beans.Observable;
3131

3232
/**
33-
* A map that allows observers to track changes when they occur.
33+
* A map that allows observers to track changes when they occur. Implementations can be created using methods in {@link FXCollections}
34+
* such as {@link FXCollections#observableHashMap() observableHashMap}, or with a
35+
* {@link javafx.beans.property.SimpleMapProperty SimpleMapProperty}.
3436
*
3537
* @see MapChangeListener
3638
* @see MapChangeListener.Change
39+
* @param <K> the map key element type
40+
* @param <V> the map value element type
3741
* @since JavaFX 2.0
3842
*/
3943
public interface ObservableMap<K, V> extends Map<K, V>, Observable {

modules/javafx.base/src/main/java/javafx/collections/ObservableSet.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,18 @@
2525

2626
package javafx.collections;
2727

28-
2928
import java.util.Set;
3029

3130
import javafx.beans.Observable;
3231

3332
/**
34-
* A set that allows observers to track changes when they occur.
33+
* A set that allows observers to track changes when they occur. Implementations can be created using methods in {@link FXCollections}
34+
* such as {@link FXCollections#observableSet(Object...) observableSet}, or with a
35+
* {@link javafx.beans.property.SimpleSetProperty SimpleSetProperty}.
3536
*
3637
* @see SetChangeListener
3738
* @see SetChangeListener.Change
39+
* @param <E> the set element type
3840
* @since JavaFX 2.1
3941
*/
4042
public interface ObservableSet<E> extends Set<E>, Observable {

modules/javafx.base/src/main/java/javafx/util/converter/CurrencyStringConverter.java

+29-6
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
import javafx.util.StringConverter;
3333

3434
/**
35-
* <p>{@link StringConverter} implementation for {@link Number} values
36-
* that represent currency.</p>
35+
* A {@link StringConverter} implementation for {@link Number} values that represent currency. Instances of this class are immutable.
3736
*
3837
* @see PercentageStringConverter
3938
* @see NumberStringConverter
@@ -42,30 +41,54 @@
4241
*/
4342
public class CurrencyStringConverter extends NumberStringConverter {
4443

45-
// ------------------------------------------------------------ Constructors
44+
/**
45+
* Constructs a {@code CurrencyStringConverter} with the default locale and format.
46+
*/
4647
public CurrencyStringConverter() {
4748
this(Locale.getDefault());
4849
}
4950

51+
/**
52+
* Constructs a {@code CurrencyStringConverter} with the given locale and the default format.
53+
*
54+
* @param locale the locale used in determining the number format used to format the string
55+
*/
5056
public CurrencyStringConverter(Locale locale) {
5157
this(locale, null);
5258
}
5359

60+
/**
61+
* Constructs a {@code CurrencyStringConverter} with the default locale and the given decimal format pattern.
62+
*
63+
* @param pattern the string pattern used in determining the number format used to format the string
64+
*
65+
* @see java.text.DecimalFormat
66+
*/
5467
public CurrencyStringConverter(String pattern) {
5568
this(Locale.getDefault(), pattern);
5669
}
5770

71+
/**
72+
* Constructs a {@code CurrencyStringConverter} with the given locale and decimal format pattern.
73+
*
74+
* @param locale the locale used in determining the number format used to format the string
75+
* @param pattern the string pattern used in determining the number format used to format the string
76+
*
77+
* @see java.text.DecimalFormat
78+
*/
5879
public CurrencyStringConverter(Locale locale, String pattern) {
5980
super(locale, pattern, null);
6081
}
6182

83+
/**
84+
* Constructs a {@code CurrencyStringConverter} with the given number format.
85+
*
86+
* @param numberFormat the number format used to format the string
87+
*/
6288
public CurrencyStringConverter(NumberFormat numberFormat) {
6389
super(null, null, numberFormat);
6490
}
6591

66-
67-
// ---------------------------------------------------------------0- Methods
68-
6992
/** {@inheritDoc} */
7093
@Override protected NumberFormat getNumberFormat() {
7194
Locale _locale = locale == null ? Locale.getDefault() : locale;

modules/javafx.base/src/main/java/javafx/util/converter/NumberStringConverter.java

+33-9
Original file line numberDiff line numberDiff line change
@@ -33,34 +33,60 @@
3333
import javafx.util.StringConverter;
3434

3535
/**
36-
* <p>{@link StringConverter} implementation for {@link Number} values.</p>
36+
* A {@link StringConverter} implementation for {@link Number} values. Instances of this class are immutable.
37+
*
3738
* @since JavaFX 2.1
3839
*/
3940
public class NumberStringConverter extends StringConverter<Number> {
4041

41-
// ------------------------------------------------------ Private properties
42-
4342
final Locale locale;
4443
final String pattern;
4544
final NumberFormat numberFormat;
4645

47-
// ------------------------------------------------------------ Constructors
46+
/**
47+
* Constructs a {@code NumberStringConverter} with the default locale and format.
48+
*/
4849
public NumberStringConverter() {
4950
this(Locale.getDefault());
5051
}
5152

53+
/**
54+
* Constructs a {@code NumberStringConverter} with the given locale and the default format.
55+
*
56+
* @param locale the locale used in determining the number format used to format the string
57+
*/
5258
public NumberStringConverter(Locale locale) {
5359
this(locale, null);
5460
}
5561

62+
/**
63+
* Constructs a {@code NumberStringConverter} with the default locale and the given decimal format pattern.
64+
*
65+
* @param pattern the string pattern used in determining the number format used to format the string
66+
*
67+
* @see java.text.DecimalFormat
68+
*/
5669
public NumberStringConverter(String pattern) {
5770
this(Locale.getDefault(), pattern);
5871
}
5972

73+
/**
74+
* Constructs a {@code NumberStringConverter} with the given locale and decimal format pattern.
75+
*
76+
* @param locale the locale used in determining the number format used to format the string
77+
* @param pattern the string pattern used in determining the number format used to format the string
78+
*
79+
* @see java.text.DecimalFormat
80+
*/
6081
public NumberStringConverter(Locale locale, String pattern) {
6182
this(locale, pattern, null);
6283
}
6384

85+
/**
86+
* Constructs a {@code NumberStringConverter} with the given number format.
87+
*
88+
* @param numberFormat the number format used to format the string
89+
*/
6490
public NumberStringConverter(NumberFormat numberFormat) {
6591
this(null, null, numberFormat);
6692
}
@@ -71,8 +97,6 @@ public NumberStringConverter(NumberFormat numberFormat) {
7197
this.numberFormat = numberFormat;
7298
}
7399

74-
// ------------------------------------------------------- Converter Methods
75-
76100
/** {@inheritDoc} */
77101
@Override public Number fromString(String value) {
78102
try {
@@ -112,11 +136,11 @@ public NumberStringConverter(NumberFormat numberFormat) {
112136
}
113137

114138
/**
115-
* <p>Return a <code>NumberFormat</code> instance to use for formatting
116-
* and parsing in this {@link StringConverter}.</p>
139+
* Returns a {@code NumberFormat} instance to use for formatting
140+
* and parsing in this {@code StringConverter}.
117141
*
118142
* @return a {@code NumberFormat} instance for formatting and parsing in this
119-
* {@link StringConverter}
143+
* {@code StringConverter}
120144
*/
121145
protected NumberFormat getNumberFormat() {
122146
Locale _locale = locale == null ? Locale.getDefault() : locale;

modules/javafx.base/src/main/java/javafx/util/converter/PercentageStringConverter.java

+15-6
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
import javafx.util.StringConverter;
3131

3232
/**
33-
* <p>{@link StringConverter} implementation for {@link Number} values
34-
* that represent percentages.</p>
33+
* A {@link StringConverter} implementation for {@link Number} values that represent percentages. Instances of this class are
34+
* immutable.
3535
*
3636
* @see CurrencyStringConverter
3737
* @see NumberStringConverter
@@ -40,22 +40,31 @@
4040
*/
4141
public class PercentageStringConverter extends NumberStringConverter {
4242

43-
44-
// ------------------------------------------------------------ Constructors
43+
/**
44+
* Constructs a {@code PercentageStringConverter} with the default locale and format.
45+
*/
4546
public PercentageStringConverter() {
4647
this(Locale.getDefault());
4748
}
4849

50+
/**
51+
* Constructs a {@code PercentageStringConverter} with the given locale and the default format.
52+
*
53+
* @param locale the locale used in determining the number format used to format the string
54+
*/
4955
public PercentageStringConverter(Locale locale) {
5056
super(locale, null, null);
5157
}
5258

59+
/**
60+
* Constructs a {@code PercentageStringConverter} with the given number format.
61+
*
62+
* @param numberFormat the number format used to format the string
63+
*/
5364
public PercentageStringConverter(NumberFormat numberFormat) {
5465
super(null, null, numberFormat);
5566
}
5667

57-
// ----------------------------------------------------------------- Methods
58-
5968
/** {@inheritDoc} */
6069
@Override public NumberFormat getNumberFormat() {
6170
Locale _locale = locale == null ? Locale.getDefault() : locale;

0 commit comments

Comments
 (0)