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.
Summary: | Support JTabbedPane version of NetBeans tabbed containers | ||
---|---|---|---|
Product: | platform | Reporter: | David Simonek <dsimonek> |
Component: | Window System | Assignee: | maxnitribitt <maxnitribitt> |
Status: | RESOLVED FIXED | ||
Severity: | blocker | CC: | anebuzelsky, arittner, maxnitribitt, mmirilovic, saubrecht |
Priority: | P2 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: | |
Bug Depends on: | 169099 | ||
Bug Blocks: | 67455, 66335, 96528, 120075 | ||
Attachments: | proof of concept |
Description
David Simonek
2008-10-16 14:48:24 UTC
How about retrieving the Tabbed implementation as a service via Lookup in DefaultSeparateContainer and DefaultSplitContainer? This would be enough as a first step. Then anyone interested can write a module to swap the default TabbedAdapter implementation against one based on JTabbedPane. What I mean is: We could create an interface: public interface TabbedComponentFactory { public Tabbed getTabbedComponent(int type); } and Implementation: @ServiceProvider(service=TabbedComponentFactory.class) public class DefaultTabbedComponentFactory implements TabbedComponentFactory{ public Tabbed getTabbedComponent(int type) { return new TabbedAdapter(type); } } And use it in DefaultSplitContainer and DefaultSeparateContainer: protected Tabbed createTabbed() { Tabbed tabbed; TabbedComponentFactory componentFactory = Lookup.getDefault().lookup(TabbedComponentFactory.class); if(getKind() == Constants.MODE_KIND_EDITOR) { tabbed = componentFactory.getTabbedComponent(Constants.MODE_KIND_EDITOR); } else { tabbed = componentFactory.getTabbedComponent(Constants.MODE_KIND_VIEW); } return tabbed; } Then to add Tabbed and Constants to the public API, and anyone can do an implementation. It would be only a minimal change, but in times of scarce resources ( and core being in maintenance mode for 6.8) it would enable external contributors to fix this by adding an implementation in a separate module without having to touch core.windows (e.g. as part of http://wiki.netbeans.org/NetFIX or a similar program). dsimonek wrote: >Cons: >Some features will be lost - probably: >- control buttons on editor right top corner will go away It should be possible to keep the control buttons as well. We can use CloseButtonTabbedPane for IOWindows in UI Utilities as a starting point for this. > - "stretching" layout of tabs for non-editor component lost Could you explain what you mean by "stretching"? --Toni I'm not working on this part anymore, sorry. By "stretching" I meant behavior of tabs for example in explorer - each tab always keeps the same portion of available space. Look around for something (maybe lost in CVS history at this point) - an interface called Tabbed and a class called TabbedAdapter. It was basically the API of JTabbedPane wrapping TabbedContainer. If you stick to JDK 6, you can probably do close buttons properly - I think there's an API that lets you supply a component to be the tab label that can be whatever you want in a JTabbedPane. The look and feel implementations for TabbedContainer are kind of a mess - apologies for that - I wanted to unify it all to one codebase and just allow some sort of simple skinning, but good intentions and time don't always work out. The reason for TabbedContainer existing was really looking at the (JDK 1.4) code for JTabbedPane - after living with some horrible, unfixable bugs in the pre-3.6 JTabbedPane based UI - and simply deciding it was not scalable or well enough written, and we'd rather have something that was model driven, could scale and most importantly that we wouldn't have to wait for a JDK update if something needed fixing. If we were doing it today, I might go for using JTabbedPane and some custom UI delegates. In 2003, though, it just wasn't an option. There *was* at some point, a boolean switch you could throw to get JTabbedPanes instead of TabbedContainers in the NetBeans UI, but I suspect that's long gone. That's exactly what I did. I've implemented Tabbed using JTabbedPane and created a Serviceprovider interface ( TabbedComponentFactory as described before) that allows me to plugin my implementation. Thanks for your feedback, Tim. No I know at least that I'm not on a dead track, and will continue fleshing this out... Started as a netdev FOW: http://wiki.netbeans.org/OtherTabFOW --Toni Created http://www.netbeans.org/issues/show_bug.cgi?id=169099 for the required API changes. Hi Toni, Times they are changing and I was assigned as reviewer, so I'm going to study your materials and let you know...but from the first sigh it looks OK, I remember thinking about similar approach myself. Hi Dafe, Since it looks like this enhancement was originally submitted by you, you're probably the perfect reviewer :-). I'll fix a few bugs with my current implementation and upload a first alpha version with partial implementation later this week. --Toni Created attachment 85309 [details]
proof of concept
The source code of the proof of concept is now available on Kenai: http://kenai.com/projects/nb-tabbedpane i've added a branding switch to replace TabbedContainer with JTabbedPane, see core-main 757389cbbb60 Integrated into 'main-golden', will be available in build *201201260600* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/757389cbbb60 User: S. Aubrecht <saubrecht@netbeans.org> Log: #150393 - Support JTabbedPane version of NetBeans tabbed containers |