src/solaris/classes/sun/awt/X11/XComponentPeer.java

Print this page

        

*** 80,90 **** private static final PlatformLogger enableLog = PlatformLogger.getLogger("sun.awt.X11.enable.XComponentPeer"); private static final PlatformLogger shapeLog = PlatformLogger.getLogger("sun.awt.X11.shape.XComponentPeer"); boolean paintPending = false; boolean isLayouting = false; ! boolean enabled; // Actually used only by XDecoratedPeer protected int boundsOperation; Color foreground; --- 80,90 ---- private static final PlatformLogger enableLog = PlatformLogger.getLogger("sun.awt.X11.enable.XComponentPeer"); private static final PlatformLogger shapeLog = PlatformLogger.getLogger("sun.awt.X11.shape.XComponentPeer"); boolean paintPending = false; boolean isLayouting = false; ! private boolean enabled; // Actually used only by XDecoratedPeer protected int boundsOperation; Color foreground;
*** 126,138 **** super.preInit(params); boundsOperation = DEFAULT_OPERATION; } void postInit(XCreateWindowParams params) { super.postInit(params); - Color c; - Font f; - Cursor cursor; pSetCursor(target.getCursor()); foreground = target.getForeground(); background = target.getBackground(); --- 126,135 ----
*** 141,163 **** if (isInitialReshape()) { Rectangle r = target.getBounds(); reshape(r.x, r.y, r.width, r.height); } ! enabled = target.isEnabled(); ! ! // If any of our heavyweight ancestors are disable, we should be too ! // See 6176875 for more information ! Component comp = target; ! while( !(comp == null || comp instanceof Window) ) { ! comp = comp.getParent(); ! if( comp != null && !comp.isEnabled() && !comp.isLightweight() ){ ! setEnabled(false); ! break; ! } ! } ! enableLog.fine("Initial enable state: {0}", Boolean.valueOf(enabled)); if (target.isVisible()) { setVisible(true); } } --- 138,148 ---- if (isInitialReshape()) { Rectangle r = target.getBounds(); reshape(r.x, r.y, r.width, r.height); } ! setEnabled(target.isEnabled()); if (target.isVisible()) { setVisible(true); } }
*** 382,430 **** public void hide() { setVisible(false); } - /** * @see java.awt.peer.ComponentPeer */ ! public void setEnabled(boolean value) { ! enableLog.fine("{0}ing {1}", (value?"Enabl":"Disabl"), this); ! boolean repaintNeeded = (enabled != value); ! enabled = value; if (target instanceof Container) { ! Component list[] = ((Container)target).getComponents(); ! for (int i = 0; i < list.length; ++i) { ! boolean childEnabled = list[i].isEnabled(); ! ComponentPeer p = list[i].getPeer(); ! if ( p != null ) { ! p.setEnabled(value && childEnabled); } } } - if (repaintNeeded) { repaint(); } - } // // public so aw/Window can call it // ! public boolean isEnabled() { return enabled; } - - - - public void enable() { - setEnabled(true); } - public void disable() { - setEnabled(false); - } @Override public void paint(final Graphics g) { super.paint(g); // allow target to change the picture target.paint(g); --- 367,418 ---- public void hide() { setVisible(false); } /** * @see java.awt.peer.ComponentPeer */ ! public void setEnabled(final boolean value) { ! if (enableLog.isLoggable(PlatformLogger.FINE)) { ! enableLog.fine("{0}ing {1}", (value ? "Enabl" : "Disabl"), this); ! } ! boolean status = value; ! // If any of our heavyweight ancestors are disable, we should be too ! // See 6176875 for more information ! final Container cp = SunToolkit.getNativeContainer(target); ! if (cp != null) { ! status &= ((XComponentPeer) cp.getPeer()).isEnabled(); ! } ! synchronized (getStateLock()) { ! if (enabled == status) { ! return; ! } ! enabled = status; ! } ! if (target instanceof Container) { ! final Component[] list = ((Container) target).getComponents(); ! for (final Component child : list) { ! final ComponentPeer p = child.getPeer(); ! if (p != null) { ! p.setEnabled(status && child.isEnabled()); } } } repaint(); } // // public so aw/Window can call it // ! public final boolean isEnabled() { ! synchronized (getStateLock()) { return enabled; } } @Override public void paint(final Graphics g) { super.paint(g); // allow target to change the picture target.paint(g);