JDK-6885735 : closed/java/awt/Component/DisablingLWDisabledHW/DisablingLWDisabledHW.html fails
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2009-09-25
  • Updated: 2011-01-19
  • Resolved: 2009-11-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b77Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
The test fails with the latest JDK 7 build. The main frame of the test displays only 4 buttons out of 8. This causes some buttons to not be clicked, and hence the test is failing.

Comments
EVALUATION Apparently we already have the Contianer.isRecursivelyVisibleUpToHeavyweightContainer() method. It just needs to be moved down to the Component class.
29-09-2009

SUGGESTED FIX --- old/src/share/classes/java/awt/Component.java 2009-09-29 16:30:37.000000000 +0400 +++ new/src/share/classes/java/awt/Component.java 2009-09-29 16:30:36.000000000 +0400 @@ -1209,6 +1209,20 @@ } /** + * Checks if the component and its direct lightweight containers are + * visible. + * + * Consider the heavyweight container hides or shows the HW descendants + * automatically. Therefore we care of LW containers' visibility only. + * + * This method MUST be invoked under the TreeLock. + */ + boolean isRecursivelyVisibleUpToHeavyweightContainer() { + return isVisible() && (getContainer() == null || + getContainer().isRecursivelyVisibleUpToHeavyweightContainer()); + } + + /** * Translates absolute coordinates into coordinates in the coordinate * space of this component. */ @@ -6725,7 +6739,7 @@ Container parent = this.parent; if (parent != null && parent.peer instanceof LightweightPeer) { relocateComponent(); - if (!isRecursivelyVisible()) { + if (!isRecursivelyVisibleUpToHeavyweightContainer()) { peer.setVisible(false); } } --- old/src/share/classes/java/awt/Container.java 2009-09-29 16:30:39.000000000 +0400 +++ new/src/share/classes/java/awt/Container.java 2009-09-29 16:30:38.000000000 +0400 @@ -4092,16 +4092,12 @@ } } - /* - * Consider the heavyweight container hides or shows the HW descendants - * automatically. Therefore we care of LW containers' visibility only. - */ - private boolean isRecursivelyVisibleUpToHeavyweightContainer() { + @Override + final boolean isRecursivelyVisibleUpToHeavyweightContainer() { if (!isLightweight()) { return true; } - return isVisible() && (getContainer() == null || - getContainer().isRecursivelyVisibleUpToHeavyweightContainer()); + return super.isRecursivelyVisibleUpToHeavyweightContainer(); } @Override
29-09-2009

EVALUATION This is a regression of 6689468. The fix hides the peer of a component if the component is not recursively visible. The buttons in the test get added while the frame is hidden. This causes the buttons' peer to be hidden. It looks like we should not use the isRecursivelyVisible() method to determine if we need to hide the peer. Instead, we need a isRecursivelyVisibleInLightweightContainers() method which would stop traversing the hierarchy when it encounters a heavyweight parent. Heavyweight parents automatically enforce the visiblility of child components, and therefore need not be checked specifically.
25-09-2009