Repository navigation
Apply split percentage once size is known - #49
danilovesky wants to merge 1 commit into
Conversation
Without constant percent, JSplitPane converted the percentage to pixels from the zero size of a split that was not laid out yet, so a stored proportion was lost on importLayout (0.5 below 1/3, preferred sizes from 1/3 on). Keep the percentage and apply it in setBounds() once the size is known, as constant-percent mode does. Fixes opencollab#33
|
Tick the box to add this pull request to the merge queue (same as
|
|
@sylvestre This is the last "urgent" fix I wanted to make. Handling of corner cases is much more robust now: in my FlexDock-based project I used to see exceptions, unexpected size changes and even lost layout files, but not anymore. After the remaining PRs are merged, I'd propose bumping the version to v1.4 and doing a proper release. I can prepare a PR that bumps the poms and dates the release notes; the tag and publishing would be up to you. Since a few public APIs were removed and the minimum Java version changed, v2.0 would also be defensible, so I'm happy to go with whichever you prefer. |
| if (constantPercent) { | ||
| setResizeWeight(percent); | ||
| super.setDividerLocation((int) (percent * getSplitSize())); | ||
| } else if (percentPending && getSplitSize() > 0) { |
There was a problem hiding this comment.
if setDividerLocation(int) is called while a percentage is pending, setBounds() will still override it with the old percentage, no?
should an int location clear percentPending?
Without constant percent, a split proportion set before the split pane has a size was lost (stored layouts came back at 0.5 or Swing's preferred sizes).
DockingSplitPanenow keeps the percentage and applies it insetBounds()once the size is known, as constant-percent mode already does.Fixes #33