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 91334 - WindowManager should provide API to write into title bar
Summary: WindowManager should provide API to write into title bar
Status: NEW
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@platform
Keywords: API
Depends on:
Reported: 2006-12-20 13:43 UTC by phonkanen
Modified: 2010-08-11 13:29 UTC (History)
2 users (show)

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description phonkanen 2006-12-20 13:43:57 UTC

Our NetBeans Platform based application needs to manipulate main windows title
bar text in runtime. Branding is not an option here.

In NB 3.6 it was possible to use method
NbTopManager.WindowSystem.setProjectName() to manipulate main windows title bar
in Platform. In NB 50 it was prevented by defining module friends for
org.netbeans.core. Currently we use 50 and we can do a nasty hack, but we would
like to do it more decent way and the latest code in CVS does not even have this
method anymore.

So my suggestion is to add similiar method to NB 60. The functionality of
setProjectName is sufficient for our purposes.


Comment 1 _ rkubacki 2006-12-20 15:24:56 UTC
OK, I'm slowly giving up and probably we will have to add it to Window System
API. it seems that we have to maintain this anyway so it is better to make it
official API. At least it is better IMO than
NbTopManager.WindowSystem.setProjectName() (it is no longer about projects only).
Comment 2 David Strupl 2006-12-20 15:30:03 UTC
I guess we might be ready to implement this ourselves to 6.0 with your little
help ... or is it possbile already e.g. by obtaining the main window reference?
Will WinSys overwrite our window tible? Can we get reliably the main window
Comment 3 _ rkubacki 2006-12-20 15:52:36 UTC
I forgot, of course there is
and you can set the title. In fact this is what
org.netbeans.modules.project.ui.Hacks.keepCurrentProjectNameUpdated() does. 

If we do not need set title of undocked windows to something derived from main
window title this can be enough for everyone.
Comment 4 David Strupl 2006-12-20 16:01:30 UTC
My question is whether the WinSys code will overwrite our title at some point in
time. I mean how safe it is to write our string there and beleive that NB does
not put something else there ...
Comment 5 David Strupl 2006-12-20 16:02:26 UTC
Another question is WHEN should we write there? Definitelly not during
ModuleInstall.restored() - the main window is not there yet. So when?
Comment 6 _ rkubacki 2006-12-20 16:45:16 UTC
AFAIK winsys only sets it only once while building main window. 

can help you to set it at the end of startup sequence. 
Comment 7 David Simonek 2006-12-20 16:50:28 UTC
Use WindowManager.invokeWhenUIReady, this should work.
Comment 8 phonkanen 2006-12-21 07:19:05 UTC
Ok, seems that we have some way to manipulate the title bar of main window.

This is gettin bit off the actual topic, but then we might have need also to do
the same for undocked windows. I sit somehow possible - I have to say that I
have not investigated the API nor very familiar with this undocking feature.

Comment 9 David Strupl 2006-12-21 11:46:53 UTC
Is the method invokeWhenUIReady already in NB 5.5 or is it 6.0 feature? The
since 6.8 in the JavaDoc is not really that informative. Looking at the manfiest
our 5.0 based org-openide-windows.jar it says 6.5.1, so I guess this method will
be in 6.0?
Comment 10 David Simonek 2006-12-21 12:47:29 UTC
invokeWhenUIReady is in 6.0.

re to phonkanen: yes it is possible to do it through combination of pure Swing
calls Frame.getAllFrames and WindowManager.getMainWindow().getOwnedWindows().
However you'll have a bit of troubles to be notified when new udocked window
appears. AFAIK winsys will try to overwrite titles of seperate/undocked windows,
as we didn't design for the use case of custom titles. If you can specify
exactly how you need to manipulate with titles and why, then we will have more
insight of what API needs to be created, if needed.
Comment 11 phonkanen 2006-12-21 14:12:32 UTC
The application we work on is a client server application and we need to know
the connected server on title bar of the main window. This is because the data
shown in the application is server specific and the end user does have multiple
applications on multiple screens open at the same time from different servers.
When you can detach some topcomponent from the main window and move it for
example into another screen - the end user must somehow know where the data
comes from and from which instance the window originates. The title bar has been
recognized as best place to show that information, since then it is also visible
on a operating system provided taskbar when running on windows OS and different
window switching operations depending on used OS. 

The text what we want to write, is static in that sense that it is not changed
anymore after setting it on startup of application.