001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package java.awt;
019:
020: import java.awt.datatransfer.Clipboard;
021: import java.awt.dnd.DragGestureEvent;
022: import java.awt.dnd.DragGestureListener;
023: import java.awt.dnd.DragGestureRecognizer;
024: import java.awt.dnd.DragSource;
025: import java.awt.dnd.InvalidDnDOperationException;
026: import java.awt.dnd.peer.DragSourceContextPeer;
027: import java.awt.im.InputMethodHighlight;
028: import java.awt.image.ColorModel;
029: import java.awt.peer.*;
030: import java.beans.PropertyChangeSupport;
031: import java.util.HashMap;
032: import java.util.Map;
033: import java.util.Properties;
034:
035: import org.apache.harmony.awt.ComponentInternals;
036: import org.apache.harmony.awt.datatransfer.DTK;
037: import org.apache.harmony.awt.wtk.GraphicsFactory;
038: import org.apache.harmony.awt.wtk.NativeEventQueue;
039: import org.apache.harmony.awt.wtk.WindowFactory;
040:
041: final class HeadlessToolkit extends ToolkitImpl {
042:
043: private class EventMonitor {
044: }
045:
046: private final Object eventMonitor = new EventMonitor();
047:
048: @Override
049: protected ButtonPeer createButton(Button a0)
050: throws HeadlessException {
051: throw new HeadlessException();
052: }
053:
054: @Override
055: protected CheckboxPeer createCheckbox(Checkbox a0)
056: throws HeadlessException {
057: throw new HeadlessException();
058: }
059:
060: @Override
061: protected CheckboxMenuItemPeer createCheckboxMenuItem(
062: CheckboxMenuItem a0) throws HeadlessException {
063: throw new HeadlessException();
064: }
065:
066: @Override
067: protected ChoicePeer createChoice(Choice a0)
068: throws HeadlessException {
069: throw new HeadlessException();
070: }
071:
072: public Cursor createCustomCursor(Image img, Point hotSpot,
073: String name) throws HeadlessException {
074: throw new HeadlessException();
075: }
076:
077: @Override
078: protected DialogPeer createDialog(Dialog a0)
079: throws HeadlessException {
080: throw new HeadlessException();
081: }
082:
083: @Override
084: public <T extends DragGestureRecognizer> T createDragGestureRecognizer(
085: Class<T> recognizerAbstractClass, DragSource ds,
086: Component c, int srcActions, DragGestureListener dgl) {
087: return null;
088: }
089:
090: @Override
091: public DragSourceContextPeer createDragSourceContextPeer(
092: DragGestureEvent dge) throws InvalidDnDOperationException {
093: throw new InvalidDnDOperationException();
094: }
095:
096: @Override
097: protected FileDialogPeer createFileDialog(FileDialog a0)
098: throws HeadlessException {
099: throw new HeadlessException();
100: }
101:
102: @Override
103: protected FramePeer createFrame(Frame a0) throws HeadlessException {
104: throw new HeadlessException();
105: }
106:
107: @Override
108: protected LabelPeer createLabel(Label a0) throws HeadlessException {
109: throw new HeadlessException();
110: }
111:
112: @Override
113: protected ListPeer createList(List a0) throws HeadlessException {
114: throw new HeadlessException();
115: }
116:
117: @Override
118: protected MenuPeer createMenu(Menu a0) throws HeadlessException {
119: throw new HeadlessException();
120: }
121:
122: @Override
123: protected MenuBarPeer createMenuBar(MenuBar a0)
124: throws HeadlessException {
125: throw new HeadlessException();
126: }
127:
128: @Override
129: protected MenuItemPeer createMenuItem(MenuItem a0)
130: throws HeadlessException {
131: throw new HeadlessException();
132: }
133:
134: @Override
135: protected PopupMenuPeer createPopupMenu(PopupMenu a0)
136: throws HeadlessException {
137: throw new HeadlessException();
138: }
139:
140: @Override
141: protected ScrollbarPeer createScrollbar(Scrollbar a0)
142: throws HeadlessException {
143: throw new HeadlessException();
144: }
145:
146: @Override
147: protected ScrollPanePeer createScrollPane(ScrollPane a0)
148: throws HeadlessException {
149: throw new HeadlessException();
150: }
151:
152: @Override
153: protected TextAreaPeer createTextArea(TextArea a0)
154: throws HeadlessException {
155: throw new HeadlessException();
156: }
157:
158: @Override
159: protected TextFieldPeer createTextField(TextField a0)
160: throws HeadlessException {
161: throw new HeadlessException();
162: }
163:
164: @Override
165: protected WindowPeer createWindow(Window a0)
166: throws HeadlessException {
167: throw new HeadlessException();
168: }
169:
170: @Override
171: public Dimension getBestCursorSize(int prefWidth, int prefHeight)
172: throws HeadlessException {
173: throw new HeadlessException();
174: }
175:
176: @Override
177: public ColorModel getColorModel() throws HeadlessException {
178: throw new HeadlessException();
179: }
180:
181: @Override
182: public final Object getEventMonitor() {
183: return eventMonitor;
184: }
185:
186: @Override
187: GraphicsFactory getGraphicsFactory() throws HeadlessException {
188: throw new HeadlessException();
189: }
190:
191: @Override
192: public boolean getLockingKeyState(int keyCode)
193: throws UnsupportedOperationException {
194: throw new HeadlessException();
195: }
196:
197: @Override
198: public int getMaximumCursorColors() throws HeadlessException {
199: throw new HeadlessException();
200: }
201:
202: @Override
203: public int getMenuShortcutKeyMask() throws HeadlessException {
204: throw new HeadlessException();
205: }
206:
207: @Override
208: NativeEventQueue getNativeEventQueue() throws HeadlessException {
209: throw new HeadlessException();
210: }
211:
212: @Override
213: public PrintJob getPrintJob(Frame frame, String jobtitle,
214: JobAttributes jobAttributes, PageAttributes pageAttributes)
215: throws IllegalArgumentException {
216: throw new IllegalArgumentException();
217: }
218:
219: @Override
220: public PrintJob getPrintJob(Frame frame, String jobtitle,
221: Properties props) throws NullPointerException {
222: throw new NullPointerException();
223: }
224:
225: @Override
226: public Insets getScreenInsets(GraphicsConfiguration gc)
227: throws HeadlessException {
228: throw new HeadlessException();
229: }
230:
231: @Override
232: public int getScreenResolution() throws HeadlessException {
233: throw new HeadlessException();
234: }
235:
236: @Override
237: public Dimension getScreenSize() throws HeadlessException {
238: throw new HeadlessException();
239: }
240:
241: @Override
242: public Clipboard getSystemClipboard() throws HeadlessException {
243: throw new HeadlessException();
244: }
245:
246: @Override
247: public Clipboard getSystemSelection() throws HeadlessException {
248: throw new HeadlessException();
249: }
250:
251: @Override
252: WindowFactory getWindowFactory() throws HeadlessException {
253: throw new HeadlessException();
254: }
255:
256: @Override
257: void init() {
258: lockAWT();
259: try {
260: ComponentInternals
261: .setComponentInternals(new ComponentInternalsImpl());
262: new EventQueue(this ); // create the system EventQueue
263: dispatcher = new Dispatcher(this );
264: awtEventsManager = new AWTEventsManager();
265: dispatchThread = new HeadlessEventDispatchThread(this ,
266: dispatcher);
267: dtk = DTK.getDTK();
268: dispatchThread.start();
269: } finally {
270: unlockAWT();
271: }
272: }
273:
274: @Override
275: public boolean isDynamicLayoutActive() throws HeadlessException {
276: throw new HeadlessException();
277: }
278:
279: @Override
280: protected boolean isDynamicLayoutSet() throws HeadlessException {
281: throw new HeadlessException();
282: }
283:
284: @Override
285: public boolean isFrameStateSupported(int state)
286: throws HeadlessException {
287: throw new HeadlessException();
288: }
289:
290: @Override
291: protected void loadSystemColors(int[] systemColors)
292: throws HeadlessException {
293: throw new HeadlessException();
294: }
295:
296: @Override
297: public Map<java.awt.font.TextAttribute, ?> mapInputMethodHighlight(
298: InputMethodHighlight highlight) throws HeadlessException {
299: throw new HeadlessException();
300: }
301:
302: @Override
303: Map<java.awt.font.TextAttribute, ?> mapInputMethodHighlightImpl(
304: InputMethodHighlight highlight) throws HeadlessException {
305: throw new HeadlessException();
306: }
307:
308: @Override
309: public void setDynamicLayout(boolean dynamic)
310: throws HeadlessException {
311: throw new HeadlessException();
312: }
313:
314: @Override
315: public void setLockingKeyState(int keyCode, boolean on)
316: throws UnsupportedOperationException {
317: throw new HeadlessException();
318: }
319: }
|