Home » openjdk-7 » java » awt » [javadoc | source]

    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   import java.awt.datatransfer.Clipboard;
   21   import java.awt.dnd.DragGestureEvent;
   22   import java.awt.dnd.DragGestureListener;
   23   import java.awt.dnd.DragGestureRecognizer;
   24   import java.awt.dnd.DragSource;
   25   import java.awt.dnd.InvalidDnDOperationException;
   26   import java.awt.dnd.peer.DragSourceContextPeer;
   27   import java.awt.im.InputMethodHighlight;
   28   import java.awt.image.ColorModel;
   29   import java.awt.peer.ButtonPeer;
   30   import java.awt.peer.CheckboxMenuItemPeer;
   31   import java.awt.peer.CheckboxPeer;
   32   import java.awt.peer.ChoicePeer;
   33   import java.awt.peer.DialogPeer;
   34   import java.awt.peer.FileDialogPeer;
   35   import java.awt.peer.FramePeer;
   36   import java.awt.peer.LabelPeer;
   37   import java.awt.peer.ListPeer;
   38   import java.awt.peer.MenuBarPeer;
   39   import java.awt.peer.MenuItemPeer;
   40   import java.awt.peer.MenuPeer;
   41   import java.awt.peer.PopupMenuPeer;
   42   import java.awt.peer.ScrollPanePeer;
   43   import java.awt.peer.ScrollbarPeer;
   44   import java.awt.peer.TextAreaPeer;
   45   import java.awt.peer.TextFieldPeer;
   46   import java.awt.peer.WindowPeer;
   47   import java.util.Map;
   48   import java.util.Properties;
   49   
   50   import org.apache.harmony.awt.ComponentInternals;
   51   import org.apache.harmony.awt.datatransfer.DTK;
   52   import org.apache.harmony.awt.wtk.GraphicsFactory;
   53   import org.apache.harmony.awt.wtk.NativeEventQueue;
   54   import org.apache.harmony.awt.wtk.WindowFactory;
   55   
   56   final class HeadlessToolkit extends ToolkitImpl {
   57   
   58       private class EventMonitor {}
   59       private final Object eventMonitor = new EventMonitor();
   60       
   61       @Override
   62       protected ButtonPeer createButton(Button a0) throws HeadlessException {
   63           throw new HeadlessException();
   64       }
   65       
   66       @Override
   67       protected CheckboxPeer createCheckbox(Checkbox a0) throws HeadlessException {
   68           throw new HeadlessException();
   69       }
   70   
   71       @Override
   72       protected CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem a0) throws HeadlessException {
   73           throw new HeadlessException();
   74       }
   75       
   76       @Override
   77       protected ChoicePeer createChoice(Choice a0) throws HeadlessException {
   78           throw new HeadlessException();
   79       }
   80   
   81       @Override
   82       public Cursor createCustomCursor(Image img, Point hotSpot, String name)
   83       throws HeadlessException {
   84           throw new HeadlessException();
   85       }
   86   
   87       @Override
   88       protected DialogPeer createDialog(Dialog a0) throws HeadlessException {
   89           throw new HeadlessException();
   90       }
   91   
   92       @Override
   93       public <T extends DragGestureRecognizer> T createDragGestureRecognizer(
   94               Class<T> recognizerAbstractClass, DragSource ds, Component c, int srcActions,
   95               DragGestureListener dgl) {
   96           return null;
   97       }
   98   
   99       @Override
  100       public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge)
  101       throws InvalidDnDOperationException {
  102           throw new InvalidDnDOperationException();
  103       }
  104   
  105       @Override
  106       protected FileDialogPeer createFileDialog(FileDialog a0) throws HeadlessException {
  107           throw new HeadlessException();
  108       }
  109   
  110       @Override
  111       protected FramePeer createFrame(Frame a0) throws HeadlessException {
  112           throw new HeadlessException();
  113       }
  114   
  115       @Override
  116       protected LabelPeer createLabel(Label a0) throws HeadlessException {
  117           throw new HeadlessException();
  118       }
  119   
  120       @Override
  121       protected ListPeer createList(List a0) throws HeadlessException {
  122           throw new HeadlessException();
  123       }
  124   
  125       @Override
  126       protected MenuPeer createMenu(Menu a0) throws HeadlessException {
  127           throw new HeadlessException();
  128       }
  129   
  130       @Override
  131       protected MenuBarPeer createMenuBar(MenuBar a0) throws HeadlessException {
  132           throw new HeadlessException();
  133       }
  134   
  135       @Override
  136       protected MenuItemPeer createMenuItem(MenuItem a0) throws HeadlessException {
  137           throw new HeadlessException();
  138       }
  139   
  140       @Override
  141       protected PopupMenuPeer createPopupMenu(PopupMenu a0) throws HeadlessException {
  142           throw new HeadlessException();
  143       }
  144   
  145       @Override
  146       protected ScrollbarPeer createScrollbar(Scrollbar a0) throws HeadlessException {
  147           throw new HeadlessException();
  148       }
  149   
  150       @Override
  151       protected ScrollPanePeer createScrollPane(ScrollPane a0) throws HeadlessException {
  152           throw new HeadlessException();
  153       }
  154   
  155       @Override
  156       protected TextAreaPeer createTextArea(TextArea a0) throws HeadlessException {
  157           throw new HeadlessException();
  158       }
  159   
  160       @Override
  161       protected TextFieldPeer createTextField(TextField a0) throws HeadlessException {
  162           throw new HeadlessException();
  163       }
  164   
  165       @Override
  166       protected WindowPeer createWindow(Window a0) throws HeadlessException {
  167           throw new HeadlessException();
  168       }
  169   
  170       @Override
  171       public Dimension getBestCursorSize(int prefWidth, int prefHeight) throws HeadlessException {
  172           throw new HeadlessException();
  173       }
  174   
  175       @Override
  176       public ColorModel getColorModel() throws HeadlessException {
  177           throw new HeadlessException();
  178       }
  179   
  180       @Override
  181       public final Object getEventMonitor() {
  182           return eventMonitor;
  183       }
  184   
  185       @Override
  186       GraphicsFactory getGraphicsFactory() throws HeadlessException {
  187           throw new HeadlessException();
  188       }
  189       
  190       @Override
  191       public boolean getLockingKeyState(int keyCode) throws UnsupportedOperationException {
  192           throw new HeadlessException();
  193       }
  194       
  195       @Override
  196       public int getMaximumCursorColors() throws HeadlessException {
  197           throw new HeadlessException();
  198       }
  199       
  200       @Override
  201       public int getMenuShortcutKeyMask() throws HeadlessException {
  202           throw new HeadlessException();
  203       }
  204       
  205       @Override
  206       NativeEventQueue getNativeEventQueue() throws HeadlessException {
  207           throw new HeadlessException();
  208       }
  209       
  210       @Override
  211       public PrintJob getPrintJob(Frame frame, String jobtitle, JobAttributes jobAttributes, 
  212               PageAttributes pageAttributes) throws IllegalArgumentException {
  213           throw new IllegalArgumentException();        
  214       }
  215       
  216       @Override
  217       public PrintJob getPrintJob(Frame frame, String jobtitle, Properties props) throws NullPointerException  {
  218           throw new NullPointerException();
  219       }
  220       
  221       @Override
  222       public Insets getScreenInsets(GraphicsConfiguration gc) throws HeadlessException {
  223           throw new HeadlessException();
  224       }
  225       
  226       @Override
  227       public int getScreenResolution() throws HeadlessException {
  228           throw new HeadlessException();
  229       }    
  230       
  231       @Override
  232       public Dimension getScreenSize() throws HeadlessException {
  233           throw new HeadlessException();
  234       }
  235       
  236       @Override
  237       public Clipboard getSystemClipboard() throws HeadlessException {
  238           throw new HeadlessException();
  239       }    
  240       
  241       @Override
  242       public Clipboard getSystemSelection() throws HeadlessException {
  243           throw new HeadlessException();
  244       }
  245       
  246       @Override
  247       WindowFactory getWindowFactory() throws HeadlessException {
  248           throw new HeadlessException();
  249       }
  250       
  251       @Override
  252       void init() {
  253           lockAWT();
  254           try {
  255               ComponentInternals.setComponentInternals(new ComponentInternalsImpl());
  256               new EventQueue(this); // create the system EventQueue
  257               dispatcher = new Dispatcher(this);
  258               awtEventsManager = new AWTEventsManager();
  259               dispatchThread = new HeadlessEventDispatchThread(this, dispatcher);            
  260               dtk = DTK.getDTK();
  261               dispatchThread.start();            
  262           } finally {
  263               unlockAWT();
  264           }
  265       }
  266       
  267       @Override
  268       public boolean isDynamicLayoutActive() throws HeadlessException {
  269           throw new HeadlessException();
  270       }
  271       
  272       @Override
  273       protected boolean isDynamicLayoutSet() throws HeadlessException {
  274           throw new HeadlessException();
  275       }
  276       
  277       @Override
  278       public boolean isFrameStateSupported(int state) throws HeadlessException {
  279           throw new HeadlessException();
  280       }
  281       
  282       @Override
  283       protected void loadSystemColors(int[] systemColors) throws HeadlessException {
  284           throw new HeadlessException();
  285       }
  286       
  287       @Override
  288       public Map<java.awt.font.TextAttribute, ?> mapInputMethodHighlight(
  289               InputMethodHighlight highlight) throws HeadlessException {
  290           throw new HeadlessException();
  291       }
  292       
  293       @Override
  294       Map<java.awt.font.TextAttribute, ?> mapInputMethodHighlightImpl(
  295               InputMethodHighlight highlight) throws HeadlessException {
  296           throw new HeadlessException();
  297       }
  298   
  299       @Override
  300       public void setDynamicLayout(boolean dynamic) throws HeadlessException {
  301           throw new HeadlessException();
  302       }
  303       
  304       @Override
  305       public void setLockingKeyState(int keyCode, boolean on) throws UnsupportedOperationException {
  306           throw new HeadlessException();
  307       }
  308   }

Home » openjdk-7 » java » awt » [javadoc | source]