< prev index next >
modules/javafx.controls/src/main/java/javafx/scene/control/cell/TreeItemPropertyValueFactory.java
Print this page
*** 52,62 ****
*
* In this example, the "firstName" string is used as a reference to an assumed
* <code>firstNameProperty()</code> method in the <code>Person</code> class type
* (which is the class type of the TreeTableView). Additionally, this method must
* return a {@link Property} instance. If a method meeting these requirements
! * is found, then the {@link javafx.scene.control.TreeTableCell} is populated with this ObservableValue<T>.
* In addition, the TreeTableView will automatically add an observer to the
* returned value, such that any changes fired will be observed by the TreeTableView,
* resulting in the cell immediately updating.
*
* <p>If no method matching this pattern exists, there is fall-through support
--- 52,63 ----
*
* In this example, the "firstName" string is used as a reference to an assumed
* <code>firstNameProperty()</code> method in the <code>Person</code> class type
* (which is the class type of the TreeTableView). Additionally, this method must
* return a {@link Property} instance. If a method meeting these requirements
! * is found, then the {@link javafx.scene.control.TreeTableCell} is populated
! * with this {@literal ObservableValue<T>}.
* In addition, the TreeTableView will automatically add an observer to the
* returned value, such that any changes fired will be observed by the TreeTableView,
* resulting in the cell immediately updating.
*
* <p>If no method matching this pattern exists, there is fall-through support
*** 72,90 ****
* {@link TreeTableColumn#cellValueFactory cell value factory} documentation), the
* long form of the code above would be the following:
*
* <pre><code>
* TreeTableColumn<Person,String> firstNameCol = new TreeTableColumn<Person,String>("First Name");
! * firstNameCol.setCellValueFactory(new Callback<CellDataFeatures<Person, String>, ObservableValue<String>>() {
! * public ObservableValue<String> call(CellDataFeatures<Person, String> p) {
* // p.getValue() returns the TreeItem<Person> instance for a particular
* // TreeTableView row, and the second getValue() call returns the
* // Person instance contained within the TreeItem.
* return p.getValue().getValue().firstNameProperty();
* }
* });
* }
* </code></pre>
*
* @see TreeTableColumn
* @see javafx.scene.control.TreeTableView
* @see javafx.scene.control.TreeTableCell
--- 73,93 ----
* {@link TreeTableColumn#cellValueFactory cell value factory} documentation), the
* long form of the code above would be the following:
*
* <pre><code>
* TreeTableColumn<Person,String> firstNameCol = new TreeTableColumn<Person,String>("First Name");
! * {@literal
! * firstNameCol.setCellValueFactory(new Callback<CellDataFeatures<Person, String>, ObservableValue<String>>() {
! * public ObservableValue<String> call(CellDataFeatures<Person, String> p) {
* // p.getValue() returns the TreeItem<Person> instance for a particular
* // TreeTableView row, and the second getValue() call returns the
* // Person instance contained within the TreeItem.
* return p.getValue().getValue().firstNameProperty();
* }
* });
* }
+ * }
* </code></pre>
*
* @see TreeTableColumn
* @see javafx.scene.control.TreeTableView
* @see javafx.scene.control.TreeTableCell
*** 117,126 ****
--- 120,130 ----
return getCellDataReflectively(treeItem.getValue());
}
/**
* Returns the property name provided in the constructor.
+ * @return the property name provided in the constructor
*/
public final String getProperty() { return property; }
private ObservableValue<T> getCellDataReflectively(S rowData) {
if (getProperty() == null || getProperty().isEmpty() || rowData == null) return null;
< prev index next >