< prev index next >

src/java.desktop/macosx/classes/sun/lwawt/macosx/CWarningWindow.java

Print this page




  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.lwawt.macosx;
  27 
  28 import sun.awt.AWTAccessor;
  29 import sun.awt.IconInfo;
  30 import sun.java2d.SunGraphics2D;
  31 import sun.java2d.SurfaceData;

  32 import sun.java2d.opengl.CGLLayer;
  33 import sun.lwawt.LWWindowPeer;
  34 import sun.lwawt.PlatformEventNotifier;
  35 import sun.lwawt.SecurityWarningWindow;
  36 
  37 import java.awt.*;
  38 import java.awt.event.MouseEvent;
  39 import java.awt.geom.Point2D;
  40 import java.lang.ref.WeakReference;
  41 
  42 public final class CWarningWindow extends CPlatformWindow
  43         implements SecurityWarningWindow, PlatformEventNotifier {
  44 
  45     private static class Lock {}
  46     private final Lock lock = new Lock();
  47 
  48     private static final int SHOWING_DELAY = 300;
  49     private static final int HIDING_DELAY = 2000;
  50 
  51     private Rectangle bounds = new Rectangle();


 283             public Rectangle getBounds() {
 284                 return CWarningWindow.this.getBounds();
 285             }
 286 
 287             public CGLLayer createCGLayer() {
 288                 return new CGLLayer(null) {
 289                     public Rectangle getBounds() {
 290                         return CWarningWindow.this.getBounds();
 291                     }
 292 
 293                     public GraphicsConfiguration getGraphicsConfiguration() {
 294                         LWWindowPeer peer = ownerPeer.get();
 295                         return peer.getGraphicsConfiguration();
 296                     }
 297 
 298                     public boolean isOpaque() {
 299                         return false;
 300                     }
 301                 };
 302             }

















 303         };
 304     }
 305 
 306     @Override
 307     public void dispose() {
 308         cancelTasks();
 309         SurfaceData surfaceData = contentView.getSurfaceData();
 310         if (surfaceData != null) {
 311             surfaceData.invalidate();
 312         }
 313         super.dispose();
 314     }
 315 
 316     private void cancelTasks() {
 317         synchronized (taskLock) {
 318             if (showHideTask != null) {
 319                 showHideTask.cancel();
 320                 showHideTask = null;
 321             }
 322         }




  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.lwawt.macosx;
  27 
  28 import sun.awt.AWTAccessor;
  29 import sun.awt.IconInfo;
  30 import sun.java2d.SunGraphics2D;
  31 import sun.java2d.SurfaceData;
  32 import sun.java2d.metal.MTLLayer;
  33 import sun.java2d.opengl.CGLLayer;
  34 import sun.lwawt.LWWindowPeer;
  35 import sun.lwawt.PlatformEventNotifier;
  36 import sun.lwawt.SecurityWarningWindow;
  37 
  38 import java.awt.*;
  39 import java.awt.event.MouseEvent;
  40 import java.awt.geom.Point2D;
  41 import java.lang.ref.WeakReference;
  42 
  43 public final class CWarningWindow extends CPlatformWindow
  44         implements SecurityWarningWindow, PlatformEventNotifier {
  45 
  46     private static class Lock {}
  47     private final Lock lock = new Lock();
  48 
  49     private static final int SHOWING_DELAY = 300;
  50     private static final int HIDING_DELAY = 2000;
  51 
  52     private Rectangle bounds = new Rectangle();


 284             public Rectangle getBounds() {
 285                 return CWarningWindow.this.getBounds();
 286             }
 287 
 288             public CGLLayer createCGLayer() {
 289                 return new CGLLayer(null) {
 290                     public Rectangle getBounds() {
 291                         return CWarningWindow.this.getBounds();
 292                     }
 293 
 294                     public GraphicsConfiguration getGraphicsConfiguration() {
 295                         LWWindowPeer peer = ownerPeer.get();
 296                         return peer.getGraphicsConfiguration();
 297                     }
 298 
 299                     public boolean isOpaque() {
 300                         return false;
 301                     }
 302                 };
 303             }
 304             public MTLLayer createMTLLayer() {
 305                 return new MTLLayer(null) {
 306                     public Rectangle getBounds() {
 307                         return CWarningWindow.this.getBounds();
 308                     }
 309 
 310                     public GraphicsConfiguration getGraphicsConfiguration() {
 311                         LWWindowPeer peer = ownerPeer.get();
 312                         return peer.getGraphicsConfiguration();
 313                     }
 314 
 315                     public boolean isOpaque() {
 316                         return false;
 317                     }
 318                 };
 319             }
 320 
 321         };
 322     }
 323 
 324     @Override
 325     public void dispose() {
 326         cancelTasks();
 327         SurfaceData surfaceData = contentView.getSurfaceData();
 328         if (surfaceData != null) {
 329             surfaceData.invalidate();
 330         }
 331         super.dispose();
 332     }
 333 
 334     private void cancelTasks() {
 335         synchronized (taskLock) {
 336             if (showHideTask != null) {
 337                 showHideTask.cancel();
 338                 showHideTask = null;
 339             }
 340         }


< prev index next >