67
68
69 /***************************************************************************
70 * *
71 * Properties *
72 * *
73 **************************************************************************/
74
75 // --- Index
76 private ReadOnlyIntegerWrapper index = new ReadOnlyIntegerWrapper(this, "index", -1) {
77 @Override protected void invalidated() {
78 boolean active = ((get() % 2) == 0);
79 pseudoClassStateChanged(PSEUDO_CLASS_EVEN, active);
80 pseudoClassStateChanged(PSEUDO_CLASS_ODD, !active);
81 }
82 };
83
84 /**
85 * Returns the index that this cell represents in the underlying control
86 * data model.
87 */
88 public final int getIndex() { return index.get(); }
89
90 /**
91 * The location of this cell in the virtualized control (e.g:
92 * {@link ListView}, {@link TreeView}, {@link TableView}, etc). This is the model
93 * index which corresponds exactly with the Cell {@link #itemProperty() item}
94 * property. For example,
95 * in the case of a {@link ListView}, this means the following:
96 * <code>cell.item == listView.getItems().get(cell.getIndex())</code>
97 */
98 public final ReadOnlyIntegerProperty indexProperty() { return index.getReadOnlyProperty(); }
99
100 /***************************************************************************
101 * *
102 * Expert API *
103 * *
104 **************************************************************************/
105
106 /**
107 * Updates the index associated with this IndexedCell.
108 *
109 * @expert This function is intended to be used by experts, primarily
110 * by those implementing new Skins. It is not common
111 * for developers or designers to access this function directly.
112 */
113 public void updateIndex(int i) {
114 final int oldIndex = index.get();
115 index.set(i);
116 indexChanged(oldIndex, i);
117 }
118
119 /**
120 * This method is called whenever the index is changed, regardless of whether
121 * the new index is the same as the old index.
122 * @param oldIndex
123 * @param newIndex
124 */
125 void indexChanged(int oldIndex, int newIndex) {
126 // no-op
127 }
128
129 /* *************************************************************************
130 * *
131 * Stylesheet Handling *
|
67
68
69 /***************************************************************************
70 * *
71 * Properties *
72 * *
73 **************************************************************************/
74
75 // --- Index
76 private ReadOnlyIntegerWrapper index = new ReadOnlyIntegerWrapper(this, "index", -1) {
77 @Override protected void invalidated() {
78 boolean active = ((get() % 2) == 0);
79 pseudoClassStateChanged(PSEUDO_CLASS_EVEN, active);
80 pseudoClassStateChanged(PSEUDO_CLASS_ODD, !active);
81 }
82 };
83
84 /**
85 * Returns the index that this cell represents in the underlying control
86 * data model.
87 * @return the index that this cell represents in the underlying control
88 * data model
89 */
90 public final int getIndex() { return index.get(); }
91
92 /**
93 * The location of this cell in the virtualized control (e.g:
94 * {@link ListView}, {@link TreeView}, {@link TableView}, etc). This is the model
95 * index which corresponds exactly with the Cell {@link #itemProperty() item}
96 * property. For example,
97 * in the case of a {@link ListView}, this means the following:
98 * <code>cell.item == listView.getItems().get(cell.getIndex())</code>
99 * @return the location of this cell in the virtualized control
100 */
101 public final ReadOnlyIntegerProperty indexProperty() { return index.getReadOnlyProperty(); }
102
103 /***************************************************************************
104 * *
105 * Expert API *
106 * *
107 **************************************************************************/
108
109 /**
110 * Updates the index associated with this IndexedCell.
111 *
112 * Note: This function is intended to be used by experts, primarily
113 * by those implementing new Skins. It is not common
114 * for developers or designers to access this function directly.
115 * @param i the index associated with this indexed cell
116 */
117 public void updateIndex(int i) {
118 final int oldIndex = index.get();
119 index.set(i);
120 indexChanged(oldIndex, i);
121 }
122
123 /**
124 * This method is called whenever the index is changed, regardless of whether
125 * the new index is the same as the old index.
126 * @param oldIndex
127 * @param newIndex
128 */
129 void indexChanged(int oldIndex, int newIndex) {
130 // no-op
131 }
132
133 /* *************************************************************************
134 * *
135 * Stylesheet Handling *
|