118
119
120 /***************************************************************************
121 * *
122 * Properties *
123 * *
124 **************************************************************************/
125
126 // --- TableView
127 private ReadOnlyObjectWrapper<TableView<T>> tableView;
128 private void setTableView(TableView<T> value) {
129 tableViewPropertyImpl().set(value);
130 }
131
132 public final TableView<T> getTableView() {
133 return tableView == null ? null : tableView.get();
134 }
135
136 /**
137 * The TableView associated with this Cell.
138 */
139 public final ReadOnlyObjectProperty<TableView<T>> tableViewProperty() {
140 return tableViewPropertyImpl().getReadOnlyProperty();
141 }
142
143 private ReadOnlyObjectWrapper<TableView<T>> tableViewPropertyImpl() {
144 if (tableView == null) {
145 tableView = new ReadOnlyObjectWrapper<TableView<T>>() {
146 private WeakReference<TableView<T>> weakTableViewRef;
147 @Override protected void invalidated() {
148 TableView.TableViewSelectionModel<T> sm;
149 TableViewFocusModel<T> fm;
150
151 if (weakTableViewRef != null) {
152 TableView<T> oldTableView = weakTableViewRef.get();
153 if (oldTableView != null) {
154 sm = oldTableView.getSelectionModel();
155 if (sm != null) {
156 sm.getSelectedIndices().removeListener(weakSelectedListener);
157 }
323
324 if (! isEditing() && rowMatch) {
325 startEdit();
326 } else if (isEditing() && ! rowMatch) {
327 cancelEdit();
328 }
329 }
330
331
332
333 /***************************************************************************
334 * *
335 * Expert API *
336 * *
337 **************************************************************************/
338
339 /**
340 * Updates the TableView associated with this TableCell. This is typically
341 * only done once when the TableCell is first added to the TableView.
342 *
343 * @expert This function is intended to be used by experts, primarily
344 * by those implementing new Skins. It is not common
345 * for developers or designers to access this function directly.
346 */
347 public final void updateTableView(TableView<T> tv) {
348 setTableView(tv);
349 }
350
351
352 /***************************************************************************
353 * *
354 * Stylesheet Handling *
355 * *
356 **************************************************************************/
357
358 private static final String DEFAULT_STYLE_CLASS = "table-row-cell";
359
360
361 /***************************************************************************
362 * *
363 * Accessibility handling *
364 * *
365 **************************************************************************/
|
118
119
120 /***************************************************************************
121 * *
122 * Properties *
123 * *
124 **************************************************************************/
125
126 // --- TableView
127 private ReadOnlyObjectWrapper<TableView<T>> tableView;
128 private void setTableView(TableView<T> value) {
129 tableViewPropertyImpl().set(value);
130 }
131
132 public final TableView<T> getTableView() {
133 return tableView == null ? null : tableView.get();
134 }
135
136 /**
137 * The TableView associated with this Cell.
138 * @return the TableView associated with this Cell
139 */
140 public final ReadOnlyObjectProperty<TableView<T>> tableViewProperty() {
141 return tableViewPropertyImpl().getReadOnlyProperty();
142 }
143
144 private ReadOnlyObjectWrapper<TableView<T>> tableViewPropertyImpl() {
145 if (tableView == null) {
146 tableView = new ReadOnlyObjectWrapper<TableView<T>>() {
147 private WeakReference<TableView<T>> weakTableViewRef;
148 @Override protected void invalidated() {
149 TableView.TableViewSelectionModel<T> sm;
150 TableViewFocusModel<T> fm;
151
152 if (weakTableViewRef != null) {
153 TableView<T> oldTableView = weakTableViewRef.get();
154 if (oldTableView != null) {
155 sm = oldTableView.getSelectionModel();
156 if (sm != null) {
157 sm.getSelectedIndices().removeListener(weakSelectedListener);
158 }
324
325 if (! isEditing() && rowMatch) {
326 startEdit();
327 } else if (isEditing() && ! rowMatch) {
328 cancelEdit();
329 }
330 }
331
332
333
334 /***************************************************************************
335 * *
336 * Expert API *
337 * *
338 **************************************************************************/
339
340 /**
341 * Updates the TableView associated with this TableCell. This is typically
342 * only done once when the TableCell is first added to the TableView.
343 *
344 * Note: This function is intended to be used by experts, primarily
345 * by those implementing new Skins. It is not common
346 * for developers or designers to access this function directly.
347 * @param tv the TableView
348 */
349 public final void updateTableView(TableView<T> tv) {
350 setTableView(tv);
351 }
352
353
354 /***************************************************************************
355 * *
356 * Stylesheet Handling *
357 * *
358 **************************************************************************/
359
360 private static final String DEFAULT_STYLE_CLASS = "table-row-cell";
361
362
363 /***************************************************************************
364 * *
365 * Accessibility handling *
366 * *
367 **************************************************************************/
|