Community
Participate
Working Groups
Build Identifier: PROBLEM DESCRIPTION: When using an AbstractSplitBox, the initial splitter position (getConfiguredSplitterPosition()) can be given as a percentage (e.g. 0.1 = first part takes 10% of the available space, second part takes 90%). However, the given value is often not displayed correctly, particularly for small or large values. EVALUATION: When the configured splitter position is sent from the Scout model to the Swing component (method javax.swing.JSplitPane.setDividerLocation(double)), the Swing component is not yet ready, so it does not have a height. Javadoc of the setDividerLocation() states clearly, that this situation leads to wrong results. PROBOSED SOLUTION: I will attach a patch that postpones the Swing calls by using SwingUtilities.invokeLater(). This seems to do the trick, but I'm not quite sure if this is _really_ the best possible fix. (Btw, I took the oportunity to change >0.0 and <1.0 to >=0.0 and <=1.0 to allow initial splitter positions that are at 0% or 100%.) Reproducible: Always
Created attachment 214705 [details] Proposed patch
Created attachment 214706 [details] A test form that illustrates the problem (and fix)
Hi Beat As I was trying to reproduce the bug I noticed that setting the splitter position works fine with a value >= 0.17. With smaller values the position was wrong. Your patch seems to fix that but I'm not sure if it's the right way. Since it delays the setting of the splitter position it could lead to a flickering when opening the form which does not look nice. Unfortunately I don't have any better solution at the moment.
Fix required for Scout 3.8 as well.
Change open for develop on Gerrit: https://git.eclipse.org/r/16702 @Beat: I could not use your patch (did not fix the problem), but thanks for the analysis and the example form. My solution works with a listener on the JSplitPane. @Claudio: Thanks for the analysis. The threshold value from 0.17 comes from: (int)((double)(getHeight() - getDividerSize()) * proportionalLocation) in javax.swing.JSplitPane.setDividerLocation(double) because we have called this method too early, height was 0 and dividerSize was 6. -6*0.17 < -1 meaning that a value != 0 will be set. With smaller value than 0.17, the cast as integer produce a value that is 0.
Merged for Luna M2 on develop: http://git.eclipse.org/c/scout/org.eclipse.scout.rt.git/commit/?id=e80638cb512110f5c2445e70a03b327c881bf27a (In reply to Stephan Merkli from comment #4) > Fix required for Scout 3.8 as well. @Ken: Can you do the backport for Eclipse 3.8 ?
> @Ken: > Can you do the backport for Eclipse 3.8 ? Patch backported to Scout 3.8.3 with Revision 3537. @Stephan Merkli: Please verify the changes for Scout 3.8.3 and also for Scout 3.10.0-M2 with you don't mind ;-)
Thank you for the fix. Tested with Scout 3.8 and Scout 3.10
Shipped with Eclipse Luna Release