jtulach@80
|
1 |
/*
|
jtulach@80
|
2 |
* To change this template, choose Tools | Templates
|
jtulach@80
|
3 |
* and open the template in the editor.
|
jtulach@80
|
4 |
*/
|
jtulach@80
|
5 |
|
jtulach@80
|
6 |
package org.apidesign.component.property;
|
jtulach@80
|
7 |
|
jtulach@80
|
8 |
import java.awt.Button;
|
jtulach@80
|
9 |
import java.awt.Canvas;
|
jtulach@80
|
10 |
import java.awt.Checkbox;
|
jtulach@80
|
11 |
import java.awt.CheckboxMenuItem;
|
jtulach@80
|
12 |
import java.awt.Choice;
|
jtulach@80
|
13 |
import java.awt.Desktop;
|
jtulach@80
|
14 |
import java.awt.Dialog;
|
jtulach@80
|
15 |
import java.awt.Dialog.ModalExclusionType;
|
jtulach@80
|
16 |
import java.awt.Dialog.ModalityType;
|
jtulach@80
|
17 |
import java.awt.Dimension;
|
jtulach@80
|
18 |
import java.awt.EventQueue;
|
jtulach@80
|
19 |
import java.awt.FileDialog;
|
jtulach@80
|
20 |
import java.awt.Font;
|
jtulach@80
|
21 |
import java.awt.FontMetrics;
|
jtulach@80
|
22 |
import java.awt.Frame;
|
jtulach@80
|
23 |
import java.awt.HeadlessException;
|
jtulach@80
|
24 |
import java.awt.Image;
|
jtulach@80
|
25 |
import java.awt.Label;
|
jtulach@80
|
26 |
import java.awt.List;
|
jtulach@80
|
27 |
import java.awt.Menu;
|
jtulach@80
|
28 |
import java.awt.MenuBar;
|
jtulach@80
|
29 |
import java.awt.MenuItem;
|
jtulach@80
|
30 |
import java.awt.Panel;
|
jtulach@80
|
31 |
import java.awt.PopupMenu;
|
jtulach@80
|
32 |
import java.awt.PrintJob;
|
jtulach@80
|
33 |
import java.awt.ScrollPane;
|
jtulach@80
|
34 |
import java.awt.Scrollbar;
|
jtulach@80
|
35 |
import java.awt.TextArea;
|
jtulach@80
|
36 |
import java.awt.TextField;
|
jtulach@80
|
37 |
import java.awt.Toolkit;
|
jtulach@80
|
38 |
import java.awt.Window;
|
jtulach@80
|
39 |
import java.awt.datatransfer.Clipboard;
|
jtulach@80
|
40 |
import java.awt.dnd.DragGestureEvent;
|
jtulach@80
|
41 |
import java.awt.dnd.InvalidDnDOperationException;
|
jtulach@80
|
42 |
import java.awt.dnd.peer.DragSourceContextPeer;
|
jtulach@80
|
43 |
import java.awt.font.TextAttribute;
|
jtulach@80
|
44 |
import java.awt.im.InputMethodHighlight;
|
jtulach@80
|
45 |
import java.awt.image.ColorModel;
|
jtulach@80
|
46 |
import java.awt.image.ImageObserver;
|
jtulach@80
|
47 |
import java.awt.image.ImageProducer;
|
jtulach@80
|
48 |
import java.awt.peer.ButtonPeer;
|
jtulach@80
|
49 |
import java.awt.peer.CanvasPeer;
|
jtulach@80
|
50 |
import java.awt.peer.CheckboxMenuItemPeer;
|
jtulach@80
|
51 |
import java.awt.peer.CheckboxPeer;
|
jtulach@80
|
52 |
import java.awt.peer.ChoicePeer;
|
jtulach@80
|
53 |
import java.awt.peer.DesktopPeer;
|
jtulach@80
|
54 |
import java.awt.peer.DialogPeer;
|
jtulach@80
|
55 |
import java.awt.peer.FileDialogPeer;
|
jtulach@80
|
56 |
import java.awt.peer.FontPeer;
|
jtulach@80
|
57 |
import java.awt.peer.FramePeer;
|
jtulach@80
|
58 |
import java.awt.peer.LabelPeer;
|
jtulach@80
|
59 |
import java.awt.peer.ListPeer;
|
jtulach@80
|
60 |
import java.awt.peer.MenuBarPeer;
|
jtulach@80
|
61 |
import java.awt.peer.MenuItemPeer;
|
jtulach@80
|
62 |
import java.awt.peer.MenuPeer;
|
jtulach@80
|
63 |
import java.awt.peer.PanelPeer;
|
jtulach@80
|
64 |
import java.awt.peer.PopupMenuPeer;
|
jtulach@80
|
65 |
import java.awt.peer.ScrollPanePeer;
|
jtulach@80
|
66 |
import java.awt.peer.ScrollbarPeer;
|
jtulach@80
|
67 |
import java.awt.peer.TextAreaPeer;
|
jtulach@80
|
68 |
import java.awt.peer.TextFieldPeer;
|
jtulach@80
|
69 |
import java.awt.peer.WindowPeer;
|
jtulach@80
|
70 |
import java.net.URL;
|
jtulach@80
|
71 |
import java.util.Map;
|
jtulach@80
|
72 |
import java.util.Properties;
|
jtulach@80
|
73 |
import java.util.logging.Level;
|
jtulach@80
|
74 |
import java.util.logging.Logger;
|
jtulach@80
|
75 |
|
jtulach@80
|
76 |
public class ToolkitFactory {
|
jtulach@80
|
77 |
private static Logger LOG = Logger.getLogger(ToolkitFactory.class.getName());
|
jtulach@80
|
78 |
|
jtulach@80
|
79 |
// BEGIN: lookup.init.toolkit
|
jtulach@80
|
80 |
public Toolkit getDefaultToolkit () {
|
jtulach@80
|
81 |
java.awt.Toolkit t = null;
|
jtulach@80
|
82 |
String classname = System.getProperty ("java.awt.Toolkit");
|
jtulach@80
|
83 |
if (classname != null) {
|
jtulach@80
|
84 |
try {
|
jtulach@80
|
85 |
Class c = Class.forName (classname);
|
jtulach@80
|
86 |
t = (java.awt.Toolkit)c.newInstance ();
|
jtulach@80
|
87 |
} catch (Exception ex) {
|
jtulach@153
|
88 |
LOG.log(Level.WARNING, "Cannot initialize toolkit: " + classname, ex);
|
jtulach@80
|
89 |
}
|
jtulach@80
|
90 |
}
|
jtulach@80
|
91 |
// fallback
|
jtulach@80
|
92 |
if (t == null) {
|
jtulach@80
|
93 |
t = new GenericAWTToolkit ();
|
jtulach@80
|
94 |
}
|
jtulach@80
|
95 |
return t;
|
jtulach@80
|
96 |
}
|
jtulach@80
|
97 |
// END: lookup.init.toolkit
|
jtulach@80
|
98 |
|
jtulach@80
|
99 |
private static final class GenericAWTToolkit extends Toolkit {
|
jtulach@80
|
100 |
@Override
|
jtulach@80
|
101 |
protected DesktopPeer createDesktopPeer(Desktop target) throws HeadlessException {
|
jtulach@80
|
102 |
throw new UnsupportedOperationException();
|
jtulach@80
|
103 |
}
|
jtulach@80
|
104 |
|
jtulach@80
|
105 |
@Override
|
jtulach@80
|
106 |
protected ButtonPeer createButton(Button target) throws HeadlessException {
|
jtulach@80
|
107 |
throw new UnsupportedOperationException();
|
jtulach@80
|
108 |
}
|
jtulach@80
|
109 |
|
jtulach@80
|
110 |
@Override
|
jtulach@80
|
111 |
protected TextFieldPeer createTextField(TextField target) throws HeadlessException {
|
jtulach@80
|
112 |
throw new UnsupportedOperationException();
|
jtulach@80
|
113 |
}
|
jtulach@80
|
114 |
|
jtulach@80
|
115 |
@Override
|
jtulach@80
|
116 |
protected LabelPeer createLabel(Label target) throws HeadlessException {
|
jtulach@80
|
117 |
throw new UnsupportedOperationException();
|
jtulach@80
|
118 |
}
|
jtulach@80
|
119 |
|
jtulach@80
|
120 |
@Override
|
jtulach@80
|
121 |
protected ListPeer createList(List target) throws HeadlessException {
|
jtulach@80
|
122 |
throw new UnsupportedOperationException();
|
jtulach@80
|
123 |
}
|
jtulach@80
|
124 |
|
jtulach@80
|
125 |
@Override
|
jtulach@80
|
126 |
protected CheckboxPeer createCheckbox(Checkbox target) throws HeadlessException {
|
jtulach@80
|
127 |
throw new UnsupportedOperationException();
|
jtulach@80
|
128 |
}
|
jtulach@80
|
129 |
|
jtulach@80
|
130 |
@Override
|
jtulach@80
|
131 |
protected ScrollbarPeer createScrollbar(Scrollbar target) throws HeadlessException {
|
jtulach@80
|
132 |
throw new UnsupportedOperationException();
|
jtulach@80
|
133 |
}
|
jtulach@80
|
134 |
|
jtulach@80
|
135 |
@Override
|
jtulach@80
|
136 |
protected ScrollPanePeer createScrollPane(ScrollPane target) throws HeadlessException {
|
jtulach@80
|
137 |
throw new UnsupportedOperationException();
|
jtulach@80
|
138 |
}
|
jtulach@80
|
139 |
|
jtulach@80
|
140 |
@Override
|
jtulach@80
|
141 |
protected TextAreaPeer createTextArea(TextArea target) throws HeadlessException {
|
jtulach@80
|
142 |
throw new UnsupportedOperationException();
|
jtulach@80
|
143 |
}
|
jtulach@80
|
144 |
|
jtulach@80
|
145 |
@Override
|
jtulach@80
|
146 |
protected ChoicePeer createChoice(Choice target) throws HeadlessException {
|
jtulach@80
|
147 |
throw new UnsupportedOperationException();
|
jtulach@80
|
148 |
}
|
jtulach@80
|
149 |
|
jtulach@80
|
150 |
@Override
|
jtulach@80
|
151 |
protected FramePeer createFrame(Frame target) throws HeadlessException {
|
jtulach@80
|
152 |
throw new UnsupportedOperationException();
|
jtulach@80
|
153 |
}
|
jtulach@80
|
154 |
|
jtulach@80
|
155 |
@Override
|
jtulach@80
|
156 |
protected CanvasPeer createCanvas(Canvas target) {
|
jtulach@80
|
157 |
throw new UnsupportedOperationException();
|
jtulach@80
|
158 |
}
|
jtulach@80
|
159 |
|
jtulach@80
|
160 |
@Override
|
jtulach@80
|
161 |
protected PanelPeer createPanel(Panel target) {
|
jtulach@80
|
162 |
throw new UnsupportedOperationException();
|
jtulach@80
|
163 |
}
|
jtulach@80
|
164 |
|
jtulach@80
|
165 |
@Override
|
jtulach@80
|
166 |
protected WindowPeer createWindow(Window target) throws HeadlessException {
|
jtulach@80
|
167 |
throw new UnsupportedOperationException();
|
jtulach@80
|
168 |
}
|
jtulach@80
|
169 |
|
jtulach@80
|
170 |
@Override
|
jtulach@80
|
171 |
protected DialogPeer createDialog(Dialog target) throws HeadlessException {
|
jtulach@80
|
172 |
throw new UnsupportedOperationException();
|
jtulach@80
|
173 |
}
|
jtulach@80
|
174 |
|
jtulach@80
|
175 |
@Override
|
jtulach@80
|
176 |
protected MenuBarPeer createMenuBar(MenuBar target) throws HeadlessException {
|
jtulach@80
|
177 |
throw new UnsupportedOperationException();
|
jtulach@80
|
178 |
}
|
jtulach@80
|
179 |
|
jtulach@80
|
180 |
@Override
|
jtulach@80
|
181 |
protected MenuPeer createMenu(Menu target) throws HeadlessException {
|
jtulach@80
|
182 |
throw new UnsupportedOperationException();
|
jtulach@80
|
183 |
}
|
jtulach@80
|
184 |
|
jtulach@80
|
185 |
@Override
|
jtulach@80
|
186 |
protected PopupMenuPeer createPopupMenu(PopupMenu target) throws HeadlessException {
|
jtulach@80
|
187 |
throw new UnsupportedOperationException();
|
jtulach@80
|
188 |
}
|
jtulach@80
|
189 |
|
jtulach@80
|
190 |
@Override
|
jtulach@80
|
191 |
protected MenuItemPeer createMenuItem(MenuItem target) throws HeadlessException {
|
jtulach@80
|
192 |
throw new UnsupportedOperationException();
|
jtulach@80
|
193 |
}
|
jtulach@80
|
194 |
|
jtulach@80
|
195 |
@Override
|
jtulach@80
|
196 |
protected FileDialogPeer createFileDialog(FileDialog target) throws HeadlessException {
|
jtulach@80
|
197 |
throw new UnsupportedOperationException();
|
jtulach@80
|
198 |
}
|
jtulach@80
|
199 |
|
jtulach@80
|
200 |
@Override
|
jtulach@80
|
201 |
protected CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target) throws HeadlessException {
|
jtulach@80
|
202 |
throw new UnsupportedOperationException();
|
jtulach@80
|
203 |
}
|
jtulach@80
|
204 |
|
jtulach@80
|
205 |
@Override
|
jtulach@80
|
206 |
protected FontPeer getFontPeer(String name, int style) {
|
jtulach@80
|
207 |
throw new UnsupportedOperationException();
|
jtulach@80
|
208 |
}
|
jtulach@80
|
209 |
|
jtulach@80
|
210 |
@Override
|
jtulach@80
|
211 |
public Dimension getScreenSize() throws HeadlessException {
|
jtulach@80
|
212 |
throw new UnsupportedOperationException();
|
jtulach@80
|
213 |
}
|
jtulach@80
|
214 |
|
jtulach@80
|
215 |
@Override
|
jtulach@80
|
216 |
public int getScreenResolution() throws HeadlessException {
|
jtulach@80
|
217 |
throw new UnsupportedOperationException();
|
jtulach@80
|
218 |
}
|
jtulach@80
|
219 |
|
jtulach@80
|
220 |
@Override
|
jtulach@80
|
221 |
public ColorModel getColorModel() throws HeadlessException {
|
jtulach@80
|
222 |
throw new UnsupportedOperationException();
|
jtulach@80
|
223 |
}
|
jtulach@80
|
224 |
|
jtulach@80
|
225 |
@Override
|
jtulach@80
|
226 |
public String[] getFontList() {
|
jtulach@80
|
227 |
throw new UnsupportedOperationException();
|
jtulach@80
|
228 |
}
|
jtulach@80
|
229 |
|
jtulach@80
|
230 |
@Override
|
jtulach@80
|
231 |
public FontMetrics getFontMetrics(Font font) {
|
jtulach@80
|
232 |
throw new UnsupportedOperationException();
|
jtulach@80
|
233 |
}
|
jtulach@80
|
234 |
|
jtulach@80
|
235 |
@Override
|
jtulach@80
|
236 |
public void sync() {
|
jtulach@80
|
237 |
throw new UnsupportedOperationException();
|
jtulach@80
|
238 |
}
|
jtulach@80
|
239 |
|
jtulach@80
|
240 |
@Override
|
jtulach@80
|
241 |
public Image getImage(String filename) {
|
jtulach@80
|
242 |
throw new UnsupportedOperationException();
|
jtulach@80
|
243 |
}
|
jtulach@80
|
244 |
|
jtulach@80
|
245 |
@Override
|
jtulach@80
|
246 |
public Image getImage(URL url) {
|
jtulach@80
|
247 |
throw new UnsupportedOperationException();
|
jtulach@80
|
248 |
}
|
jtulach@80
|
249 |
|
jtulach@80
|
250 |
@Override
|
jtulach@80
|
251 |
public Image createImage(String filename) {
|
jtulach@80
|
252 |
throw new UnsupportedOperationException();
|
jtulach@80
|
253 |
}
|
jtulach@80
|
254 |
|
jtulach@80
|
255 |
@Override
|
jtulach@80
|
256 |
public Image createImage(URL url) {
|
jtulach@80
|
257 |
throw new UnsupportedOperationException();
|
jtulach@80
|
258 |
}
|
jtulach@80
|
259 |
|
jtulach@80
|
260 |
@Override
|
jtulach@80
|
261 |
public boolean prepareImage(Image image, int width, int height, ImageObserver observer) {
|
jtulach@80
|
262 |
throw new UnsupportedOperationException();
|
jtulach@80
|
263 |
}
|
jtulach@80
|
264 |
|
jtulach@80
|
265 |
@Override
|
jtulach@80
|
266 |
public int checkImage(Image image, int width, int height, ImageObserver observer) {
|
jtulach@80
|
267 |
throw new UnsupportedOperationException();
|
jtulach@80
|
268 |
}
|
jtulach@80
|
269 |
|
jtulach@80
|
270 |
@Override
|
jtulach@80
|
271 |
public Image createImage(ImageProducer producer) {
|
jtulach@80
|
272 |
throw new UnsupportedOperationException();
|
jtulach@80
|
273 |
}
|
jtulach@80
|
274 |
|
jtulach@80
|
275 |
@Override
|
jtulach@80
|
276 |
public Image createImage(byte[] imagedata, int imageoffset, int imagelength) {
|
jtulach@80
|
277 |
throw new UnsupportedOperationException();
|
jtulach@80
|
278 |
}
|
jtulach@80
|
279 |
|
jtulach@80
|
280 |
@Override
|
jtulach@80
|
281 |
public PrintJob getPrintJob(Frame frame, String jobtitle, Properties props) {
|
jtulach@80
|
282 |
throw new UnsupportedOperationException();
|
jtulach@80
|
283 |
}
|
jtulach@80
|
284 |
|
jtulach@80
|
285 |
@Override
|
jtulach@80
|
286 |
public void beep() {
|
jtulach@80
|
287 |
throw new UnsupportedOperationException();
|
jtulach@80
|
288 |
}
|
jtulach@80
|
289 |
|
jtulach@80
|
290 |
@Override
|
jtulach@80
|
291 |
public Clipboard getSystemClipboard() throws HeadlessException {
|
jtulach@80
|
292 |
throw new UnsupportedOperationException();
|
jtulach@80
|
293 |
}
|
jtulach@80
|
294 |
|
jtulach@80
|
295 |
@Override
|
jtulach@80
|
296 |
protected EventQueue getSystemEventQueueImpl() {
|
jtulach@80
|
297 |
throw new UnsupportedOperationException();
|
jtulach@80
|
298 |
}
|
jtulach@80
|
299 |
|
jtulach@80
|
300 |
@Override
|
jtulach@80
|
301 |
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
|
jtulach@80
|
302 |
throw new UnsupportedOperationException();
|
jtulach@80
|
303 |
}
|
jtulach@80
|
304 |
|
jtulach@80
|
305 |
@Override
|
jtulach@80
|
306 |
public boolean isModalityTypeSupported(ModalityType modalityType) {
|
jtulach@80
|
307 |
throw new UnsupportedOperationException();
|
jtulach@80
|
308 |
}
|
jtulach@80
|
309 |
|
jtulach@80
|
310 |
@Override
|
jtulach@80
|
311 |
public boolean isModalExclusionTypeSupported(ModalExclusionType modalExclusionType) {
|
jtulach@80
|
312 |
throw new UnsupportedOperationException();
|
jtulach@80
|
313 |
}
|
jtulach@80
|
314 |
|
jtulach@80
|
315 |
@Override
|
jtulach@80
|
316 |
public Map<TextAttribute, ?> mapInputMethodHighlight(InputMethodHighlight highlight) throws HeadlessException {
|
jtulach@80
|
317 |
throw new UnsupportedOperationException();
|
jtulach@80
|
318 |
}
|
jtulach@80
|
319 |
}
|
jtulach@80
|
320 |
}
|