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 169501 - Mode should have getState method
Summary: Mode should have getState method
Status: NEW
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 6.x
Hardware: Macintosh All
: P3 blocker (vote)
Assignee: issues@platform
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-29 20:35 UTC by maxnitribitt
Modified: 2009-09-05 16:48 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description maxnitribitt 2009-07-29 20:35:52 UTC
When defining a mode it's possible to set it's default state. During the runtime it's not possible to find out in which
state you are, except for some hacks (comparing parent of TopComponent to Main Frame ) or through the friend API of
core.windows (ModeImpl or WindowSystemImpl). I think since it's part of the mode definition it should also be exposed
via the Mode class. 

My concrete use case was that I needed it for the implementation of the Tabbed Interface in order to set popupmenu
actions for the TopComponent depending on the modes state (http://www.netbeans.org/issues/show_bug.cgi?id=150393).

Workaround:
boolean docked = SwingUtilities.getWindowAncestor( topcomponent ) == WindowManager.getDefault().getMainWindow();
Comment 1 Stanislav Aubrecht 2009-09-04 16:11:29 UTC
i'm not convinced that the 'state' should be part of the generic window system api. it seem more like an attribute of a
concrete ws implementation.
Comment 2 maxnitribitt 2009-09-05 07:28:14 UTC
As I see it the state is already part of the public API: You can set it's default state declaratively to "joined" or
"separated" in the xml configuration file.
Comment 3 err 2009-09-05 16:48:49 UTC
> not convinced that the 'state' should be part of the generic window system api

Are you suggesting that
    docked = SwingUtilities.getWindowAncestor( topcomponent ) == WindowManager.getDefault().getMainWindow();
is the recommended method for determining this information?

Is there some other approach/api that you are considering?