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 79130 - TC with heavyweight component paints over other modes
Summary: TC with heavyweight component paints over other modes
Status: RESOLVED WORKSFORME
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Stanislav Aubrecht
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-26 21:24 UTC by Rich Unger
Modified: 2009-04-02 14:53 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
screenshot (212.97 KB, image/png)
2006-06-26 21:24 UTC, Rich Unger
Details
BaseLine (68.07 KB, application/octet-stream)
2006-07-19 12:54 UTC, Matthew Stevens
Details
Resize NB Smaller (92.85 KB, application/octet-stream)
2006-07-19 12:55 UTC, Matthew Stevens
Details
docking "minimizing" Properties Window (78.36 KB, application/octet-stream)
2006-07-19 12:55 UTC, Matthew Stevens
Details
Float Properties Window (Z-ordering issue) (85.59 KB, application/octet-stream)
2006-07-19 12:56 UTC, Matthew Stevens
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rich Unger 2006-06-26 21:24:18 UTC
See the attached screenshot.  I have a TC in the editor mode which uses a JDIC
browser.

Code for this is at https://jdic-netbeans.dev.java.net/
NBM available at http://www.nbextras.org/2006/04/24/1145914287438.html

The TC paints over the output mode.
Comment 1 Rich Unger 2006-06-26 21:24:46 UTC
Created attachment 31393 [details]
screenshot
Comment 2 David Simonek 2006-06-27 10:14:27 UTC
Hmm, mixing with heavyweight components will always be a problem in Swing, I'm
not sure if we can do anything here...
Comment 3 gustavosantucho 2006-06-27 14:55:07 UTC
This mixing seems to be a common problem for all docking frameworks. I found
this particular workaround based on Container.setComponentZOrder().
I've read somewhere that the JOGL team came up with something regarding
heavyweight/lightweight mixing.
Comment 4 gustavosantucho 2006-06-27 14:57:13 UTC
Sorry, the link I found:

http://www.vlsolutions.com/en/documentation/docking/tutorial/tutorial7.php
Comment 5 Matthew Stevens 2006-07-19 12:27:52 UTC
I have been evaluating Rich's prototype and had also ask David about the
painting issues.

Java3D and JOGL both have HW AWT Canvas specializations, like the JDIC browser
component does.  JOGL does also have a Swing component.  I talked to the Sun
engineer who worked on it.  He said that they worked around the HW mixing
problem by rendering the to an offscreen buffer and then copying to JOGL Swing
component.  This of course has performance issues and the engineer suggested
that, naturally, as the dimenions of the JOGL Swing component increases the
performance falls off wrt to fps.  For Mustang, as part of some Java2D
performance improvement work they have come up with a special optimization for
the JOGL Swing component which minimizes or eliminates the copying.  The result
is that the JOGL Swing component will perform better in Mustang.

Its obvious to me that duplicating the JOGL Swing component design for the JDIC
browser is interesting idea.  However, given the predictably large size of the
component the buffer copying technique would not be a success.  I can't recall
exact reason but the JOGL optimization technique would also not be possible.
Comment 6 Matthew Stevens 2006-07-19 12:51:57 UTC
Specifically on this issue I am attaching four (4) screen shots.

BrowserBaseLine shows the JDIC Browser TC working good when first started.  I
get scrollbars (from IE) for the large HTML pages and the TC fits in well with
NB Windows.  If I resize NetBeans (Shrink) I do NOT get proper resizing of the
browser and it paints beyond its window boundary and is only clipped by the HW
frame. (See BrowserResize1)

From the baseline (notice properties window at SW corner) if I dock Properties
Window into the margin it causes a slight horizontal reduction of the browser
TC...(see BrowserResizeAfterDockingProperties) and the Browser again is not
resized propertly and overlaps on the right.

This strikes me as a resize problem; one which could be overcome by coordinating
events from the NB Window system pushed down on the TC to the JDIC component.

I believe that Rich's original issue description and screenshot is
representative of a resize problem that results in overlapping the Output. 
Whether this resize problem is in the JDIC or in the TC encapsulation I don't
know but I would be aghast if the JDIC component couldn't handle resizes after
all these years.

There is still, as I showed David in person in Prague this week, as classic
Z-order problem when you try to "float" the docked Properties Window.  In this
case we are intentionally overlapping.  David suggested (and I agree) that this
is unfixable given the general matter in Swing with LW HW mixing.  He did
believe that a suitable workaround may be fine.  Conceptually, we could
temporaily disengage Window System floating feature WHILE a HW TC isShowing.  I
don't know much about UI useability but perhaps the FLOAT behavior can be
replaced with "restore" WHILE a HW TC isShowing.  Essentially, one can minimize
a window and then restore...but not float WHILE a HW TC isShowing.

Comments?
Comment 7 Matthew Stevens 2006-07-19 12:54:55 UTC
Created attachment 31992 [details]
BaseLine
Comment 8 Matthew Stevens 2006-07-19 12:55:22 UTC
Created attachment 31993 [details]
Resize NB Smaller
Comment 9 Matthew Stevens 2006-07-19 12:55:53 UTC
Created attachment 31995 [details]
docking "minimizing" Properties Window
Comment 10 Matthew Stevens 2006-07-19 12:56:47 UTC
Created attachment 31996 [details]
Float Properties Window (Z-ordering issue)
Comment 11 Rich Unger 2006-07-19 16:05:39 UTC
Are you suggesting that I should add a ComponentListener on the browser's
TopComponent and do:

void componentResized(...) { jdicWebBrowser.setBounds(...); }
Comment 12 Rich Unger 2008-01-02 20:46:56 UTC
I'm trying to mitigate some of these issues (except for the "floating dock" problem) by adding the following to my TC
definition:

        addComponentListener(new ComponentAdapter() {
            @Override
            public void componentResized(ComponentEvent evt) {
                if (evt.getID() == ComponentEvent.COMPONENT_RESIZED) {
                    Rectangle bounds = evt.getComponent().getBounds();
                    m_browser.setBounds(bounds.x, bounds.y, bounds.width, bounds.height);
                    System.err.println("NEW BOUNDS: " + bounds.x + ',' + bounds.y + ',' + bounds.width + ',' +
bounds.height);
                }
            }
        });

...however, I am not getting new events when docking new components in neighboring modes (like Properties), or resizing
docked components.  Should I be listening for something else?
Comment 13 willemv 2008-01-17 17:43:48 UTC
Docking frameworks such as Jide (www.jidesoft.com), and VL Docking (www.vlsolutions.com) solve this problem by using a
heavyweight container whenever a tab partially overlaps another tab.  

That is, when you minimize TopComponent 'A' to the side, and press the button to show A again, it is displayed on top of
the existing components.  If any of those is a heavyweight, say B, (and A isn't a heavyweight), B will be painted on top
of A despite it should have been the other way around.  

The solution is to make sure that whenever a TopComponent (including decorations such as x-button) is displayed on top
of the others, it is put in a heavyweight container (e.g. java.awt.Panel) before adding it to the Swing tree.  Using
this simple trick, all paint order problems are gone!
Comment 14 David Simonek 2008-11-21 13:42:07 UTC
passing to saubrecht - we really should try to fix this soon, see last comment from willemv, it shouldn't be hard. For
original problem with browser, I don't know why resizing events are not coming? More evaluation is needed.
Comment 15 Stanislav Aubrecht 2009-04-02 14:53:12 UTC
i've tried jdk 1.6.0_12 and popup menus and sliding windows are painted correctly above heavyweight components (i tested
java.awt.Canvas)

closing