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 40507

Summary: OW refuses focus when empty (was: Activating a TopComponent does not move focus to its focus cycle)
Product: platform Reporter: Marian Petras <mpetras>
Component: Output WindowAssignee: _ tboudreau <tboudreau>
Status: VERIFIED FIXED    
Severity: blocker Keywords: FOCUS
Priority: P2    
Version: 3.x   
Hardware: PC   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 36840, 41766, 43195    

Description Marian Petras 2004-02-26 07:55:43 UTC
When a TopComponent is activated, a member of its
focus cycle should gain focus.

There are many scenarios to reproduce the problem.
This is one one example:

1) open the Filesystems explorer (Ctrl-2)
2) open the Output Window (Ctrl-4)
3) activate the Explorer (Ctrl-2)
4) activate the Output Window by clicking in its
   title bar

The Output Window is now activated (its title bar
highlighted) but a node in the filesystems
explorer has focus. If you start typing, you won't
see any changes in the output window but an
incremental search feature is activated in the
Explorer.
Comment 1 Marian Petras 2004-02-26 07:57:47 UTC
The bad thing is also that TopComponents do not provide an API for
focus management (such as getFocusCycleRoot()).
Comment 2 David Simonek 2004-02-26 12:12:31 UTC
Nope, it does provide API, check tc.requestActive.
Comment 3 Marian Petras 2004-04-07 07:43:31 UTC
TopComponent.requestActive() activates the TopComponent but it may not
move focus to it - that's the bug.
Comment 4 David Simonek 2004-06-17 17:40:32 UTC
1) TopComponent.requestActive() does everything it can AFAIK to give
focus to the component. Please see ViewHierarchy.java, line 342 if you
don't believe.

2) Scenario you mentioned works only if you have output window empty.
AFAIK all other components works OK, problem isn't in winsys
infrastructure, but in the fact that OW *refuses* focus when empty,
that's the bug IMHO.
Comment 5 _ tboudreau 2004-06-17 23:37:45 UTC
If the output window is empty, there is no component that *should* be
focusable.  Where should focus go?  I guess I could make the container
focusable conditionally, if it is empty - but sending focus to
non-focus-indicating things is generally a pretty bad idea.
Comment 6 _ tboudreau 2004-06-22 21:10:08 UTC
The problem here is that TopComponent.requestFocus() is overridden 
to be a no-op.  So the output window doesn't contain any focusable 
components if it is empty, and it cannot set focus to itself.
Comment 7 Marian Petras 2004-06-23 16:32:32 UTC
For more examples of bad behaviour, please look at the bugs that
depend on this one.

Since bug #43195 that depends on this one is P2, I raise priority of
this bug to P2.
Comment 8 _ tboudreau 2004-06-26 06:10:33 UTC
Checking in src/org/netbeans/core/output2/Controller.java;
/cvs/core/output2/src/org/netbeans/core/output2/Controller.java,v  <--
 Controll
er.java
new revision: 1.6; previous revision: 1.5
done
Checking in src/org/netbeans/core/output2/OutputWindow.java;
/cvs/core/output2/src/org/netbeans/core/output2/OutputWindow.java,v 
<--  Output
Window.java
new revision: 1.4; previous revision: 1.3
done
Processing log script arguments...
More commits to come...
Checking in src/org/netbeans/core/output2/ui/AbstractOutputPane.java;
/cvs/core/output2/src/org/netbeans/core/output2/ui/AbstractOutputPane.java,v
 <-
-  AbstractOutputPane.java
new revision: 1.8; previous revision: 1.7
done
Checking in src/org/netbeans/core/output2/ui/AbstractOutputWindow.java;
/cvs/core/output2/src/org/netbeans/core/output2/ui/AbstractOutputWindow.java,v
<--  AbstractOutputWindow.java
new revision: 1.5; previous revision: 1.4
done
Checking in src/org/netbeans/core/output2/ui/CloseButtonTabbedPane.java;
/cvs/core/output2/src/org/netbeans/core/output2/ui/CloseButtonTabbedPane.java,v
 <--  CloseButtonTabbedPane.java
new revision: 1.3; previous revision: 1.2
done
Processing log script arguments...
Mailing the commit message to cvs@core.netbeans.org (from
tboudreau@netbeans.org
)
Comment 9 Tomas Danek 2005-08-02 11:24:59 UTC
verified in 4.2 dev