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

Print this page




 315         return rootHeader.getReadOnlyProperty();
 316     }
 317     final NestedTableColumnHeader getRootHeader() {
 318         return rootHeader.get();
 319     }
 320     private final void setRootHeader(NestedTableColumnHeader value) {
 321         rootHeader.set(value);
 322     }
 323 
 324 
 325 
 326     /***************************************************************************
 327      *                                                                         *
 328      * Public API                                                              *
 329      *                                                                         *
 330      **************************************************************************/
 331 
 332     /** {@inheritDoc} */
 333     @Override protected void layoutChildren() {
 334         double x = scrollX;
 335         double headerWidth = snapSize(getRootHeader().prefWidth(-1));
 336         double prefHeight = getHeight() - snappedTopInset() - snappedBottomInset();
 337         double cornerWidth = snapSize(flow.getVbar().prefWidth(-1));
 338 
 339         // position the main nested header
 340         getRootHeader().resizeRelocate(x, snappedTopInset(), headerWidth, prefHeight);
 341 
 342         // position the filler region
 343         final Control control = tableSkin.getSkinnable();
 344         if (control == null) {
 345             return;
 346         }
 347 
 348         final BooleanProperty tableMenuButtonVisibleProperty = TableSkinUtils.tableMenuButtonVisibleProperty(tableSkin);
 349 
 350         final double controlInsets = control.snappedLeftInset() + control.snappedRightInset();
 351         double fillerWidth = tableWidth - headerWidth + filler.getInsets().getLeft() - controlInsets;
 352         fillerWidth -= tableMenuButtonVisibleProperty != null && tableMenuButtonVisibleProperty.get() ? cornerWidth : 0;
 353         filler.setVisible(fillerWidth > 0);
 354         if (fillerWidth > 0) {
 355             filler.resizeRelocate(x + headerWidth, snappedTopInset(), fillerWidth, prefHeight);
 356         }
 357 


 382     // but made private again for JDK 9
 383     void updateScrollX() {
 384         scrollX = flow.getHbar().isVisible() ? -flow.getHbar().getValue() : 0.0F;
 385         requestLayout();
 386 
 387         // Fix for RT-36392: without this call even though we call requestLayout()
 388         // we don't seem to ever see the layoutChildren() method above called,
 389         // which means the layout is not always updated to use the latest scrollX.
 390         layout();
 391     }
 392 
 393     // used to be protected to allow subclass to customise the width, to allow for features
 394     // such as row headers, but made private again for JDK 9
 395     private void updateTableWidth() {
 396         // snapping added for RT-19428
 397         final Control c = tableSkin.getSkinnable();
 398         if (c == null) {
 399             this.tableWidth = 0;
 400         } else {
 401             Insets insets = c.getInsets() == null ? Insets.EMPTY : c.getInsets();
 402             double padding = snapSize(insets.getLeft()) + snapSize(insets.getRight());
 403             this.tableWidth = snapSize(c.getWidth()) - padding;
 404         }
 405 
 406         clip.setWidth(tableWidth);
 407     }
 408 
 409     /**
 410      * Creates a new NestedTableColumnHeader instance. By default this method should not be overridden, but in some
 411      * circumstances it makes sense (e.g. testing, or when extreme customization is desired).
 412      *
 413      * @return A new NestedTableColumnHeader instance.
 414      */
 415     protected NestedTableColumnHeader createRootHeader() {
 416         return new NestedTableColumnHeader(tableSkin, null);
 417     }
 418 
 419 
 420 
 421     /***************************************************************************
 422      *                                                                         *
 423      * Private Implementation                                                  *




 315         return rootHeader.getReadOnlyProperty();
 316     }
 317     final NestedTableColumnHeader getRootHeader() {
 318         return rootHeader.get();
 319     }
 320     private final void setRootHeader(NestedTableColumnHeader value) {
 321         rootHeader.set(value);
 322     }
 323 
 324 
 325 
 326     /***************************************************************************
 327      *                                                                         *
 328      * Public API                                                              *
 329      *                                                                         *
 330      **************************************************************************/
 331 
 332     /** {@inheritDoc} */
 333     @Override protected void layoutChildren() {
 334         double x = scrollX;
 335         double headerWidth = snapSizeX(getRootHeader().prefWidth(-1));
 336         double prefHeight = getHeight() - snappedTopInset() - snappedBottomInset();
 337         double cornerWidth = snapSizeX(flow.getVbar().prefWidth(-1));
 338 
 339         // position the main nested header
 340         getRootHeader().resizeRelocate(x, snappedTopInset(), headerWidth, prefHeight);
 341 
 342         // position the filler region
 343         final Control control = tableSkin.getSkinnable();
 344         if (control == null) {
 345             return;
 346         }
 347 
 348         final BooleanProperty tableMenuButtonVisibleProperty = TableSkinUtils.tableMenuButtonVisibleProperty(tableSkin);
 349 
 350         final double controlInsets = control.snappedLeftInset() + control.snappedRightInset();
 351         double fillerWidth = tableWidth - headerWidth + filler.getInsets().getLeft() - controlInsets;
 352         fillerWidth -= tableMenuButtonVisibleProperty != null && tableMenuButtonVisibleProperty.get() ? cornerWidth : 0;
 353         filler.setVisible(fillerWidth > 0);
 354         if (fillerWidth > 0) {
 355             filler.resizeRelocate(x + headerWidth, snappedTopInset(), fillerWidth, prefHeight);
 356         }
 357 


 382     // but made private again for JDK 9
 383     void updateScrollX() {
 384         scrollX = flow.getHbar().isVisible() ? -flow.getHbar().getValue() : 0.0F;
 385         requestLayout();
 386 
 387         // Fix for RT-36392: without this call even though we call requestLayout()
 388         // we don't seem to ever see the layoutChildren() method above called,
 389         // which means the layout is not always updated to use the latest scrollX.
 390         layout();
 391     }
 392 
 393     // used to be protected to allow subclass to customise the width, to allow for features
 394     // such as row headers, but made private again for JDK 9
 395     private void updateTableWidth() {
 396         // snapping added for RT-19428
 397         final Control c = tableSkin.getSkinnable();
 398         if (c == null) {
 399             this.tableWidth = 0;
 400         } else {
 401             Insets insets = c.getInsets() == null ? Insets.EMPTY : c.getInsets();
 402             double padding = snapSizeX(insets.getLeft()) + snapSizeX(insets.getRight());
 403             this.tableWidth = snapSizeX(c.getWidth()) - padding;
 404         }
 405 
 406         clip.setWidth(tableWidth);
 407     }
 408 
 409     /**
 410      * Creates a new NestedTableColumnHeader instance. By default this method should not be overridden, but in some
 411      * circumstances it makes sense (e.g. testing, or when extreme customization is desired).
 412      *
 413      * @return A new NestedTableColumnHeader instance.
 414      */
 415     protected NestedTableColumnHeader createRootHeader() {
 416         return new NestedTableColumnHeader(tableSkin, null);
 417     }
 418 
 419 
 420 
 421     /***************************************************************************
 422      *                                                                         *
 423      * Private Implementation                                                  *