This fixes a long standing bug with `GridPane` where unmanaged nodes would 
still result in gaps being added between rows/columns even though nothing is 
rendered there.  Take the following grid where dashes and pipes represent the 
vgaps and hgaps:

|            |0| |1|
|--------|---|---|---|
|0  |A|||B|
|    |-|||-|
|1  |C|||D|
|    |-|||-|
|2  |E|||F|

Now, when both C and D are set to unmanaged (and invisible) the grid will 
**still** render the gaps:

|            |0| |1|
|--------|---|---|---|
|0  |A|||B|
|    |-|||-|
|1  |||||
|    |-|||-|
|2  |E|||F|

Instead it should collapse the gap between row 0 and 2:

|            |0| |1|
|--------|---|---|---|
|0  |A|||B|
|    |-|||-|
|2  |E|||F|

There are at least two relevant issues in JBS:
- A request to let the user show and hide rows and columns: 
https://bugs.openjdk.org/browse/JDK-8136901
  - This can now be done by setting the relevant row/columns items to unmanaged 
without having to restructure the grid (assuming the complaint was that 
otherwise there'd be visible extra gaps for each hidden row)
- A request for another mode to skip gaps when entire rows/columns are 
unmanaged: https://bugs.openjdk.org/browse/JDK-8092379
  - This should not be a mode, but the standard, as unmanaged nodes should not 
affect the outcome of the grid layout

Screenshots

Simple application which can hide row 3:

<img width="443" height="491" alt="image" 
src="https://github.com/user-attachments/assets/0342dba3-cd1c-4d9e-9451-e9c8c628b2e2";
 />

Correct behavior when row 3 is hidden:

<img width="443" height="408" alt="image" 
src="https://github.com/user-attachments/assets/c7c54414-6a03-43e4-b733-21d0b251d729";
 />

Behavior before this fix (note the double gap **and** extra grid line):

<img width="443" height="453" alt="image" 
src="https://github.com/user-attachments/assets/f357e68a-e950-42e7-890b-91a78e194dd0";
 />

-------------

Commit messages:
 - When all nodes starting in a row or column are unmanaged, skip gap

Changes: https://git.openjdk.org/jfx/pull/1990/files
  Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1990&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8092379
  Stats: 47 lines in 1 file changed: 23 ins; 4 del; 20 mod
  Patch: https://git.openjdk.org/jfx/pull/1990.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1990/head:pull/1990

PR: https://git.openjdk.org/jfx/pull/1990

Reply via email to