< prev index next >

modules/javafx.controls/src/main/java/javafx/scene/control/cell/PropertyValueFactory.java

Print this page
rev 10445 : [mq]: doc-v1-8177566-trampoline

*** 53,64 **** * </code></pre> * * <p> * In this example, {@code Person} is the class type of the {@code TableView} * {@link TableView#itemsProperty() items} list. * {@code PropertyValueFactory} uses the constructor argument, ! * {@code "firstName"}, to assume that {@code Person} has a method * {@code firstNameProperty} with no formal parameters and a return type of * {@code ObservableValue<String>}. * </p> * <p> * If such a method exists, then it is invoked, and additionally assumed --- 53,65 ---- * </code></pre> * * <p> * In this example, {@code Person} is the class type of the {@code TableView} * {@link TableView#itemsProperty() items} list. + * The class {@code Person} must be declared public. * {@code PropertyValueFactory} uses the constructor argument, ! * {@code "firstName"}, to assume that {@code Person} has a public method * {@code firstNameProperty} with no formal parameters and a return type of * {@code ObservableValue<String>}. * </p> * <p> * If such a method exists, then it is invoked, and additionally assumed
*** 67,93 **** * an observer to the return value, such that any changes fired will be observed * by the {@code TableView}, resulting in the cell immediately updating. * </p> * <p> * If no such method exists, then {@code PropertyValueFactory} ! * assumes that {@code Person} has a method {@code getFirstName} or * {@code isFirstName} with no formal parameters and a return type of * {@code String}. If such a method exists, then it is invoked, and its return * value is wrapped in a {@link ReadOnlyObjectWrapper} * and returned to the {@code TableCell}. In this situation, * the {@code TableCell} will not be able to observe changes to the property, * unlike in the first approach above. * </p> ! * <p> ! * The class {@code Person} must be declared public. If that class is in a named ! * module, then the module must {@link Module#isOpen(String,Module) open} ! * the containing package to at least the {@code javafx.base} module ! * (or {@link Module#isExported(String) export} the containing package ! * unconditionally). ! * Otherwise the {@link #call call(TableColumn.CellDataFeatures)} method ! * will log a warning and return {@code null}. ! * </p> * <p>For reference (and as noted in the TableColumn * {@link TableColumn#cellValueFactory cell value factory} documentation), the * long form of the code above would be the following: * </p> * --- 68,86 ---- * an observer to the return value, such that any changes fired will be observed * by the {@code TableView}, resulting in the cell immediately updating. * </p> * <p> * If no such method exists, then {@code PropertyValueFactory} ! * assumes that {@code Person} has a public method {@code getFirstName} or * {@code isFirstName} with no formal parameters and a return type of * {@code String}. If such a method exists, then it is invoked, and its return * value is wrapped in a {@link ReadOnlyObjectWrapper} * and returned to the {@code TableCell}. In this situation, * the {@code TableCell} will not be able to observe changes to the property, * unlike in the first approach above. * </p> ! * * <p>For reference (and as noted in the TableColumn * {@link TableColumn#cellValueFactory cell value factory} documentation), the * long form of the code above would be the following: * </p> *
*** 100,109 **** --- 93,128 ---- * } * }); * } * </code></pre> * + * <p><b>Deploying an Application as a Module</b></p> + * <p> + * If the referenced class is in a named module, then it must be reflectively + * accessible to the {@code javafx.base} module. + * A class is reflectively accessible if the module + * {@link Module#isOpen(String,Module) opens} the containing package to at + * least the {@code javafx.base} module. + * Otherwise the {@link #call call(TableColumn.CellDataFeatures)} method + * will log a warning and return {@code null}. + * </p> + * <p> + * For example, if the {@code Person} class is in the {@code com.foo} package + * in the {@code foo.app} module, the {@code module-info.java} might + * look like this: + * </p> + * + <pre>{@code module foo.app { + opens com.foo to javafx.base; + }}</pre> + * + * <p> + * Alternatively, a class is reflectively accessible if the module + * {@link Module#isExported(String) exports} the containing package + * unconditionally. + * </p> + * * @see TableColumn * @see TableView * @see TableCell * @see TreeItemPropertyValueFactory * @see MapValueFactory
< prev index next >