Home | History | Annotate | Download | only in awt
      1 /*
      2  *  Licensed to the Apache Software Foundation (ASF) under one or more
      3  *  contributor license agreements.  See the NOTICE file distributed with
      4  *  this work for additional information regarding copyright ownership.
      5  *  The ASF licenses this file to You under the Apache License, Version 2.0
      6  *  (the "License"); you may not use this file except in compliance with
      7  *  the License.  You may obtain a copy of the License at
      8  *
      9  *     http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  *  Unless required by applicable law or agreed to in writing, software
     12  *  distributed under the License is distributed on an "AS IS" BASIS,
     13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  *  See the License for the specific language governing permissions and
     15  *  limitations under the License.
     16  */
     17 
     18 package java.awt;
     19 
     20 //???AWT
     21 //import java.awt.datatransfer.Clipboard;
     22 //import java.awt.dnd.DragGestureEvent;
     23 //import java.awt.dnd.DragGestureListener;
     24 //import java.awt.dnd.DragGestureRecognizer;
     25 //import java.awt.dnd.DragSource;
     26 //import java.awt.dnd.InvalidDnDOperationException;
     27 //import java.awt.dnd.peer.DragSourceContextPeer;
     28 import java.awt.im.InputMethodHighlight;
     29 import java.awt.image.ColorModel; //import java.awt.peer.*;
     30 //import java.beans.PropertyChangeSupport;
     31 import java.util.HashMap;
     32 import java.util.Map;
     33 import java.util.Properties;
     34 
     35 import org.apache.harmony.awt.ComponentInternals; //import org.apache.harmony.awt.datatransfer.DTK;
     36 import org.apache.harmony.awt.wtk.GraphicsFactory;
     37 import org.apache.harmony.awt.wtk.NativeEventQueue;
     38 import org.apache.harmony.awt.wtk.WindowFactory;
     39 
     40 /**
     41  * The HeadlessToolkit class is a subclass of ToolkitImpl to be used for
     42  * graphical environments that lack keyboard and mouse capabilities.
     43  *
     44  * @since Android 1.0
     45  */
     46 public final class HeadlessToolkit extends ToolkitImpl {
     47 
     48     // ???AWT
     49     /*
     50      * @Override protected ButtonPeer createButton(Button a0) throws
     51      * HeadlessException { throw new HeadlessException(); }
     52      * @Override protected CheckboxPeer createCheckbox(Checkbox a0) throws
     53      * HeadlessException { throw new HeadlessException(); }
     54      * @Override protected CheckboxMenuItemPeer
     55      * createCheckboxMenuItem(CheckboxMenuItem a0) throws HeadlessException {
     56      * throw new HeadlessException(); }
     57      * @Override protected ChoicePeer createChoice(Choice a0) throws
     58      * HeadlessException { throw new HeadlessException(); } public Cursor
     59      * createCustomCursor(Image img, Point hotSpot, String name) throws
     60      * HeadlessException { throw new HeadlessException(); }
     61      * @Override protected DialogPeer createDialog(Dialog a0) throws
     62      * HeadlessException { throw new HeadlessException(); }
     63      * @Override public <T extends DragGestureRecognizer> T
     64      * createDragGestureRecognizer( Class<T> recognizerAbstractClass, DragSource
     65      * ds, Component c, int srcActions, DragGestureListener dgl) { return null;
     66      * }
     67      * @Override public DragSourceContextPeer
     68      * createDragSourceContextPeer(DragGestureEvent dge) throws
     69      * InvalidDnDOperationException { throw new InvalidDnDOperationException();
     70      * }
     71      * @Override protected FileDialogPeer createFileDialog(FileDialog a0) throws
     72      * HeadlessException { throw new HeadlessException(); }
     73      * @Override protected FramePeer createFrame(Frame a0) throws
     74      * HeadlessException { throw new HeadlessException(); }
     75      * @Override protected LabelPeer createLabel(Label a0) throws
     76      * HeadlessException { throw new HeadlessException(); }
     77      * @Override protected ListPeer createList(List a0) throws HeadlessException
     78      * { throw new HeadlessException(); }
     79      * @Override protected MenuPeer createMenu(Menu a0) throws HeadlessException
     80      * { throw new HeadlessException(); }
     81      * @Override protected MenuBarPeer createMenuBar(MenuBar a0) throws
     82      * HeadlessException { throw new HeadlessException(); }
     83      * @Override protected MenuItemPeer createMenuItem(MenuItem a0) throws
     84      * HeadlessException { throw new HeadlessException(); }
     85      * @Override protected PopupMenuPeer createPopupMenu(PopupMenu a0) throws
     86      * HeadlessException { throw new HeadlessException(); }
     87      * @Override protected ScrollbarPeer createScrollbar(Scrollbar a0) throws
     88      * HeadlessException { throw new HeadlessException(); }
     89      * @Override protected ScrollPanePeer createScrollPane(ScrollPane a0) throws
     90      * HeadlessException { throw new HeadlessException(); }
     91      * @Override protected TextAreaPeer createTextArea(TextArea a0) throws
     92      * HeadlessException { throw new HeadlessException(); }
     93      * @Override protected TextFieldPeer createTextField(TextField a0) throws
     94      * HeadlessException { throw new HeadlessException(); }
     95      * @Override protected WindowPeer createWindow(Window a0) throws
     96      * HeadlessException { throw new HeadlessException(); }
     97      */
     98 
     99     @Override
    100     public Dimension getBestCursorSize(int prefWidth, int prefHeight) throws HeadlessException {
    101         throw new HeadlessException();
    102     }
    103 
    104     @Override
    105     public ColorModel getColorModel() throws HeadlessException {
    106         throw new HeadlessException();
    107     }
    108 
    109     @Override
    110     public GraphicsFactory getGraphicsFactory() throws HeadlessException {
    111         throw new HeadlessException();
    112     }
    113 
    114     @Override
    115     public boolean getLockingKeyState(int keyCode) throws UnsupportedOperationException {
    116         throw new HeadlessException();
    117     }
    118 
    119     @Override
    120     public int getMaximumCursorColors() throws HeadlessException {
    121         throw new HeadlessException();
    122     }
    123 
    124     @Override
    125     public int getMenuShortcutKeyMask() throws HeadlessException {
    126         throw new HeadlessException();
    127     }
    128 
    129     // ???AWT
    130     /*
    131      * @Override NativeEventQueue getNativeEventQueue() throws HeadlessException
    132      * { throw new HeadlessException(); }
    133      * @Override public PrintJob getPrintJob(Frame frame, String jobtitle,
    134      * JobAttributes jobAttributes, PageAttributes pageAttributes) throws
    135      * IllegalArgumentException { throw new IllegalArgumentException(); }
    136      * @Override public PrintJob getPrintJob(Frame frame, String jobtitle,
    137      * Properties props) throws NullPointerException { throw new
    138      * NullPointerException(); }
    139      */
    140 
    141     @Override
    142     public Insets getScreenInsets(GraphicsConfiguration gc) throws HeadlessException {
    143         throw new HeadlessException();
    144     }
    145 
    146     @Override
    147     public int getScreenResolution() throws HeadlessException {
    148         throw new HeadlessException();
    149     }
    150 
    151     @Override
    152     public Dimension getScreenSize() throws HeadlessException {
    153         throw new HeadlessException();
    154     }
    155 
    156     // ???AWT
    157     /*
    158      * @Override public Clipboard getSystemClipboard() throws HeadlessException
    159      * { throw new HeadlessException(); }
    160      * @Override public Clipboard getSystemSelection() throws HeadlessException
    161      * { throw new HeadlessException(); }
    162      * @Override WindowFactory getWindowFactory() throws HeadlessException {
    163      * throw new HeadlessException(); }
    164      */
    165 
    166     @Override
    167     protected void init() {
    168         lockAWT();
    169         try {
    170             ComponentInternals.setComponentInternals(new ComponentInternalsImpl());
    171             // ???AWT: new EventQueue(this); // create the system EventQueue
    172             // ???AWT: dispatcher = new Dispatcher(this);
    173             desktopProperties = new HashMap<String, Object>();
    174             // ???AWT: desktopPropsSupport = new PropertyChangeSupport(this);
    175             // ???AWT: awtEventsManager = new AWTEventsManager();
    176             // ???AWT: dispatchThread = new HeadlessEventDispatchThread(this,
    177             // dispatcher);
    178             // ???AWT: dtk = DTK.getDTK();
    179             dispatchThread.start();
    180         } finally {
    181             unlockAWT();
    182         }
    183     }
    184 
    185     @Override
    186     public boolean isDynamicLayoutActive() throws HeadlessException {
    187         throw new HeadlessException();
    188     }
    189 
    190     @Override
    191     protected boolean isDynamicLayoutSet() throws HeadlessException {
    192         throw new HeadlessException();
    193     }
    194 
    195     @Override
    196     public boolean isFrameStateSupported(int state) throws HeadlessException {
    197         throw new HeadlessException();
    198     }
    199 
    200     @Override
    201     protected void loadSystemColors(int[] systemColors) throws HeadlessException {
    202         throw new HeadlessException();
    203     }
    204 
    205     @Override
    206     public Map<java.awt.font.TextAttribute, ?> mapInputMethodHighlight(
    207             InputMethodHighlight highlight) throws HeadlessException {
    208         throw new HeadlessException();
    209     }
    210 
    211     @Override
    212     Map<java.awt.font.TextAttribute, ?> mapInputMethodHighlightImpl(InputMethodHighlight highlight)
    213             throws HeadlessException {
    214         throw new HeadlessException();
    215     }
    216 
    217     @Override
    218     public void setDynamicLayout(boolean dynamic) throws HeadlessException {
    219         throw new HeadlessException();
    220     }
    221 
    222     @Override
    223     public void setLockingKeyState(int keyCode, boolean on) throws UnsupportedOperationException {
    224         throw new HeadlessException();
    225     }
    226 }
    227