Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8190717

[TabPane] Support reordering of Tabs within a TabPane

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 10
    • Component/s: javafx
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      The default behavior of a TabPane will not be altered. Setting the drag policy to REORDER will allow user to reorder the tabs using mouse press-drag-release gesture.
    • Interface Kind:
      Java API
    • Scope:
      JDK

      Description

      Summary

      Add support for reordering of the tabs within a TabPane.

      Problem

      Tabs added to a TabPane are displayed in the same sequence as they are added to the TabPane. Once added, the tabs cannot be visually reordered using mouse. It is a very common use case to reorder the tabs in an TabPane based application.

      Solution

      Specification

      TabDragPolicy property and enum are added to TabPane control:

      /**
       * The drag policy for the tabs. The policy can be changed dynamically.
       *
       * @defaultValue TabDragPolicy.FIXED
       * @return The tab drag policy property
       * @since 10
       */
      public final ObjectProperty<TabDragPolicy> tabDragPolicyProperty() {}
      public final void setTabDragPolicy(TabDragPolicy value) {}
      public final TabDragPolicy getTabDragPolicy() {}
      
      /**
       * This enum specifies drag policies for tabs in a TabPane.
       *
       * @since 10
       */
      public enum TabDragPolicy {
          /**
           * The tabs remain fixed in their positions and cannot be dragged.
           */
          FIXED,
      
          /**
           * The tabs can be dragged to reorder them within the same TabPane.
           * Users can perform the simple mouse press-drag-release gesture on a
           * tab header to drag it to a new position. A tab can not be detached
           * from its parent TabPane.
           * <p>After a tab is reordered, the {@link #getTabs() tabs} list is
           * permuted to reflect the updated order.
           * A {@link javafx.collections.ListChangeListener.Change permutation
           * change} event is fired to indicate which tabs were reordered. This
           * reordering is done after the mouse button is released. While a tab
           * is being dragged, the list of tabs is unchanged.</p>
           */
          REORDER
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                arapte Ambarish Rapte
                Reporter:
                arapte Ambarish Rapte
                Reviewed By:
                Kevin Rushforth
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: