1 /* HeadlessToolkit.java -- A toolkit for headless mode
2 Copyright (C) 2006 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package gnu
.java
.awt
.peer
.headless
;
41 import gnu
.java
.awt
.ClasspathToolkit
;
42 import gnu
.java
.awt
.EmbeddedWindow
;
43 import gnu
.java
.awt
.peer
.ClasspathFontPeer
;
44 import gnu
.java
.awt
.peer
.EmbeddedWindowPeer
;
46 import java
.awt
.AWTException
;
47 import java
.awt
.Button
;
48 import java
.awt
.Canvas
;
49 import java
.awt
.Checkbox
;
50 import java
.awt
.CheckboxMenuItem
;
51 import java
.awt
.Choice
;
52 import java
.awt
.Dialog
;
53 import java
.awt
.Dimension
;
54 import java
.awt
.EventQueue
;
55 import java
.awt
.FileDialog
;
57 import java
.awt
.FontMetrics
;
58 import java
.awt
.Frame
;
59 import java
.awt
.GraphicsDevice
;
60 import java
.awt
.GraphicsEnvironment
;
61 import java
.awt
.HeadlessException
;
62 import java
.awt
.Image
;
63 import java
.awt
.Label
;
66 import java
.awt
.MenuBar
;
67 import java
.awt
.MenuItem
;
68 import java
.awt
.Panel
;
69 import java
.awt
.PopupMenu
;
70 import java
.awt
.PrintJob
;
71 import java
.awt
.ScrollPane
;
72 import java
.awt
.Scrollbar
;
73 import java
.awt
.TextArea
;
74 import java
.awt
.TextField
;
75 import java
.awt
.Window
;
76 import java
.awt
.datatransfer
.Clipboard
;
77 import java
.awt
.dnd
.DragGestureEvent
;
78 import java
.awt
.dnd
.peer
.DragSourceContextPeer
;
79 import java
.awt
.im
.InputMethodHighlight
;
80 import java
.awt
.image
.ColorModel
;
81 import java
.awt
.image
.ImageObserver
;
82 import java
.awt
.image
.ImageProducer
;
83 import java
.awt
.peer
.ButtonPeer
;
84 import java
.awt
.peer
.CanvasPeer
;
85 import java
.awt
.peer
.CheckboxMenuItemPeer
;
86 import java
.awt
.peer
.CheckboxPeer
;
87 import java
.awt
.peer
.ChoicePeer
;
88 import java
.awt
.peer
.DialogPeer
;
89 import java
.awt
.peer
.FileDialogPeer
;
90 import java
.awt
.peer
.FontPeer
;
91 import java
.awt
.peer
.FramePeer
;
92 import java
.awt
.peer
.LabelPeer
;
93 import java
.awt
.peer
.ListPeer
;
94 import java
.awt
.peer
.MenuBarPeer
;
95 import java
.awt
.peer
.MenuItemPeer
;
96 import java
.awt
.peer
.MenuPeer
;
97 import java
.awt
.peer
.PanelPeer
;
98 import java
.awt
.peer
.PopupMenuPeer
;
99 import java
.awt
.peer
.RobotPeer
;
100 import java
.awt
.peer
.ScrollPanePeer
;
101 import java
.awt
.peer
.ScrollbarPeer
;
102 import java
.awt
.peer
.TextAreaPeer
;
103 import java
.awt
.peer
.TextFieldPeer
;
104 import java
.awt
.peer
.WindowPeer
;
105 import java
.io
.InputStream
;
107 import java
.util
.Map
;
108 import java
.util
.Properties
;
110 public class HeadlessToolkit
111 extends ClasspathToolkit
115 * The graphics environment for headless graphics.
117 private HeadlessGraphicsEnvironment graphicsEnv
;
121 // TODO Auto-generated method stub
125 public int checkImage(Image image
, int width
, int height
,
126 ImageObserver observer
)
128 // TODO Auto-generated method stub
132 protected ButtonPeer
createButton(Button target
)
134 throw new HeadlessException();
137 protected CanvasPeer
createCanvas(Canvas target
)
139 throw new HeadlessException();
142 protected CheckboxPeer
createCheckbox(Checkbox target
)
144 throw new HeadlessException();
147 protected CheckboxMenuItemPeer
createCheckboxMenuItem(CheckboxMenuItem target
)
149 throw new HeadlessException();
152 protected ChoicePeer
createChoice(Choice target
)
154 throw new HeadlessException();
157 protected DialogPeer
createDialog(Dialog target
)
159 throw new HeadlessException();
162 public DragSourceContextPeer
createDragSourceContextPeer(DragGestureEvent e
)
164 throw new HeadlessException();
167 protected FileDialogPeer
createFileDialog(FileDialog target
)
169 throw new HeadlessException();
172 protected FramePeer
createFrame(Frame target
)
174 throw new HeadlessException();
177 public Image
createImage(String filename
)
183 public Image
createImage(URL url
)
189 public Image
createImage(ImageProducer producer
)
195 public Image
createImage(byte[] data
, int offset
, int len
)
197 // TODO Auto-generated method stub
201 protected LabelPeer
createLabel(Label target
)
203 throw new HeadlessException();
206 protected ListPeer
createList(List target
)
208 throw new HeadlessException();
211 protected MenuPeer
createMenu(Menu target
)
213 throw new HeadlessException();
216 protected MenuBarPeer
createMenuBar(MenuBar target
)
218 throw new HeadlessException();
221 protected MenuItemPeer
createMenuItem(MenuItem target
)
223 throw new HeadlessException();
226 protected PanelPeer
createPanel(Panel target
)
228 throw new HeadlessException();
231 protected PopupMenuPeer
createPopupMenu(PopupMenu target
)
233 throw new HeadlessException();
236 protected ScrollPanePeer
createScrollPane(ScrollPane target
)
238 throw new HeadlessException();
241 protected ScrollbarPeer
createScrollbar(Scrollbar target
)
243 throw new HeadlessException();
246 protected TextAreaPeer
createTextArea(TextArea target
)
248 throw new HeadlessException();
251 protected TextFieldPeer
createTextField(TextField target
)
253 throw new HeadlessException();
256 protected WindowPeer
createWindow(Window target
)
258 throw new HeadlessException();
261 public ColorModel
getColorModel()
263 // TODO Auto-generated method stub
267 public String
[] getFontList()
269 // TODO Auto-generated method stub
273 public FontMetrics
getFontMetrics(Font name
)
275 // TODO Auto-generated method stub
279 protected FontPeer
getFontPeer(String name
, int style
)
281 // TODO Auto-generated method stub
285 public Image
getImage(String name
)
287 // TODO Auto-generated method stub
291 public Image
getImage(URL url
)
293 // TODO Auto-generated method stub
297 public PrintJob
getPrintJob(Frame frame
, String title
, Properties props
)
299 // TODO Auto-generated method stub
303 public int getScreenResolution()
305 throw new HeadlessException();
308 public Dimension
getScreenSize()
310 throw new HeadlessException();
313 public Clipboard
getSystemClipboard()
315 throw new HeadlessException();
318 protected EventQueue
getSystemEventQueueImpl()
320 throw new HeadlessException();
323 public Map
mapInputMethodHighlight(InputMethodHighlight highlight
)
325 // TODO Auto-generated method stub
329 public boolean prepareImage(Image image
, int width
, int height
,
330 ImageObserver observer
)
332 // TODO Auto-generated method stub
338 // TODO Auto-generated method stub
342 public EmbeddedWindowPeer
createEmbeddedWindow(EmbeddedWindow w
)
344 throw new HeadlessException();
347 public Font
createFont(int format
, InputStream stream
)
349 // TODO Auto-generated method stub
353 public RobotPeer
createRobot(GraphicsDevice screen
) throws AWTException
355 throw new HeadlessException();
358 public ClasspathFontPeer
getClasspathFontPeer(String name
, Map attrs
)
360 // TODO Auto-generated method stub
364 public GraphicsEnvironment
getLocalGraphicsEnvironment()
366 if (graphicsEnv
== null)
367 graphicsEnv
= new HeadlessGraphicsEnvironment();
372 public boolean isModalExclusionTypeSupported
373 (Dialog
.ModalExclusionType modalExclusionType
)
379 public boolean isModalityTypeSupported(Dialog
.ModalityType modalityType
)