Source for gnu.java.awt.peer.headless.HeadlessToolkit

   1: /* HeadlessToolkit.java -- A toolkit for headless mode
   2:    Copyright (C) 2006 Free Software Foundation, Inc.
   3: 
   4: This file is part of GNU Classpath.
   5: 
   6: GNU Classpath is free software; you can redistribute it and/or modify
   7: it under the terms of the GNU General Public License as published by
   8: the Free Software Foundation; either version 2, or (at your option)
   9: any later version.
  10: 
  11: GNU Classpath is distributed in the hope that it will be useful, but
  12: WITHOUT ANY WARRANTY; without even the implied warranty of
  13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14: General Public License for more details.
  15: 
  16: You should have received a copy of the GNU General Public License
  17: along with GNU Classpath; see the file COPYING.  If not, write to the
  18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19: 02110-1301 USA.
  20: 
  21: Linking this library statically or dynamically with other modules is
  22: making a combined work based on this library.  Thus, the terms and
  23: conditions of the GNU General Public License cover the whole
  24: combination.
  25: 
  26: As a special exception, the copyright holders of this library give you
  27: permission to link this library with independent modules to produce an
  28: executable, regardless of the license terms of these independent
  29: modules, and to copy and distribute the resulting executable under
  30: terms of your choice, provided that you also meet, for each linked
  31: independent module, the terms and conditions of the license of that
  32: module.  An independent module is a module which is not derived from
  33: or based on this library.  If you modify this library, you may extend
  34: this exception to your version of the library, but you are not
  35: obligated to do so.  If you do not wish to do so, delete this
  36: exception statement from your version. */
  37: 
  38: 
  39: package gnu.java.awt.peer.headless;
  40: 
  41: import gnu.java.awt.ClasspathToolkit;
  42: import gnu.java.awt.EmbeddedWindow;
  43: import gnu.java.awt.peer.ClasspathFontPeer;
  44: import gnu.java.awt.peer.EmbeddedWindowPeer;
  45: 
  46: import java.awt.AWTException;
  47: import java.awt.Button;
  48: import java.awt.Canvas;
  49: import java.awt.Checkbox;
  50: import java.awt.CheckboxMenuItem;
  51: import java.awt.Choice;
  52: import java.awt.Dialog;
  53: import java.awt.Dimension;
  54: import java.awt.EventQueue;
  55: import java.awt.FileDialog;
  56: import java.awt.Font;
  57: import java.awt.FontMetrics;
  58: import java.awt.Frame;
  59: import java.awt.GraphicsDevice;
  60: import java.awt.GraphicsEnvironment;
  61: import java.awt.HeadlessException;
  62: import java.awt.Image;
  63: import java.awt.Label;
  64: import java.awt.List;
  65: import java.awt.Menu;
  66: import java.awt.MenuBar;
  67: import java.awt.MenuItem;
  68: import java.awt.Panel;
  69: import java.awt.PopupMenu;
  70: import java.awt.PrintJob;
  71: import java.awt.ScrollPane;
  72: import java.awt.Scrollbar;
  73: import java.awt.TextArea;
  74: import java.awt.TextField;
  75: import java.awt.Window;
  76: import java.awt.datatransfer.Clipboard;
  77: import java.awt.dnd.DragGestureEvent;
  78: import java.awt.dnd.peer.DragSourceContextPeer;
  79: import java.awt.im.InputMethodHighlight;
  80: import java.awt.image.ColorModel;
  81: import java.awt.image.ImageObserver;
  82: import java.awt.image.ImageProducer;
  83: import java.awt.peer.ButtonPeer;
  84: import java.awt.peer.CanvasPeer;
  85: import java.awt.peer.CheckboxMenuItemPeer;
  86: import java.awt.peer.CheckboxPeer;
  87: import java.awt.peer.ChoicePeer;
  88: import java.awt.peer.DialogPeer;
  89: import java.awt.peer.FileDialogPeer;
  90: import java.awt.peer.FontPeer;
  91: import java.awt.peer.FramePeer;
  92: import java.awt.peer.LabelPeer;
  93: import java.awt.peer.ListPeer;
  94: import java.awt.peer.MenuBarPeer;
  95: import java.awt.peer.MenuItemPeer;
  96: import java.awt.peer.MenuPeer;
  97: import java.awt.peer.PanelPeer;
  98: import java.awt.peer.PopupMenuPeer;
  99: import java.awt.peer.RobotPeer;
 100: import java.awt.peer.ScrollPanePeer;
 101: import java.awt.peer.ScrollbarPeer;
 102: import java.awt.peer.TextAreaPeer;
 103: import java.awt.peer.TextFieldPeer;
 104: import java.awt.peer.WindowPeer;
 105: import java.io.InputStream;
 106: import java.net.URL;
 107: import java.util.Map;
 108: import java.util.Properties;
 109: 
 110: public class HeadlessToolkit
 111:   extends ClasspathToolkit
 112: {
 113: 
 114:   /**
 115:    * The graphics environment for headless graphics.
 116:    */
 117:   private HeadlessGraphicsEnvironment graphicsEnv;
 118: 
 119:   public void beep()
 120:   {
 121:     // TODO Auto-generated method stub
 122: 
 123:   }
 124: 
 125:   public int checkImage(Image image, int width, int height,
 126:                         ImageObserver observer)
 127:   {
 128:     // TODO Auto-generated method stub
 129:     return 0;
 130:   }
 131: 
 132:   protected ButtonPeer createButton(Button target)
 133:   {
 134:     throw new HeadlessException();
 135:   }
 136: 
 137:   protected CanvasPeer createCanvas(Canvas target)
 138:   {
 139:     throw new HeadlessException();
 140:   }
 141: 
 142:   protected CheckboxPeer createCheckbox(Checkbox target)
 143:   {
 144:     throw new HeadlessException();
 145:   }
 146: 
 147:   protected CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target)
 148:   {
 149:     throw new HeadlessException();
 150:   }
 151: 
 152:   protected ChoicePeer createChoice(Choice target)
 153:   {
 154:     throw new HeadlessException();
 155:   }
 156: 
 157:   protected DialogPeer createDialog(Dialog target)
 158:   {
 159:     throw new HeadlessException();
 160:   }
 161: 
 162:   public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent e)
 163:   {
 164:     throw new HeadlessException();
 165:   }
 166: 
 167:   protected FileDialogPeer createFileDialog(FileDialog target)
 168:   {
 169:     throw new HeadlessException();
 170:   }
 171: 
 172:   protected FramePeer createFrame(Frame target)
 173:   {
 174:     throw new HeadlessException();
 175:   }
 176: 
 177:   public Image createImage(String filename)
 178:   {
 179:     // FIXME: Implement.
 180:     return null;
 181:   }
 182: 
 183:   public Image createImage(URL url)
 184:   {
 185:     // FIXME: Implement.
 186:     return null;
 187:   }
 188: 
 189:   public Image createImage(ImageProducer producer)
 190:   {
 191:     // FIXME: Implement.
 192:     return null;
 193:   }
 194: 
 195:   public Image createImage(byte[] data, int offset, int len)
 196:   {
 197:     // TODO Auto-generated method stub
 198:     return null;
 199:   }
 200: 
 201:   protected LabelPeer createLabel(Label target)
 202:   {
 203:     throw new HeadlessException();
 204:   }
 205: 
 206:   protected ListPeer createList(List target)
 207:   {
 208:     throw new HeadlessException();
 209:   }
 210: 
 211:   protected MenuPeer createMenu(Menu target)
 212:   {
 213:     throw new HeadlessException();
 214:   }
 215: 
 216:   protected MenuBarPeer createMenuBar(MenuBar target)
 217:   {
 218:     throw new HeadlessException();
 219:   }
 220: 
 221:   protected MenuItemPeer createMenuItem(MenuItem target)
 222:   {
 223:     throw new HeadlessException();
 224:   }
 225: 
 226:   protected PanelPeer createPanel(Panel target)
 227:   {
 228:     throw new HeadlessException();
 229:   }
 230: 
 231:   protected PopupMenuPeer createPopupMenu(PopupMenu target)
 232:   {
 233:     throw new HeadlessException();
 234:   }
 235: 
 236:   protected ScrollPanePeer createScrollPane(ScrollPane target)
 237:   {
 238:     throw new HeadlessException();
 239:   }
 240: 
 241:   protected ScrollbarPeer createScrollbar(Scrollbar target)
 242:   {
 243:     throw new HeadlessException();
 244:   }
 245: 
 246:   protected TextAreaPeer createTextArea(TextArea target)
 247:   {
 248:     throw new HeadlessException();
 249:   }
 250: 
 251:   protected TextFieldPeer createTextField(TextField target)
 252:   {
 253:     throw new HeadlessException();
 254:   }
 255: 
 256:   protected WindowPeer createWindow(Window target)
 257:   {
 258:     throw new HeadlessException();
 259:   }
 260: 
 261:   public ColorModel getColorModel()
 262:   {
 263:     // TODO Auto-generated method stub
 264:     return null;
 265:   }
 266: 
 267:   public String[] getFontList()
 268:   {
 269:     // TODO Auto-generated method stub
 270:     return null;
 271:   }
 272: 
 273:   public FontMetrics getFontMetrics(Font name)
 274:   {
 275:     // TODO Auto-generated method stub
 276:     return null;
 277:   }
 278: 
 279:   protected FontPeer getFontPeer(String name, int style)
 280:   {
 281:     // TODO Auto-generated method stub
 282:     return null;
 283:   }
 284: 
 285:   public Image getImage(String name)
 286:   {
 287:     // TODO Auto-generated method stub
 288:     return null;
 289:   }
 290: 
 291:   public Image getImage(URL url)
 292:   {
 293:     // TODO Auto-generated method stub
 294:     return null;
 295:   }
 296: 
 297:   public PrintJob getPrintJob(Frame frame, String title, Properties props)
 298:   {
 299:     // TODO Auto-generated method stub
 300:     return null;
 301:   }
 302: 
 303:   public int getScreenResolution()
 304:   {
 305:     throw new HeadlessException();
 306:   }
 307: 
 308:   public Dimension getScreenSize()
 309:   {
 310:     throw new HeadlessException();
 311:   }
 312: 
 313:   public Clipboard getSystemClipboard()
 314:   {
 315:     throw new HeadlessException();
 316:   }
 317: 
 318:   protected EventQueue getSystemEventQueueImpl()
 319:   {
 320:     throw new HeadlessException();
 321:   }
 322: 
 323:   public Map mapInputMethodHighlight(InputMethodHighlight highlight)
 324:   {
 325:     // TODO Auto-generated method stub
 326:     return null;
 327:   }
 328: 
 329:   public boolean prepareImage(Image image, int width, int height,
 330:                               ImageObserver observer)
 331:   {
 332:     // TODO Auto-generated method stub
 333:     return false;
 334:   }
 335: 
 336:   public void sync()
 337:   {
 338:     // TODO Auto-generated method stub
 339: 
 340:   }
 341: 
 342:   public EmbeddedWindowPeer createEmbeddedWindow(EmbeddedWindow w)
 343:   {
 344:     throw new HeadlessException();
 345:   }
 346: 
 347:   public Font createFont(int format, InputStream stream)
 348:   {
 349:     // TODO Auto-generated method stub
 350:     return null;
 351:   }
 352: 
 353:   public RobotPeer createRobot(GraphicsDevice screen) throws AWTException
 354:   {
 355:     throw new HeadlessException();
 356:   }
 357: 
 358:   public ClasspathFontPeer getClasspathFontPeer(String name, Map attrs)
 359:   {
 360:     // TODO Auto-generated method stub
 361:     return null;
 362:   }
 363: 
 364:   public GraphicsEnvironment getLocalGraphicsEnvironment()
 365:   {
 366:     if (graphicsEnv == null)
 367:       graphicsEnv = new HeadlessGraphicsEnvironment();
 368:     return graphicsEnv;
 369:   }
 370: 
 371:   @Override
 372:   public boolean isModalExclusionTypeSupported
 373:   (Dialog.ModalExclusionType modalExclusionType)
 374:   {
 375:     return false;
 376:   }
 377: 
 378:   @Override
 379:   public boolean isModalityTypeSupported(Dialog.ModalityType modalityType)
 380:   {
 381:     return false;
 382:   }
 383: 
 384: 
 385: }