This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 212253 - [72cat] Align Center action not working correctly
Summary: [72cat] Align Center action not working correctly
Status: NEW
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-09 16:31 UTC by Michel Graciano
Modified: 2012-05-15 09:45 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Sample project (15.53 KB, application/zip)
2012-05-09 16:33 UTC, Michel Graciano
Details
Sample project with reproducible use case (18.23 KB, application/zip)
2012-05-09 16:39 UTC, Michel Graciano
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michel Graciano 2012-05-09 16:31:52 UTC
[ BUILD # : 201205030400 ]
[ JDK VERSION : 1.7.4 ]

I will attach a sample form and the steps to reproduce it soon.
Comment 1 Michel Graciano 2012-05-09 16:32:20 UTC
Reproducible with build Build 20120508-bc77094b1af6.
Comment 2 Michel Graciano 2012-05-09 16:33:57 UTC
Created attachment 119223 [details]
Sample project

Just open the NB71.java form at 7.1 and 7.2 to see the difference. There is a gap at 7.2 which is not present at 7.1. Even the preview works differently.
Comment 3 Michel Graciano 2012-05-09 16:39:47 UTC
Created attachment 119226 [details]
Sample project with reproducible use case

This reproducible case explains some issues I was facing and wasn't able to reproduce easily. To reproduce the problem:
1. Open the ReproducibleForm.java;
2. Select buttons 1, 2, 3, 4 and the table (in this specific order);
3. Right click at the selection, Align > Center to Column.

It is reproducible in both IDEs, if you try this at 7.1, it is shown correctly on 7.1 but wrong at 7.2, and if you do this directly in 7.2 you can see the error right away.
Comment 4 Tomas Pavek 2012-05-11 13:04:24 UTC
In fact the current NetBeans version shows the "NB71" form correctly, i.e. with the resizing gaps next to the table and the panel, that's what is in the form file.

The reason why it seems correct in NB 7.1 is due to a workaround of a specific bug in GroupLayout that affects some layouts with a resizing gap at the container border. This workaround changes the resizing gap to fixed when it builds the design view or when it generates code, not to let GroupLayout screw up the layout. The form given here looks correct because you'd really want fixed gaps there. But there are resizing gaps in the form, which NB 7.2 presents correctly, because we fixed the detection of the GroupLayout bug situation - in 7.1 the workaround was applied under broader conditions than necessary. (The form in this issue does not expose the bug, so the workaround was applied incorrectly.)

So NB 7.2 shows the truth here. I don't think we should change it back, this would prevent many valid layouts to be built/generated correctly. The bug is in NB 7.1.

You can easily fix the form in 7.2 by making the gaps really fixed: doubleclick the gap next to the table and uncheck the "Resizable" checkbox. Same with the gap next to the panel.


As for the ReproducibleForm and the steps, this shows that the Align Center action is buggy, as it produces the unwanted resizing gap at the right (it is wrong because the table is already resizing). NB 7.1 just hid this bug. So we can keep this as a report of a bug in center aligning.
Comment 5 Michel Graciano 2012-05-11 13:55:11 UTC
I agree with you, it really seems to be a bug at 7.1. Since the issue's summary is generic, I think we don't need to change it to track the align issue. Thanks Tomas for the evaluation.
Comment 6 Tomas Pavek 2012-05-15 09:45:01 UTC
Two problems with the aligning action when centering a sequence of fixed components with a large resizable component in parallel:
1) The size of the resizable component is adjusted to the sequence of components (if they occupy smaller space).
2) A resizing gap is created next to the group which already is resizing.