1 /*
2 * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
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 java.awt.*;
29 import java.awt.event.FocusEvent.Cause;
30 import java.awt.peer.*;
31 import java.awt.BufferCapabilities.FlipContents;
32 import java.awt.event.*;
33 import java.awt.image.*;
34 import java.security.AccessController;
35 import java.util.List;
36 import java.io.*;
37
38 import sun.awt.AWTAccessor;
39 import sun.java2d.pipe.Region;
40 import sun.security.action.GetBooleanAction;
41
42 class CFileDialog implements FileDialogPeer {
43
44 private class Task implements Runnable {
45
46 @Override
47 public void run() {
48 try {
49 boolean navigateApps = !AccessController.doPrivileged(
50 new GetBooleanAction("apple.awt.use-file-dialog-packages"));
51 boolean chooseDirectories = AccessController.doPrivileged(
52 new GetBooleanAction("apple.awt.fileDialogForDirectories"));
53
54 int dialogMode = target.getMode();
55 String title = target.getTitle();
56 if (title == null) {
232
233 @Override
234 public void endValidate() {
235 }
236
237 @Override
238 public Insets getInsets() {
239 return new Insets(0, 0, 0, 0);
240 }
241
242 @Override
243 public void applyShape(Region shape) {
244 }
245
246 @Override
247 public boolean canDetermineObscurity() {
248 return false;
249 }
250
251 @Override
252 public int checkImage(Image img, int w, int h, ImageObserver o) {
253 return 0;
254 }
255
256 @Override
257 public void coalescePaintEvent(PaintEvent e) {
258 }
259
260 @Override
261 public void createBuffers(int numBuffers, BufferCapabilities caps)
262 throws AWTException {
263 }
264
265 @Override
266 public Image createImage(ImageProducer producer) {
267 return null;
268 }
269
270 @Override
271 public Image createImage(int width, int height) {
272 return null;
273 }
274
275 @Override
276 public VolatileImage createVolatileImage(int width, int height) {
277 return null;
278 }
279
280 @Override
281 public void destroyBuffers() {
282 }
283
284 @Override
285 public void flip(int x1, int y1, int x2, int y2, FlipContents flipAction) {
286 }
287
288 @Override
289 public Image getBackBuffer() {
290 return null;
341
342 @Override
343 public boolean isObscured() {
344 return false;
345 }
346
347 @Override
348 public boolean isReparentSupported() {
349 return false;
350 }
351
352 @Override
353 public void layout() {
354 }
355
356 @Override
357 public void paint(Graphics g) {
358 }
359
360 @Override
361 public boolean prepareImage(Image img, int w, int h, ImageObserver o) {
362 return false;
363 }
364
365 @Override
366 public void print(Graphics g) {
367 }
368
369 @Override
370 public void reparent(ContainerPeer newContainer) {
371 }
372
373 @Override
374 public boolean requestFocus(Component lightweightChild, boolean temporary,
375 boolean focusedWindowChangeAllowed, long time, Cause cause) {
376 return false;
377 }
378
379 @Override
380 public void setBackground(Color c) {
381 }
382
383 @Override
384 public void setForeground(Color c) {
385 }
|
1 /*
2 * Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
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 java.awt.AWTEvent;
29 import java.awt.AWTException;
30 import java.awt.BufferCapabilities;
31 import java.awt.BufferCapabilities.FlipContents;
32 import java.awt.Color;
33 import java.awt.Component;
34 import java.awt.Dialog;
35 import java.awt.Dimension;
36 import java.awt.FileDialog;
37 import java.awt.Font;
38 import java.awt.FontMetrics;
39 import java.awt.Graphics;
40 import java.awt.GraphicsConfiguration;
41 import java.awt.Image;
42 import java.awt.Insets;
43 import java.awt.Point;
44 import java.awt.Window;
45 import java.awt.event.FocusEvent.Cause;
46 import java.awt.event.PaintEvent;
47 import java.awt.image.ColorModel;
48 import java.awt.image.VolatileImage;
49 import java.awt.peer.ComponentPeer;
50 import java.awt.peer.ContainerPeer;
51 import java.awt.peer.FileDialogPeer;
52 import java.io.File;
53 import java.io.FilenameFilter;
54 import java.security.AccessController;
55 import java.util.List;
56
57 import sun.awt.AWTAccessor;
58 import sun.java2d.pipe.Region;
59 import sun.security.action.GetBooleanAction;
60
61 class CFileDialog implements FileDialogPeer {
62
63 private class Task implements Runnable {
64
65 @Override
66 public void run() {
67 try {
68 boolean navigateApps = !AccessController.doPrivileged(
69 new GetBooleanAction("apple.awt.use-file-dialog-packages"));
70 boolean chooseDirectories = AccessController.doPrivileged(
71 new GetBooleanAction("apple.awt.fileDialogForDirectories"));
72
73 int dialogMode = target.getMode();
74 String title = target.getTitle();
75 if (title == null) {
251
252 @Override
253 public void endValidate() {
254 }
255
256 @Override
257 public Insets getInsets() {
258 return new Insets(0, 0, 0, 0);
259 }
260
261 @Override
262 public void applyShape(Region shape) {
263 }
264
265 @Override
266 public boolean canDetermineObscurity() {
267 return false;
268 }
269
270 @Override
271 public void coalescePaintEvent(PaintEvent e) {
272 }
273
274 @Override
275 public void createBuffers(int numBuffers, BufferCapabilities caps)
276 throws AWTException {
277 }
278
279 @Override
280 public Image createImage(int width, int height) {
281 return null;
282 }
283
284 @Override
285 public VolatileImage createVolatileImage(int width, int height) {
286 return null;
287 }
288
289 @Override
290 public void destroyBuffers() {
291 }
292
293 @Override
294 public void flip(int x1, int y1, int x2, int y2, FlipContents flipAction) {
295 }
296
297 @Override
298 public Image getBackBuffer() {
299 return null;
350
351 @Override
352 public boolean isObscured() {
353 return false;
354 }
355
356 @Override
357 public boolean isReparentSupported() {
358 return false;
359 }
360
361 @Override
362 public void layout() {
363 }
364
365 @Override
366 public void paint(Graphics g) {
367 }
368
369 @Override
370 public void print(Graphics g) {
371 }
372
373 @Override
374 public void reparent(ContainerPeer newContainer) {
375 }
376
377 @Override
378 public boolean requestFocus(Component lightweightChild, boolean temporary,
379 boolean focusedWindowChangeAllowed, long time, Cause cause) {
380 return false;
381 }
382
383 @Override
384 public void setBackground(Color c) {
385 }
386
387 @Override
388 public void setForeground(Color c) {
389 }
|