1 /* 2 * Copyright (c) 2000, 2015, 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.awt; 27 28 import java.awt.peer.TaskbarPeer; 29 import java.awt.*; 30 import java.awt.dnd.DragGestureEvent; 31 import java.awt.dnd.InvalidDnDOperationException; 32 import java.awt.dnd.peer.DragSourceContextPeer; 33 import java.awt.peer.*; 34 35 import sun.awt.datatransfer.DataTransferer; 36 37 final class LightweightPeerHolder { 38 static final LightweightPeer lightweightMarker = new NullComponentPeer(); 39 40 private LightweightPeerHolder() { 41 } 42 } 43 44 /** 45 * Interface for component creation support in toolkits. 46 */ 47 public interface ComponentFactory { 48 49 /** 50 * Creates a peer for a component or container. This peer is windowless and 51 * allows the Component and Container classes to be extended directly to 52 * create windowless components that are defined entirely in java. 53 * 420 default DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) { 421 throw new InvalidDnDOperationException("Headless environment"); 422 } 423 424 /** 425 * Creates this toolkit's implementation of {@code Font} using the specified 426 * peer interface. 427 * 428 * @param name the font to be implemented 429 * @param style the style of the font, such as {@code PLAIN}, {@code BOLD}, 430 * {@code ITALIC}, or a combination 431 * @return this toolkit's implementation of {@code Font} 432 * @see java.awt.Font 433 * @see java.awt.peer.FontPeer 434 * @see java.awt.GraphicsEnvironment#getAllFonts 435 */ 436 default FontPeer getFontPeer(String name, int style) { 437 return null; 438 } 439 440 default RobotPeer createRobot(Robot target, GraphicsDevice screen) 441 throws AWTException { 442 throw new HeadlessException(); 443 } 444 445 default DataTransferer getDataTransferer() { 446 return null; 447 } 448 449 /** 450 * Obtains this toolkit's implementation of helper class for {@code 451 * MouseInfo} operations. 452 * 453 * @return this toolkit's implementation of helper for {@code MouseInfo} 454 * @throws UnsupportedOperationException if this operation is not 455 * implemented 456 * @see java.awt.peer.MouseInfoPeer 457 * @see java.awt.MouseInfo 458 * @since 1.5 459 */ 460 default MouseInfoPeer getMouseInfoPeer() { 461 throw new UnsupportedOperationException("Not implemented"); 462 } | 1 /* 2 * Copyright (c) 2000, 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.awt; 27 28 import java.awt.AWTException; 29 import java.awt.Button; 30 import java.awt.Canvas; 31 import java.awt.Checkbox; 32 import java.awt.CheckboxMenuItem; 33 import java.awt.Choice; 34 import java.awt.Component; 35 import java.awt.Desktop; 36 import java.awt.Dialog; 37 import java.awt.FileDialog; 38 import java.awt.Frame; 39 import java.awt.GraphicsDevice; 40 import java.awt.HeadlessException; 41 import java.awt.Label; 42 import java.awt.Menu; 43 import java.awt.MenuBar; 44 import java.awt.MenuItem; 45 import java.awt.Panel; 46 import java.awt.PopupMenu; 47 import java.awt.ScrollPane; 48 import java.awt.Scrollbar; 49 import java.awt.Taskbar; 50 import java.awt.TextArea; 51 import java.awt.TextField; 52 import java.awt.Window; 53 import java.awt.dnd.DragGestureEvent; 54 import java.awt.dnd.InvalidDnDOperationException; 55 import java.awt.dnd.peer.DragSourceContextPeer; 56 import java.awt.peer.ButtonPeer; 57 import java.awt.peer.CanvasPeer; 58 import java.awt.peer.CheckboxMenuItemPeer; 59 import java.awt.peer.CheckboxPeer; 60 import java.awt.peer.ChoicePeer; 61 import java.awt.peer.DesktopPeer; 62 import java.awt.peer.DialogPeer; 63 import java.awt.peer.FileDialogPeer; 64 import java.awt.peer.FontPeer; 65 import java.awt.peer.FramePeer; 66 import java.awt.peer.LabelPeer; 67 import java.awt.peer.LightweightPeer; 68 import java.awt.peer.ListPeer; 69 import java.awt.peer.MenuBarPeer; 70 import java.awt.peer.MenuItemPeer; 71 import java.awt.peer.MenuPeer; 72 import java.awt.peer.MouseInfoPeer; 73 import java.awt.peer.PanelPeer; 74 import java.awt.peer.PopupMenuPeer; 75 import java.awt.peer.RobotPeer; 76 import java.awt.peer.ScrollPanePeer; 77 import java.awt.peer.ScrollbarPeer; 78 import java.awt.peer.TaskbarPeer; 79 import java.awt.peer.TextAreaPeer; 80 import java.awt.peer.TextFieldPeer; 81 import java.awt.peer.WindowPeer; 82 83 import sun.awt.datatransfer.DataTransferer; 84 85 final class LightweightPeerHolder { 86 static final LightweightPeer lightweightMarker = new NullComponentPeer(); 87 88 private LightweightPeerHolder() { 89 } 90 } 91 92 /** 93 * Interface for component creation support in toolkits. 94 */ 95 public interface ComponentFactory { 96 97 /** 98 * Creates a peer for a component or container. This peer is windowless and 99 * allows the Component and Container classes to be extended directly to 100 * create windowless components that are defined entirely in java. 101 * 468 default DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) { 469 throw new InvalidDnDOperationException("Headless environment"); 470 } 471 472 /** 473 * Creates this toolkit's implementation of {@code Font} using the specified 474 * peer interface. 475 * 476 * @param name the font to be implemented 477 * @param style the style of the font, such as {@code PLAIN}, {@code BOLD}, 478 * {@code ITALIC}, or a combination 479 * @return this toolkit's implementation of {@code Font} 480 * @see java.awt.Font 481 * @see java.awt.peer.FontPeer 482 * @see java.awt.GraphicsEnvironment#getAllFonts 483 */ 484 default FontPeer getFontPeer(String name, int style) { 485 return null; 486 } 487 488 /** 489 * Creates the peer for a Robot. 490 * 491 * @param screen the GraphicsDevice indicating the coordinate system the 492 * Robot will operate in 493 * @return the peer created 494 * @throws AWTException if the platform configuration does not allow 495 * low-level input control 496 */ 497 default RobotPeer createRobot(GraphicsDevice screen) throws AWTException { 498 throw new AWTException(String.format("Unsupported device: %s", screen)); 499 } 500 501 default DataTransferer getDataTransferer() { 502 return null; 503 } 504 505 /** 506 * Obtains this toolkit's implementation of helper class for {@code 507 * MouseInfo} operations. 508 * 509 * @return this toolkit's implementation of helper for {@code MouseInfo} 510 * @throws UnsupportedOperationException if this operation is not 511 * implemented 512 * @see java.awt.peer.MouseInfoPeer 513 * @see java.awt.MouseInfo 514 * @since 1.5 515 */ 516 default MouseInfoPeer getMouseInfoPeer() { 517 throw new UnsupportedOperationException("Not implemented"); 518 } |