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@154
|
88 |
LOG.log(
|
jtulach@154
|
89 |
Level.WARNING,
|
jtulach@154
|
90 |
"Cannot initialize toolkit: " + classname, ex
|
jtulach@154
|
91 |
);
|
jtulach@80
|
92 |
}
|
jtulach@80
|
93 |
}
|
jtulach@80
|
94 |
// fallback
|
jtulach@80
|
95 |
if (t == null) {
|
jtulach@80
|
96 |
t = new GenericAWTToolkit ();
|
jtulach@80
|
97 |
}
|
jtulach@80
|
98 |
return t;
|
jtulach@80
|
99 |
}
|
jtulach@80
|
100 |
// END: lookup.init.toolkit
|
jtulach@80
|
101 |
|
jtulach@80
|
102 |
private static final class GenericAWTToolkit extends Toolkit {
|
jtulach@80
|
103 |
@Override
|
jtulach@80
|
104 |
protected DesktopPeer createDesktopPeer(Desktop target) throws HeadlessException {
|
jtulach@80
|
105 |
throw new UnsupportedOperationException();
|
jtulach@80
|
106 |
}
|
jtulach@80
|
107 |
|
jtulach@80
|
108 |
@Override
|
jtulach@80
|
109 |
protected ButtonPeer createButton(Button target) throws HeadlessException {
|
jtulach@80
|
110 |
throw new UnsupportedOperationException();
|
jtulach@80
|
111 |
}
|
jtulach@80
|
112 |
|
jtulach@80
|
113 |
@Override
|
jtulach@80
|
114 |
protected TextFieldPeer createTextField(TextField target) throws HeadlessException {
|
jtulach@80
|
115 |
throw new UnsupportedOperationException();
|
jtulach@80
|
116 |
}
|
jtulach@80
|
117 |
|
jtulach@80
|
118 |
@Override
|
jtulach@80
|
119 |
protected LabelPeer createLabel(Label target) throws HeadlessException {
|
jtulach@80
|
120 |
throw new UnsupportedOperationException();
|
jtulach@80
|
121 |
}
|
jtulach@80
|
122 |
|
jtulach@80
|
123 |
@Override
|
jtulach@80
|
124 |
protected ListPeer createList(List target) throws HeadlessException {
|
jtulach@80
|
125 |
throw new UnsupportedOperationException();
|
jtulach@80
|
126 |
}
|
jtulach@80
|
127 |
|
jtulach@80
|
128 |
@Override
|
jtulach@80
|
129 |
protected CheckboxPeer createCheckbox(Checkbox target) throws HeadlessException {
|
jtulach@80
|
130 |
throw new UnsupportedOperationException();
|
jtulach@80
|
131 |
}
|
jtulach@80
|
132 |
|
jtulach@80
|
133 |
@Override
|
jtulach@80
|
134 |
protected ScrollbarPeer createScrollbar(Scrollbar target) throws HeadlessException {
|
jtulach@80
|
135 |
throw new UnsupportedOperationException();
|
jtulach@80
|
136 |
}
|
jtulach@80
|
137 |
|
jtulach@80
|
138 |
@Override
|
jtulach@80
|
139 |
protected ScrollPanePeer createScrollPane(ScrollPane target) throws HeadlessException {
|
jtulach@80
|
140 |
throw new UnsupportedOperationException();
|
jtulach@80
|
141 |
}
|
jtulach@80
|
142 |
|
jtulach@80
|
143 |
@Override
|
jtulach@80
|
144 |
protected TextAreaPeer createTextArea(TextArea target) throws HeadlessException {
|
jtulach@80
|
145 |
throw new UnsupportedOperationException();
|
jtulach@80
|
146 |
}
|
jtulach@80
|
147 |
|
jtulach@80
|
148 |
@Override
|
jtulach@80
|
149 |
protected ChoicePeer createChoice(Choice target) throws HeadlessException {
|
jtulach@80
|
150 |
throw new UnsupportedOperationException();
|
jtulach@80
|
151 |
}
|
jtulach@80
|
152 |
|
jtulach@80
|
153 |
@Override
|
jtulach@80
|
154 |
protected FramePeer createFrame(Frame target) throws HeadlessException {
|
jtulach@80
|
155 |
throw new UnsupportedOperationException();
|
jtulach@80
|
156 |
}
|
jtulach@80
|
157 |
|
jtulach@80
|
158 |
@Override
|
jtulach@80
|
159 |
protected CanvasPeer createCanvas(Canvas target) {
|
jtulach@80
|
160 |
throw new UnsupportedOperationException();
|
jtulach@80
|
161 |
}
|
jtulach@80
|
162 |
|
jtulach@80
|
163 |
@Override
|
jtulach@80
|
164 |
protected PanelPeer createPanel(Panel target) {
|
jtulach@80
|
165 |
throw new UnsupportedOperationException();
|
jtulach@80
|
166 |
}
|
jtulach@80
|
167 |
|
jtulach@80
|
168 |
@Override
|
jtulach@80
|
169 |
protected WindowPeer createWindow(Window target) throws HeadlessException {
|
jtulach@80
|
170 |
throw new UnsupportedOperationException();
|
jtulach@80
|
171 |
}
|
jtulach@80
|
172 |
|
jtulach@80
|
173 |
@Override
|
jtulach@80
|
174 |
protected DialogPeer createDialog(Dialog target) throws HeadlessException {
|
jtulach@80
|
175 |
throw new UnsupportedOperationException();
|
jtulach@80
|
176 |
}
|
jtulach@80
|
177 |
|
jtulach@80
|
178 |
@Override
|
jtulach@80
|
179 |
protected MenuBarPeer createMenuBar(MenuBar target) throws HeadlessException {
|
jtulach@80
|
180 |
throw new UnsupportedOperationException();
|
jtulach@80
|
181 |
}
|
jtulach@80
|
182 |
|
jtulach@80
|
183 |
@Override
|
jtulach@80
|
184 |
protected MenuPeer createMenu(Menu target) throws HeadlessException {
|
jtulach@80
|
185 |
throw new UnsupportedOperationException();
|
jtulach@80
|
186 |
}
|
jtulach@80
|
187 |
|
jtulach@80
|
188 |
@Override
|
jtulach@80
|
189 |
protected PopupMenuPeer createPopupMenu(PopupMenu target) throws HeadlessException {
|
jtulach@80
|
190 |
throw new UnsupportedOperationException();
|
jtulach@80
|
191 |
}
|
jtulach@80
|
192 |
|
jtulach@80
|
193 |
@Override
|
jtulach@80
|
194 |
protected MenuItemPeer createMenuItem(MenuItem target) throws HeadlessException {
|
jtulach@80
|
195 |
throw new UnsupportedOperationException();
|
jtulach@80
|
196 |
}
|
jtulach@80
|
197 |
|
jtulach@80
|
198 |
@Override
|
jtulach@80
|
199 |
protected FileDialogPeer createFileDialog(FileDialog target) throws HeadlessException {
|
jtulach@80
|
200 |
throw new UnsupportedOperationException();
|
jtulach@80
|
201 |
}
|
jtulach@80
|
202 |
|
jtulach@80
|
203 |
@Override
|
jtulach@80
|
204 |
protected CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target) throws HeadlessException {
|
jtulach@80
|
205 |
throw new UnsupportedOperationException();
|
jtulach@80
|
206 |
}
|
jtulach@80
|
207 |
|
jtulach@80
|
208 |
@Override
|
jtulach@80
|
209 |
protected FontPeer getFontPeer(String name, int style) {
|
jtulach@80
|
210 |
throw new UnsupportedOperationException();
|
jtulach@80
|
211 |
}
|
jtulach@80
|
212 |
|
jtulach@80
|
213 |
@Override
|
jtulach@80
|
214 |
public Dimension getScreenSize() throws HeadlessException {
|
jtulach@80
|
215 |
throw new UnsupportedOperationException();
|
jtulach@80
|
216 |
}
|
jtulach@80
|
217 |
|
jtulach@80
|
218 |
@Override
|
jtulach@80
|
219 |
public int getScreenResolution() throws HeadlessException {
|
jtulach@80
|
220 |
throw new UnsupportedOperationException();
|
jtulach@80
|
221 |
}
|
jtulach@80
|
222 |
|
jtulach@80
|
223 |
@Override
|
jtulach@80
|
224 |
public ColorModel getColorModel() throws HeadlessException {
|
jtulach@80
|
225 |
throw new UnsupportedOperationException();
|
jtulach@80
|
226 |
}
|
jtulach@80
|
227 |
|
jtulach@80
|
228 |
@Override
|
jtulach@80
|
229 |
public String[] getFontList() {
|
jtulach@80
|
230 |
throw new UnsupportedOperationException();
|
jtulach@80
|
231 |
}
|
jtulach@80
|
232 |
|
jtulach@80
|
233 |
@Override
|
jtulach@80
|
234 |
public FontMetrics getFontMetrics(Font font) {
|
jtulach@80
|
235 |
throw new UnsupportedOperationException();
|
jtulach@80
|
236 |
}
|
jtulach@80
|
237 |
|
jtulach@80
|
238 |
@Override
|
jtulach@80
|
239 |
public void sync() {
|
jtulach@80
|
240 |
throw new UnsupportedOperationException();
|
jtulach@80
|
241 |
}
|
jtulach@80
|
242 |
|
jtulach@80
|
243 |
@Override
|
jtulach@80
|
244 |
public Image getImage(String filename) {
|
jtulach@80
|
245 |
throw new UnsupportedOperationException();
|
jtulach@80
|
246 |
}
|
jtulach@80
|
247 |
|
jtulach@80
|
248 |
@Override
|
jtulach@80
|
249 |
public Image getImage(URL url) {
|
jtulach@80
|
250 |
throw new UnsupportedOperationException();
|
jtulach@80
|
251 |
}
|
jtulach@80
|
252 |
|
jtulach@80
|
253 |
@Override
|
jtulach@80
|
254 |
public Image createImage(String filename) {
|
jtulach@80
|
255 |
throw new UnsupportedOperationException();
|
jtulach@80
|
256 |
}
|
jtulach@80
|
257 |
|
jtulach@80
|
258 |
@Override
|
jtulach@80
|
259 |
public Image createImage(URL url) {
|
jtulach@80
|
260 |
throw new UnsupportedOperationException();
|
jtulach@80
|
261 |
}
|
jtulach@80
|
262 |
|
jtulach@80
|
263 |
@Override
|
jtulach@80
|
264 |
public boolean prepareImage(Image image, int width, int height, ImageObserver observer) {
|
jtulach@80
|
265 |
throw new UnsupportedOperationException();
|
jtulach@80
|
266 |
}
|
jtulach@80
|
267 |
|
jtulach@80
|
268 |
@Override
|
jtulach@80
|
269 |
public int checkImage(Image image, int width, int height, ImageObserver observer) {
|
jtulach@80
|
270 |
throw new UnsupportedOperationException();
|
jtulach@80
|
271 |
}
|
jtulach@80
|
272 |
|
jtulach@80
|
273 |
@Override
|
jtulach@80
|
274 |
public Image createImage(ImageProducer producer) {
|
jtulach@80
|
275 |
throw new UnsupportedOperationException();
|
jtulach@80
|
276 |
}
|
jtulach@80
|
277 |
|
jtulach@80
|
278 |
@Override
|
jtulach@80
|
279 |
public Image createImage(byte[] imagedata, int imageoffset, int imagelength) {
|
jtulach@80
|
280 |
throw new UnsupportedOperationException();
|
jtulach@80
|
281 |
}
|
jtulach@80
|
282 |
|
jtulach@80
|
283 |
@Override
|
jtulach@80
|
284 |
public PrintJob getPrintJob(Frame frame, String jobtitle, Properties props) {
|
jtulach@80
|
285 |
throw new UnsupportedOperationException();
|
jtulach@80
|
286 |
}
|
jtulach@80
|
287 |
|
jtulach@80
|
288 |
@Override
|
jtulach@80
|
289 |
public void beep() {
|
jtulach@80
|
290 |
throw new UnsupportedOperationException();
|
jtulach@80
|
291 |
}
|
jtulach@80
|
292 |
|
jtulach@80
|
293 |
@Override
|
jtulach@80
|
294 |
public Clipboard getSystemClipboard() throws HeadlessException {
|
jtulach@80
|
295 |
throw new UnsupportedOperationException();
|
jtulach@80
|
296 |
}
|
jtulach@80
|
297 |
|
jtulach@80
|
298 |
@Override
|
jtulach@80
|
299 |
protected EventQueue getSystemEventQueueImpl() {
|
jtulach@80
|
300 |
throw new UnsupportedOperationException();
|
jtulach@80
|
301 |
}
|
jtulach@80
|
302 |
|
jtulach@80
|
303 |
@Override
|
jtulach@80
|
304 |
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
|
jtulach@80
|
305 |
throw new UnsupportedOperationException();
|
jtulach@80
|
306 |
}
|
jtulach@80
|
307 |
|
jtulach@80
|
308 |
@Override
|
jtulach@80
|
309 |
public boolean isModalityTypeSupported(ModalityType modalityType) {
|
jtulach@80
|
310 |
throw new UnsupportedOperationException();
|
jtulach@80
|
311 |
}
|
jtulach@80
|
312 |
|
jtulach@80
|
313 |
@Override
|
jtulach@80
|
314 |
public boolean isModalExclusionTypeSupported(ModalExclusionType modalExclusionType) {
|
jtulach@80
|
315 |
throw new UnsupportedOperationException();
|
jtulach@80
|
316 |
}
|
jtulach@80
|
317 |
|
jtulach@80
|
318 |
@Override
|
jtulach@80
|
319 |
public Map<TextAttribute, ?> mapInputMethodHighlight(InputMethodHighlight highlight) throws HeadlessException {
|
jtulach@80
|
320 |
throw new UnsupportedOperationException();
|
jtulach@80
|
321 |
}
|
jtulach@80
|
322 |
}
|
jtulach@80
|
323 |
}
|