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 242278 - Supported way to do banners
Summary: Supported way to do banners
Status: NEW
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Stanislav Aubrecht
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-24 13:19 UTC by phansson
Modified: 2014-07-10 18:52 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Existing Main Windoy Layout (8.31 KB, image/png)
2014-02-24 13:19 UTC, phansson
Details
Proposed solution (22.95 KB, image/png)
2014-02-24 13:20 UTC, phansson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description phansson 2014-02-24 13:19:48 UTC
Created attachment 145536 [details]
Existing Main Windoy Layout

DEFINITION

In this RFE a banner is defined as a visual component that:


- stays in a fixed position either at the top or the bottom of the main window (top banner, bottom banner)
- always stretches all the way from left to right
- doesn't resize vertically!  (fixed height)
- can't be closed or moved
- doesn't have any window handles (doesn't have tabs, window control, etc)



A banner (in this definition) is akin to toolbars in NB or to the bottom status bar in NB.

Banners are typically used for:

- Branding
- Extended status (something that cannot be represented by the limited space of the NB status bar)
- Anything really that needs to be always visible, stay in the same position, etc



CURRENT WORKAROUNDS

Up until today there's no clear way of doing this. There are basically three current workarounds:

1. Trying to fit it into the main work area of the main window. This means fiddling with window modes (possibly creating a new one) and making the banner a top component. From the above definition it should be clear why this will never work. A banner is not a top component! One reason is that you cannot create a mode that has a fixed vertical size. Also getting rid of the top component's TabDisplayerUI is really a pain. There's no supported way of setting TabDisplayerUI for only a single top component, I believe. There's TabbedComponentFactory since NB 7.1 but it seems to be an all-or-nothing approach.

2. Using a toolbar row as a banner. Clearly this will not work for bottom banners. Secondly the banner will have to fit in the row height of a toolbar row and there's work involved in disabling toolbar actions.

3. Put your Swing container into the Main Window's BorderLayout.NORTH area. This is probably what comes closest and this proposal is derived from that. The downside of this solution is that it only works for top banner and that you'll have to guess at the height of the app's toolbar and set aside this amount of empty space in your banner. The reason is that the banner and the (std) toolbar will occupy the same visual space. Make sure not to have any border around your banner as the top of the border will in any case be "eaten" by the toolbar so it will look ugly if you use a border.


PROPOSAL

The idea is to give API access to a container area at the top of the main window (just below where toolbars reside, if any) or to the bottom of the main window (just above where the status bar reside). We can call this "top banner" and "bottom banner". The RCP developer is then free to put anything into that area as he pleases. By default the area will be empty and take up no space.

As it turns out this seems to be rather simple to implement in the NB Window System. Today the NB Main Window layout use a BorderLayout. See attachment1 [details]. The proposal is simply to embed yet another BorderLayout into the existing BorderLayout.NORTH and BorderLayout.SOUTH and then give API access to this new "area" (see attachment2 [details]).


CREDITS

http://www.pellissier.co.za/hermien/?p=620  (on the existing NB Window Layout)
https://blogs.oracle.com/geertjan/entry/new_banner_mode_for_netbeans (2006)
https://blogs.oracle.com/geertjan/entry/of_toolbars_and_banners (2014)

and probably many others. Just Google for "NetBeans banner".
Comment 1 phansson 2014-02-24 13:20:21 UTC
Created attachment 145537 [details]
Proposed solution
Comment 2 phansson 2014-02-24 23:19:20 UTC
Here's the proposed solution in active use: http://netbeansscribbles.wordpress.com/2014/02/24/netbeans-platform-banner/

You can argue that since this link now present a rather decent DIY solution there's no need for official support from the API. The counter argument is that the method in the link will only work as long as the NB Window System uses the layout it does today. If the NB Window System is redesigned the method in the link will probably no longer work.