6825362: Avoid calling peer.setZOrder on Window instances

Reviewed-by: anthony
This commit is contained in:
Dmitry Cherepanov 2009-04-20 19:18:41 +04:00
parent 76fedc71ad
commit fbea8d87f4
4 changed files with 13 additions and 43 deletions

View File

@ -6666,7 +6666,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
// Update stacking order
peer.setZOrder(getHWPeerAboveMe());
updateZOrder();
if (!isAddNotifyComplete) {
mixOnShowing();
@ -9838,4 +9838,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
return doesClassImplement(obj.getClass(), interfaceName);
}
// Note that the method is overriden in the Window class,
// a window doesn't need to be updated in the Z-order.
void updateZOrder() {
peer.setZOrder(getHWPeerAboveMe());
}
}

View File

@ -840,7 +840,7 @@ public class Container extends Component {
// Native container changed - need to reparent native widgets
newNativeContainer.reparentChild(comp);
}
comp.peer.setZOrder(comp.getHWPeerAboveMe());
comp.updateZOrder();
if (!comp.isLightweight() && isLightweight()) {
// If component is heavyweight and one of the containers is lightweight

View File

@ -3674,6 +3674,10 @@ public class Window extends Container implements Accessible {
}); // WindowAccessor
} // static
// a window doesn't need to be updated in the Z-order.
@Override
void updateZOrder() {}
} // class Window

View File

@ -99,45 +99,4 @@ class WPanelPeer extends WCanvasPeer implements PanelPeer {
public Insets insets() {
return getInsets();
}
private native void pRestack(Object[] peers);
private void restack(Container cont, Vector peers) {
for (int i = 0; i < cont.getComponentCount(); i++) {
Component comp = cont.getComponent(i);
if (!comp.isLightweight()) {
ComponentPeer peer = comp.getPeer();
if (peer != null && (peer instanceof WComponentPeer))
{
peers.add(peer);
} else {
if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE,
"peer of a {0} is null or not a WComponentPeer: {1}.",
new Object[]{comp, peer});
}
}
}
if (comp.isLightweight() && comp instanceof Container) {
restack((Container)comp, peers);
}
}
}
/**
* @see java.awt.peer.ContainerPeer#restack
*/
public void restack() {
Vector peers = new Vector();
peers.add(this);
Container cont = (Container)target;
restack(cont, peers);
pRestack(peers.toArray());
}
/**
* @see java.awt.peer.ContainerPeer#isRestackSupported
*/
public boolean isRestackSupported() {
return true;
}
}