swingx
  1. swingx
  2. SWINGX-1490

After a divider is dragged, the weights of the layout are not updated, which causes incorrect layout

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.6.3
    • Fix Version/s: None
    • Component/s: SplitPane
    • Labels:
      None

      Description

      MultiSplitLayout defines the weight property as a value between 0.0 and 1.0 used to compute how much space to add to the node when the layout grows or how much to reduce when the layout shrinks.

      layoutGrow for example, allocates say extra width as follows:
      newWidth = currentWidth + (extraWidth * splitChild.getWeight())

      But once a divider is dragged, since weights are not updated, getWeight() will return an invalid value, which will be used to compute the layout.
      Once a divider is dragged, one expects the currently showing "weights" or "proportions" to be preserved, not the ones the layout had initially started with!

      Bug reproduction scenarios at:
      http://www.java.net/forum/topic/javadesktop/java-desktop-technologies/swinglabs/bug-multisplitlayout

        Activity

        Hide
        sbozian added a comment -

        Since startDrag of JXMultiSplitPane sets floatingDividers to FALSE, in addition to recalculating the weights, wouldn't it also make sense to set floatingDividers back to TRUE to resume layoutByWeight, after a divider is dragged?

        Is there any reason to keep floatingDividers FALSE after a drag? I mean, while it makes sense to set it to FALSE while dragging, why should there be any difference in the way the layout gets computed before and after a drag?

        I found it convenient to set floatingDividers back to TRUE so that I can manipulate the weights at runtime if needed, knowing that the layout will reflect the changes.

        I will attach the method 'dragFinished' which I'm using to workaround this bug. I call this method from within the finishDrag method of JXMultiSplitPane.

        Show
        sbozian added a comment - Since startDrag of JXMultiSplitPane sets floatingDividers to FALSE, in addition to recalculating the weights, wouldn't it also make sense to set floatingDividers back to TRUE to resume layoutByWeight, after a divider is dragged? Is there any reason to keep floatingDividers FALSE after a drag? I mean, while it makes sense to set it to FALSE while dragging, why should there be any difference in the way the layout gets computed before and after a drag? I found it convenient to set floatingDividers back to TRUE so that I can manipulate the weights at runtime if needed, knowing that the layout will reflect the changes. I will attach the method 'dragFinished' which I'm using to workaround this bug. I call this method from within the finishDrag method of JXMultiSplitPane.

          People

          • Assignee:
            luano
            Reporter:
            sbozian
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: