modules/javafx.controls/src/main/java/javafx/scene/control/skin/TableRowSkinBase.java

Print this page




 337         for (int column = 0, max = cells.size(); column < max; column++) {
 338             R tableCell = cells.get(column);
 339             TableColumnBase<T, ?> tableColumn = getTableColumn(tableCell);
 340 
 341             boolean isVisible = true;
 342             if (fixedCellSizeEnabled) {
 343                 // we determine if the cell is visible, and if not we have the
 344                 // ability to take it out of the scenegraph to help improve
 345                 // performance. However, we only do this when there is a
 346                 // fixed cell length specified in the TableView. This is because
 347                 // when we have a fixed cell length it is possible to know with
 348                 // certainty the height of each TableCell - it is the fixed value
 349                 // provided by the developer, and this means that we do not have
 350                 // to concern ourselves with the possibility that the height
 351                 // may be variable and / or dynamic.
 352                 isVisible = isColumnPartiallyOrFullyVisible(tableColumn);
 353 
 354                 height = fixedCellSize;
 355             } else {
 356                 height = Math.max(controlHeight, tableCell.prefHeight(-1));
 357                 height = snapSize(height) - snapSize(verticalPadding);
 358             }
 359 
 360             if (isVisible) {
 361                 if (fixedCellSizeEnabled && tableCell.getParent() == null) {
 362                     getChildren().add(tableCell);
 363                 }
 364 
 365                 width = tableCell.prefWidth(height) - snapSize(horizontalPadding);
 366 
 367                 // Added for RT-32700, and then updated for RT-34074.
 368                 // We change the alignment from CENTER_LEFT to TOP_LEFT if the
 369                 // height of the row is greater than the default size, and if
 370                 // the alignment is the default alignment.
 371                 // What I would rather do is only change the alignment if the
 372                 // alignment has not been manually changed, but for now this will
 373                 // do.
 374                 final boolean centreContent = h <= 24.0;
 375 
 376                 // if the style origin is null then the property has not been
 377                 // set (or it has been reset to its default), which means that
 378                 // we can set it without overwriting someone elses settings.
 379                 final StyleOrigin origin = ((StyleableObjectProperty<?>) tableCell.alignmentProperty()).getStyleOrigin();
 380                 if (! centreContent && origin == null) {
 381                     tableCell.setAlignment(Pos.TOP_LEFT);
 382                 }
 383                 // --- end of RT-32700 fix
 384 
 385                 ///////////////////////////////////////////


 418 
 419                             graphic.relocate(x + leftMargin + disclosureWidth,
 420                                     centreContent ? (h / 2.0 - ph / 2.0) :
 421                                             (y + tableCell.getPadding().getTop()));
 422 
 423                             graphic.toFront();
 424                         }
 425                     }
 426                 }
 427                 ///////////////////////////////////////////
 428                 // further indentation code ends here
 429                 ///////////////////////////////////////////
 430 
 431                 tableCell.resize(width, height);
 432                 tableCell.relocate(x, snappedTopInset());
 433 
 434                 // Request layout is here as (partial) fix for RT-28684.
 435                 // This does not appear to impact performance...
 436                 tableCell.requestLayout();
 437             } else {
 438                 width = snapSize(tableCell.prefWidth(-1)) - snapSize(horizontalPadding);
 439 
 440                 if (fixedCellSizeEnabled) {
 441                     // we only add/remove to the scenegraph if the fixed cell
 442                     // length support is enabled - otherwise we keep all
 443                     // TableCells in the scenegraph
 444                     getChildren().remove(tableCell);
 445                 }
 446             }
 447 
 448             x += width;
 449         }
 450     }
 451 
 452     int getIndentationLevel(C control) {
 453         return 0;
 454     }
 455 
 456     double getIndentationPerLevel() {
 457         return 0;
 458     }




 337         for (int column = 0, max = cells.size(); column < max; column++) {
 338             R tableCell = cells.get(column);
 339             TableColumnBase<T, ?> tableColumn = getTableColumn(tableCell);
 340 
 341             boolean isVisible = true;
 342             if (fixedCellSizeEnabled) {
 343                 // we determine if the cell is visible, and if not we have the
 344                 // ability to take it out of the scenegraph to help improve
 345                 // performance. However, we only do this when there is a
 346                 // fixed cell length specified in the TableView. This is because
 347                 // when we have a fixed cell length it is possible to know with
 348                 // certainty the height of each TableCell - it is the fixed value
 349                 // provided by the developer, and this means that we do not have
 350                 // to concern ourselves with the possibility that the height
 351                 // may be variable and / or dynamic.
 352                 isVisible = isColumnPartiallyOrFullyVisible(tableColumn);
 353 
 354                 height = fixedCellSize;
 355             } else {
 356                 height = Math.max(controlHeight, tableCell.prefHeight(-1));
 357                 height = snapSizeY(height) - snapSizeY(verticalPadding);
 358             }
 359 
 360             if (isVisible) {
 361                 if (fixedCellSizeEnabled && tableCell.getParent() == null) {
 362                     getChildren().add(tableCell);
 363                 }
 364 
 365                 width = tableCell.prefWidth(height) - snapSizeX(horizontalPadding);
 366 
 367                 // Added for RT-32700, and then updated for RT-34074.
 368                 // We change the alignment from CENTER_LEFT to TOP_LEFT if the
 369                 // height of the row is greater than the default size, and if
 370                 // the alignment is the default alignment.
 371                 // What I would rather do is only change the alignment if the
 372                 // alignment has not been manually changed, but for now this will
 373                 // do.
 374                 final boolean centreContent = h <= 24.0;
 375 
 376                 // if the style origin is null then the property has not been
 377                 // set (or it has been reset to its default), which means that
 378                 // we can set it without overwriting someone elses settings.
 379                 final StyleOrigin origin = ((StyleableObjectProperty<?>) tableCell.alignmentProperty()).getStyleOrigin();
 380                 if (! centreContent && origin == null) {
 381                     tableCell.setAlignment(Pos.TOP_LEFT);
 382                 }
 383                 // --- end of RT-32700 fix
 384 
 385                 ///////////////////////////////////////////


 418 
 419                             graphic.relocate(x + leftMargin + disclosureWidth,
 420                                     centreContent ? (h / 2.0 - ph / 2.0) :
 421                                             (y + tableCell.getPadding().getTop()));
 422 
 423                             graphic.toFront();
 424                         }
 425                     }
 426                 }
 427                 ///////////////////////////////////////////
 428                 // further indentation code ends here
 429                 ///////////////////////////////////////////
 430 
 431                 tableCell.resize(width, height);
 432                 tableCell.relocate(x, snappedTopInset());
 433 
 434                 // Request layout is here as (partial) fix for RT-28684.
 435                 // This does not appear to impact performance...
 436                 tableCell.requestLayout();
 437             } else {
 438                 width = snapSizeX(tableCell.prefWidth(-1)) - snapSizeX(horizontalPadding);
 439 
 440                 if (fixedCellSizeEnabled) {
 441                     // we only add/remove to the scenegraph if the fixed cell
 442                     // length support is enabled - otherwise we keep all
 443                     // TableCells in the scenegraph
 444                     getChildren().remove(tableCell);
 445                 }
 446             }
 447 
 448             x += width;
 449         }
 450     }
 451 
 452     int getIndentationLevel(C control) {
 453         return 0;
 454     }
 455 
 456     double getIndentationPerLevel() {
 457         return 0;
 458     }