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 220901 - Multirow tabs have a different width when unsaved changes - UI gets uneasy and tabs reorder themselves
Summary: Multirow tabs have a different width when unsaved changes - UI gets uneasy an...
Status: RESOLVED WONTFIX
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P4 normal (vote)
Assignee: Stanislav Aubrecht
URL:
Keywords: PATCH_AVAILABLE
Depends on:
Blocks:
 
Reported: 2012-10-26 09:03 UTC by markiewb
Modified: 2013-06-03 09:17 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Showing the different width of un-/saved tabs (79.62 KB, image/png)
2012-10-26 09:04 UTC, markiewb
Details
Patch with fixed widths (1.68 KB, patch)
2012-10-29 18:24 UTC, markiewb
Details | Diff
Patch with fixed widths - in action (141.77 KB, image/png)
2012-10-29 18:25 UTC, markiewb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description markiewb 2012-10-26 09:03:47 UTC
[ BUILD # : 201210180002 ]
[ JDK VERSION : 1.6.37 ]

Only relevant when using multirow tabs: Tabs have a different width when 
unsaved changes -> UI gets uneasy and tabs reorder themselves. That is 
annoying.

ACTUAL: Tabs with unsaved changes have a different width than tabs with 
saved changes. The tabs reorder themselves after saving. The UE is uneasy.

EXPECTED: Tabs with unsaved changes have the same width as tabs with 
saved changes.

See screenshot for an example.
Comment 1 markiewb 2012-10-26 09:04:57 UTC
Created attachment 126603 [details]
Showing the different width of un-/saved tabs
Comment 2 Stanislav Aubrecht 2012-10-29 08:58:15 UTC
Multi-row tabs are implemented using Swing's JTabbedPane which renders the tabs this way.
Comment 3 markiewb 2012-10-29 18:24:53 UTC
Created attachment 126741 [details]
Patch with fixed widths

(In reply to comment #2)
> Multi-row tabs are implemented using Swing's JTabbedPane which renders the tabs
> this way.

VETO. Sorry i had to reopen this issue because it is possible.
See the attached patch and the result in a following screenshot.

The patch is more a hack than a real solution, but i will get the idea.
The width calculation of the label is modified by setting the font to bold+italic (which is the worst-case font style in terms of width). BUT when rendering the style is removed and the original style is used. This way the dimension/bounding rectangle is the worst-case one, but the painting is done with the original style.

PRO: the multirow-layout stays the same ignoring the unsaved state
CON: there is wasted space within the tabs (when the tabs are not bold because of saved changes)
Comment 4 markiewb 2012-10-29 18:25:40 UTC
Created attachment 126742 [details]
Patch with fixed widths - in action
Comment 5 markiewb 2012-10-29 18:26:54 UTC
Sorry i had to reopen this issue because it is possible.
Please have a look at http://netbeans.org/bugzilla/show_bug.cgi?id=220901#c3
Comment 6 markiewb 2012-10-29 18:27:33 UTC
(In reply to comment #3)
> Created attachment 126741 [details]
> Patch with fixed widths
> 
> (In reply to comment #2)
> > Multi-row tabs are implemented using Swing's JTabbedPane which renders the tabs
> > this way.
> 
> VETO. Sorry i had to reopen this issue because it is possible.
> See the attached patch and the result in a following screenshot.
> 
> The patch is more a hack than a real solution, but i will get the idea.
> The width calculation of the label is modified by setting the font to
> bold+italic (which is the worst-case font style in terms of width). BUT when
> rendering the style is removed and the original style is used. This way the
> dimension/bounding rectangle is the worst-case one, but the painting is done
> with the original style.
> 
> PRO: the multirow-layout stays the same ignoring the unsaved state
> CON: there is wasted space within the tabs (when the tabs are not bold because
> of saved changes)

Typo: The patch is more a hack than a real solution, but YOU will get the idea.
Comment 7 Stanislav Aubrecht 2012-11-16 14:05:17 UTC
I'd rather implement new multi-row tabs using JTable as the backing component instead of applying this hack. JTable-based implementation will allow lot of tricks that are not possible with JTabbedPane, e.g. different colors per project, fixed rows per project, user defined number of rows/columns etc...
Comment 8 Theofanis Oikonomou 2012-12-11 14:00:33 UTC
Thank you for the patch. Fixed: http://hg.netbeans.org/core-main/rev/a50114c9a0d3, at least until the new JTable-based tabs are implemented.
Comment 9 markiewb 2012-12-11 15:07:29 UTC
(In reply to comment #8)
> Thank you for the patch. Fixed:
> http://hg.netbeans.org/core-main/rev/a50114c9a0d3, at least until the new
> JTable-based tabs are implemented.

Cool. Please link the following issue which "implements the jtable based tabs".
Comment 10 Quality Engineering 2012-12-12 02:43:23 UTC
Integrated into 'main-golden', will be available in build *201212120001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/a50114c9a0d3
User: Theofanis Oikonomou <theofanis@netbeans.org>
Log: Issue #220901 - Multirow tabs have a different width when unsaved changes - UI gets uneasy and tabs reorder themselves
Comment 11 Theofanis Oikonomou 2012-12-13 14:59:24 UTC
Had to revert the fix: http://hg.netbeans.org/core-main/rev/62621e7a5d4a
It turns out that the max width is not taken care correctly and in some cases when a file is modified its' name is not entirely visible. Plus there is alot of wasted horizontal space. reopening
Comment 12 Quality Engineering 2012-12-17 12:36:23 UTC
Integrated into 'main-golden', will be available in build *201212170919* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/62621e7a5d4a
User: Theofanis Oikonomou <theofanis@netbeans.org>
Log: Issue #220901 - Multirow tabs have a different width when unsaved changes - UI gets uneasy and tabs reorder themselves
Comment 13 Stanislav Aubrecht 2013-06-03 09:17:22 UTC
There's a new implementation of multi-row tabs in 7.4 which does not suffer from this problem.