189 **************************************************************************/ 190 191 private ListChangeListener<TableColumnBase> visibleLeafColumnsListener = c -> { 192 isDirty = true; 193 getSkinnable().requestLayout(); 194 }; 195 196 private WeakListChangeListener<TableColumnBase> weakVisibleLeafColumnsListener = 197 new WeakListChangeListener<>(visibleLeafColumnsListener); 198 199 200 201 /*************************************************************************** 202 * * 203 * Abstract Methods * 204 * * 205 **************************************************************************/ 206 207 /** 208 * Creates a new cell instance that is suitable for representing the given table column instance. 209 */ 210 protected abstract R createCell(TableColumnBase<T,?> tc); 211 212 /** 213 * A method to allow the given cell to be told that it is a member of the given row. 214 * How this is implemented is dependent on the actual cell implementation. 215 * @param cell The cell for which we want to inform it of its owner row. 216 * @param row The row which will be set on the given cell. 217 */ 218 protected abstract void updateCell(R cell, C row); 219 220 /** 221 * Returns the {@link TableColumnBase} instance for the given cell instance. 222 * @param cell The cell for which a TableColumn is desired. 223 */ 224 protected abstract TableColumnBase<T,?> getTableColumn(R cell); 225 226 /** 227 * Returns an unmodifiable list containing the currently visible leaf columns. 228 */ 229 protected abstract ObservableList<? extends TableColumnBase/*<T,?>*/> getVisibleLeafColumns(); 230 231 232 233 /*************************************************************************** 234 * * 235 * Public Methods * 236 * * 237 **************************************************************************/ 238 239 /** 240 * Returns the graphic to draw on the inside of the disclosure node. Null 241 * is acceptable when no graphic should be shown. Commonly this is the 242 * graphic associated with a TreeItem (i.e. treeItem.getGraphic()), rather 243 * than a graphic associated with a cell. 244 */ 245 protected ObjectProperty<Node> graphicProperty() { 246 return null; 247 } 248 249 /** {@inheritDoc} */ 250 @Override protected void layoutChildren(double x, final double y, final double w, final double h) { 251 checkState(); 252 if (cellsMap.isEmpty()) return; 253 254 ObservableList<? extends TableColumnBase> visibleLeafColumns = getVisibleLeafColumns(); 255 if (visibleLeafColumns.isEmpty()) { 256 super.layoutChildren(x,y,w,h); 257 return; 258 } 259 260 C control = getSkinnable(); 261 262 /////////////////////////////////////////// 263 // indentation code starts here | 189 **************************************************************************/ 190 191 private ListChangeListener<TableColumnBase> visibleLeafColumnsListener = c -> { 192 isDirty = true; 193 getSkinnable().requestLayout(); 194 }; 195 196 private WeakListChangeListener<TableColumnBase> weakVisibleLeafColumnsListener = 197 new WeakListChangeListener<>(visibleLeafColumnsListener); 198 199 200 201 /*************************************************************************** 202 * * 203 * Abstract Methods * 204 * * 205 **************************************************************************/ 206 207 /** 208 * Creates a new cell instance that is suitable for representing the given table column instance. 209 * @param tc the table column 210 * @return the created cell 211 */ 212 protected abstract R createCell(TableColumnBase<T,?> tc); 213 214 /** 215 * A method to allow the given cell to be told that it is a member of the given row. 216 * How this is implemented is dependent on the actual cell implementation. 217 * @param cell The cell for which we want to inform it of its owner row. 218 * @param row The row which will be set on the given cell. 219 */ 220 protected abstract void updateCell(R cell, C row); 221 222 /** 223 * Returns the {@link TableColumnBase} instance for the given cell instance. 224 * @param cell The cell for which a TableColumn is desired. 225 * @return the table column 226 */ 227 protected abstract TableColumnBase<T,?> getTableColumn(R cell); 228 229 /** 230 * Returns an unmodifiable list containing the currently visible leaf columns. 231 * @return the list of visible leaf columns 232 */ 233 protected abstract ObservableList<? extends TableColumnBase/*<T,?>*/> getVisibleLeafColumns(); 234 235 236 237 /*************************************************************************** 238 * * 239 * Public Methods * 240 * * 241 **************************************************************************/ 242 243 /** 244 * Returns the graphic to draw on the inside of the disclosure node. Null 245 * is acceptable when no graphic should be shown. Commonly this is the 246 * graphic associated with a TreeItem (i.e. treeItem.getGraphic()), rather 247 * than a graphic associated with a cell. 248 * @return the graphic to draw on the inside of the disclosure node 249 */ 250 protected ObjectProperty<Node> graphicProperty() { 251 return null; 252 } 253 254 /** {@inheritDoc} */ 255 @Override protected void layoutChildren(double x, final double y, final double w, final double h) { 256 checkState(); 257 if (cellsMap.isEmpty()) return; 258 259 ObservableList<? extends TableColumnBase> visibleLeafColumns = getVisibleLeafColumns(); 260 if (visibleLeafColumns.isEmpty()) { 261 super.layoutChildren(x,y,w,h); 262 return; 263 } 264 265 C control = getSkinnable(); 266 267 /////////////////////////////////////////// 268 // indentation code starts here |