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.
Hi, 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. br, Pasi
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).
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 reference?
I forgot, of course there is http://www.netbeans.org/download/dev/javadoc/org-openide-windows/org/openide/windows/WindowManager.html#getMainWindow() 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.
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 ...
Another question is WHEN should we write there? Definitelly not during ModuleInstall.restored() - the main window is not there yet. So when?
AFAIK winsys only sets it only once while building main window. Maybe http://www.netbeans.org/download/dev/javadoc/org-openide-windows/org/openide/windows/WindowManager.html#invokeWhenUIReady(java.lang.Runnable) can help you to set it at the end of startup sequence.
Use WindowManager.invokeWhenUIReady, this should work.
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.
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?
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.
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.