src/macosx/classes/sun/lwawt/LWComponentPeer.java

Print this page




  86             new StringBuilder("LWComponentPeer.peerTreeLock");
  87 
  88     private final T target;
  89 
  90     // Container peer. It may not be the peer of the target's direct
  91     // parent, for example, in the case of hw/lw mixing. However,
  92     // let's skip this scenario for the time being. We also assume
  93     // the container peer is not null, which might also be false if
  94     // addNotify() is called for a component outside of the hierarchy.
  95     // The exception is LWWindowPeers: their parents are always null
  96     private LWContainerPeer containerPeer;
  97 
  98     // Handy reference to the top-level window peer. Window peer is
  99     // borrowed from the containerPeer in constructor, and should also
 100     // be updated when the component is reparented to another container
 101     private LWWindowPeer windowPeer;
 102 
 103     private final AtomicBoolean disposed = new AtomicBoolean(false);
 104 
 105     // Bounds are relative to parent peer
 106     private final Rectangle bounds = new Rectangle();
 107     private Region region;
 108 
 109     // Component state. Should be accessed under the state lock
 110     private boolean visible = false;
 111     private boolean enabled = true;
 112 
 113     private Color background;
 114     private Color foreground;
 115     private Font font;
 116 
 117     /**
 118      * Paint area to coalesce all the paint events and store the target dirty
 119      * area.
 120      */
 121     private final RepaintArea targetPaintArea;
 122 
 123     //   private volatile boolean paintPending;
 124     private volatile boolean isLayouting;
 125 
 126     private final D delegate;


 422     }
 423 
 424 
 425     // Just a helper method
 426     public final LWGraphicsConfig getLWGC() {
 427         return (LWGraphicsConfig) getGraphicsConfiguration();
 428     }
 429 
 430     /*
 431      * Overridden in LWWindowPeer to replace its surface
 432      * data and back buffer.
 433      */
 434     @Override
 435     public boolean updateGraphicsData(GraphicsConfiguration gc) {
 436         // TODO: not implemented
 437 //        throw new RuntimeException("Has not been implemented yet.");
 438         return false;
 439     }
 440 
 441     @Override
 442     public final Graphics getGraphics() {
 443         final Graphics g = getOnscreenGraphics();
 444         if (g != null) {
 445             synchronized (getPeerTreeLock()){
 446                 applyConstrain(g);
 447             }
 448         }
 449         return g;
 450     }
 451 
 452     /*
 453      * Peer Graphics is borrowed from the parent peer, while
 454      * foreground and background colors and font are specific to
 455      * this peer.
 456      */
 457     public final Graphics getOnscreenGraphics() {
 458         final LWWindowPeer wp = getWindowPeerOrSelf();
 459         return wp.getOnscreenGraphics(getForeground(), getBackground(),
 460                                       getFont());
 461 
 462     }




  86             new StringBuilder("LWComponentPeer.peerTreeLock");
  87 
  88     private final T target;
  89 
  90     // Container peer. It may not be the peer of the target's direct
  91     // parent, for example, in the case of hw/lw mixing. However,
  92     // let's skip this scenario for the time being. We also assume
  93     // the container peer is not null, which might also be false if
  94     // addNotify() is called for a component outside of the hierarchy.
  95     // The exception is LWWindowPeers: their parents are always null
  96     private LWContainerPeer containerPeer;
  97 
  98     // Handy reference to the top-level window peer. Window peer is
  99     // borrowed from the containerPeer in constructor, and should also
 100     // be updated when the component is reparented to another container
 101     private LWWindowPeer windowPeer;
 102 
 103     private final AtomicBoolean disposed = new AtomicBoolean(false);
 104 
 105     // Bounds are relative to parent peer
 106     protected final Rectangle bounds = new Rectangle();
 107     private Region region;
 108 
 109     // Component state. Should be accessed under the state lock
 110     private boolean visible = false;
 111     private boolean enabled = true;
 112 
 113     private Color background;
 114     private Color foreground;
 115     private Font font;
 116 
 117     /**
 118      * Paint area to coalesce all the paint events and store the target dirty
 119      * area.
 120      */
 121     private final RepaintArea targetPaintArea;
 122 
 123     //   private volatile boolean paintPending;
 124     private volatile boolean isLayouting;
 125 
 126     private final D delegate;


 422     }
 423 
 424 
 425     // Just a helper method
 426     public final LWGraphicsConfig getLWGC() {
 427         return (LWGraphicsConfig) getGraphicsConfiguration();
 428     }
 429 
 430     /*
 431      * Overridden in LWWindowPeer to replace its surface
 432      * data and back buffer.
 433      */
 434     @Override
 435     public boolean updateGraphicsData(GraphicsConfiguration gc) {
 436         // TODO: not implemented
 437 //        throw new RuntimeException("Has not been implemented yet.");
 438         return false;
 439     }
 440 
 441     @Override
 442     public Graphics getGraphics() {
 443         final Graphics g = getOnscreenGraphics();
 444         if (g != null) {
 445             synchronized (getPeerTreeLock()){
 446                 applyConstrain(g);
 447             }
 448         }
 449         return g;
 450     }
 451 
 452     /*
 453      * Peer Graphics is borrowed from the parent peer, while
 454      * foreground and background colors and font are specific to
 455      * this peer.
 456      */
 457     public final Graphics getOnscreenGraphics() {
 458         final LWWindowPeer wp = getWindowPeerOrSelf();
 459         return wp.getOnscreenGraphics(getForeground(), getBackground(),
 460                                       getFont());
 461 
 462     }