< prev index next >

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

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

*** 50,65 **** * <pre><code> * TreeTableColumn&lt;Person,String&gt; firstNameCol = new TreeTableColumn&lt;Person,String&gt;("First Name"); * firstNameCol.setCellValueFactory(new TreeItemPropertyValueFactory&lt;Person,String&gt;("firstName")); * </code></pre> * - * * <p> * In this example, {@code Person} is the class type of the {@link TreeItem} * instances used in the {@link TreeTableView}. * {@code TreeItemPropertyValueFactory} 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 --- 50,65 ---- * <pre><code> * TreeTableColumn&lt;Person,String&gt; firstNameCol = new TreeTableColumn&lt;Person,String&gt;("First Name"); * firstNameCol.setCellValueFactory(new TreeItemPropertyValueFactory&lt;Person,String&gt;("firstName")); * </code></pre> * * <p> * In this example, {@code Person} is the class type of the {@link TreeItem} * instances used in the {@link TreeTableView}. + * The class {@code Person} must be declared public. * {@code TreeItemPropertyValueFactory} 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
*** 69,95 **** * observed by the {@code TreeTableView}, resulting in the cell immediately * updating. * </p> * <p> * If no such method exists, then {@code TreeItemPropertyValueFactory} ! * 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 TreeTableCell}. In this situation, * the {@code TreeTableCell} 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(TreeTableColumn.CellDataFeatures)} method - * will log a warning and return {@code null}. - * </p> * * <p>For reference (and as noted in the TreeTableColumn * {@link TreeTableColumn#cellValueFactory cell value factory} documentation), the * long form of the code above would be the following: * </p> --- 69,86 ---- * observed by the {@code TreeTableView}, resulting in the cell immediately * updating. * </p> * <p> * If no such method exists, then {@code TreeItemPropertyValueFactory} ! * 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 TreeTableCell}. In this situation, * the {@code TreeTableCell} 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 TreeTableColumn * {@link TreeTableColumn#cellValueFactory cell value factory} documentation), the * long form of the code above would be the following: * </p>
*** 107,116 **** --- 98,133 ---- * }); * } * } * </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(TreeTableColumn.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 TreeTableColumn * @see TreeTableView * @see TreeTableCell * @see PropertyValueFactory * @see MapValueFactory
< prev index next >