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 134802 - Setting custom main window title doesn't work in Platform app with project.ui included (was: Refresh of Main Window Title is cumbersome)
Summary: Setting custom main window title doesn't work in Platform app with project.ui...
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Projects UI (show other bugs)
Version: 6.x
Hardware: PC All
: P3 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords: API
Depends on: 199245
Blocks:
  Show dependency tree
 
Reported: 2008-05-10 11:27 UTC by ngx472
Modified: 2011-06-07 20:21 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ngx472 2008-05-10 11:27:15 UTC
- I am using the netbeans platform to write an SQL Editor
- I would like to have the Main title bar displaying something not known at build time
- I have to include the ProjectUI module in my project because of chained dependencies
- Because of org.netbeans.modules.project.ui.Hacks, I have to register my own listener (with a timer set to just above
the one used in Hacks -200) to overwrite the Main Window title
- This is a bit inconvenient and creates flickering!
- Hacks documentation says that this needs to be reviewed at some point!

Thanks!
Comment 1 Lukas Hasik 2008-11-20 15:03:57 UTC
Do you really need the whole hack? shouldn't this be enough ? ->WindowManager.getDefault().getMainWindow().setTitle(title);
Comment 2 ngx472 2008-11-22 22:30:28 UTC
I am not sure I get your point.

When I program a setTitle in my componentActivated, the title blinks and then gets updated 1/2 second later with the
module title, which is not exactly what I want. How can prevent netbeans from deciding what title the mainWindow should
have? Alternatively, how do I set the string that serves as the main window title?

Tks!
Comment 3 ngx472 2008-11-22 22:34:21 UTC
(Precision: I need to set the window title with values that are known at runtime and not at build time)
Tks
Comment 4 David Simonek 2008-11-24 10:29:03 UTC
I'm reopening, it is valid and nasty defect, should be fixed better sooner then later IMHO - although there is
WindowManager.getDefault().getMainWindow().setTitle(title), it doesn't work as expected.

AFAIK there is a little problem that we don't want modules to call methods on WindowManager.getDefault().getMainWindow()
directly, but we made an error in API designing in past, method is here so we can't stop modules from calling into main
window directly.

I see two possible solutions:
a) Make hack in projects ui more clever and somehow stop setting main window title if other clients starts to call
WindowManager.getDefault().getMainWindow().setTitle(title). Cooperation between projects.ui and core/window system would
be needed to achieve this (through main window JFrame's client property friend API I think).

b) Add API to projectui API to enable/disable current project's behavior.

In either way, javadoc for WindowManager.getDefault().getMainWindow() should be improved and explain what to do if
custom window title is desired.

Note that IMHO it is not good to add any naming API to window system, because as I said we can't stop anybody from
calling WindowManager.getDefault().getMainWindow().setTitle(title) and break any naming mechanism down.
Comment 5 Jesse Glick 2010-04-08 02:43:08 UTC
Fixable by just suppressing the MW title update when it seems to be changing behind our backs.
Comment 6 Jesse Glick 2010-04-08 02:44:26 UTC
core-main #d3f79853b99f
Comment 7 Quality Engineering 2010-04-09 04:46:08 UTC
Integrated into 'main-golden', will be available in build *201004090201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/d3f79853b99f
User: Jesse Glick <jglick@netbeans.org>
Log: #134802: Setting custom main window title doesn't work in Platform app with project.ui included (was: Refresh of Main Window Title is cumbersome)