1 /*
   2  * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.javafx.tk;
  27 
  28 import javafx.geometry.Dimension2D;
  29 import javafx.scene.image.Image;
  30 import javafx.scene.input.Dragboard;
  31 import javafx.scene.input.InputMethodRequests;
  32 import javafx.scene.input.KeyCode;
  33 import javafx.scene.input.KeyEvent;
  34 import javafx.scene.input.TransferMode;
  35 import javafx.scene.paint.Color;
  36 import javafx.scene.paint.ImagePattern;
  37 import javafx.scene.paint.LinearGradient;
  38 import javafx.scene.paint.RadialGradient;
  39 import javafx.scene.shape.PathElement;
  40 import javafx.scene.shape.SVGPath;
  41 import javafx.scene.shape.StrokeLineCap;
  42 import javafx.scene.shape.StrokeLineJoin;
  43 import javafx.scene.shape.StrokeType;
  44 import javafx.stage.FileChooser.ExtensionFilter;
  45 import javafx.stage.Modality;
  46 import javafx.stage.Stage;
  47 import javafx.stage.StageStyle;
  48 import javafx.stage.Window;
  49 import java.io.File;
  50 import java.io.InputStream;
  51 import java.security.AccessControlContext;
  52 import java.util.List;
  53 import java.util.Map;
  54 import java.util.Set;
  55 import java.util.concurrent.Future;
  56 import com.sun.glass.ui.CommonDialogs.FileChooserResult;
  57 import com.sun.javafx.embed.HostInterface;
  58 import com.sun.javafx.geom.Path2D;
  59 import com.sun.javafx.geom.Shape;
  60 import com.sun.javafx.geom.transform.BaseTransform;
  61 import com.sun.javafx.perf.PerformanceTracker;
  62 import com.sun.javafx.runtime.async.AsyncOperation;
  63 import com.sun.javafx.runtime.async.AsyncOperationListener;
  64 import com.sun.javafx.scene.text.HitInfo;
  65 import com.sun.javafx.scene.text.TextLayoutFactory;
  66 import com.sun.scenario.DelayedRunnable;
  67 import com.sun.scenario.animation.AbstractMasterTimer;
  68 import com.sun.scenario.effect.FilterContext;
  69 import com.sun.scenario.effect.Filterable;
  70 
  71 /**
  72  * A stubbed out Toolkit that provides no useful implementation. This is used
  73  * by the build to run the CSS to binary converter. The parser uses
  74  * PlatformLogger which requires a Toolkit.
  75  *
  76  */
  77 final public class DummyToolkit extends Toolkit {
  78 
  79     @Override
  80     public boolean init() {
  81         return true;
  82     }
  83 
  84     @Override
  85     public Object enterNestedEventLoop(Object key) {
  86         throw new UnsupportedOperationException("Not supported yet.");
  87     }
  88 
  89     @Override
  90     public void exitNestedEventLoop(Object key, Object rval) {
  91         throw new UnsupportedOperationException("Not supported yet.");
  92     }
  93 
  94     @Override
  95     public TKStage createTKStage(Window peerWindow, boolean securityDialog, StageStyle stageStyle, boolean primary, Modality modality, TKStage owner, boolean rtl, AccessControlContext acc) {
  96         throw new UnsupportedOperationException("Not supported yet.");
  97     }
  98 
  99     @Override
 100     public TKStage createTKPopupStage(Window peerWindow, StageStyle popupStyle, TKStage owner, AccessControlContext acc) {
 101         throw new UnsupportedOperationException("Not supported yet.");
 102     }
 103 
 104     @Override
 105     public TKStage createTKEmbeddedStage(HostInterface host, AccessControlContext acc) {
 106         throw new UnsupportedOperationException("Not supported yet.");
 107     }
 108 
 109     @Override
 110     public AppletWindow createAppletWindow(long parent, String serverName) {
 111         throw new UnsupportedOperationException("Not supported yet.");
 112     }
 113 
 114     @Override
 115     public void closeAppletWindow() {
 116         throw new UnsupportedOperationException("Not supported yet.");
 117     }
 118 
 119     @Override
 120     public TKSystemMenu getSystemMenu() {
 121         throw new UnsupportedOperationException("Not supported yet.");
 122     }
 123 
 124     @Override
 125     public ImageLoader loadImage(String url, int width, int height, boolean preserveRatio, boolean smooth) {
 126         throw new UnsupportedOperationException("Not supported yet.");
 127     }
 128 
 129     @Override
 130     public ImageLoader loadImage(InputStream stream, int width, int height, boolean preserveRatio, boolean smooth) {
 131         throw new UnsupportedOperationException("Not supported yet.");
 132     }
 133 
 134     @Override
 135     public AsyncOperation loadImageAsync(AsyncOperationListener<? extends ImageLoader> listener, String url, int width, int height, boolean preserveRatio, boolean smooth) {
 136         throw new UnsupportedOperationException("Not supported yet.");
 137     }
 138 
 139     @Override
 140     public ImageLoader loadPlatformImage(Object platformImage) {
 141         throw new UnsupportedOperationException("Not supported yet.");
 142     }
 143 
 144     @Override
 145     public PlatformImage createPlatformImage(int w, int h) {
 146         throw new UnsupportedOperationException("Not supported yet.");
 147     }
 148 
 149     @Override
 150     public void startup(Runnable runnable) {
 151         throw new UnsupportedOperationException("Not supported yet.");
 152     }
 153 
 154     @Override
 155     public void defer(Runnable runnable) {
 156         throw new UnsupportedOperationException("Not supported yet.");
 157     }
 158 
 159     @Override
 160     public Future addRenderJob(RenderJob rj) {
 161         throw new UnsupportedOperationException("Not supported yet.");
 162     }
 163 
 164     @Override
 165     public Map<Object, Object> getContextMap() {
 166         throw new UnsupportedOperationException("Not supported yet.");
 167     }
 168 
 169     @Override
 170     public int getRefreshRate() {
 171         throw new UnsupportedOperationException("Not supported yet.");
 172     }
 173 
 174     @Override
 175     public void setAnimationRunnable(DelayedRunnable animationRunnable) {
 176         throw new UnsupportedOperationException("Not supported yet.");
 177     }
 178 
 179     @Override
 180     public PerformanceTracker getPerformanceTracker() {
 181         throw new UnsupportedOperationException("Not supported yet.");
 182     }
 183 
 184     @Override public PerformanceTracker createPerformanceTracker() {
 185         throw new UnsupportedOperationException("Not supported yet.");
 186     }
 187 
 188     @Override
 189     public void waitFor(Task t) {
 190         throw new UnsupportedOperationException("Not supported yet.");
 191     }
 192 
 193     @Override
 194     protected Object createColorPaint(Color paint) {
 195         throw new UnsupportedOperationException("Not supported yet.");
 196     }
 197 
 198     @Override
 199     protected Object createLinearGradientPaint(LinearGradient paint) {
 200         throw new UnsupportedOperationException("Not supported yet.");
 201     }
 202 
 203     @Override
 204     protected Object createRadialGradientPaint(RadialGradient paint) {
 205         throw new UnsupportedOperationException("Not supported yet.");
 206     }
 207 
 208     @Override
 209     protected Object createImagePatternPaint(ImagePattern paint) {
 210         throw new UnsupportedOperationException("Not supported yet.");
 211     }
 212 
 213     @Override
 214     public void accumulateStrokeBounds(Shape shape, float[] bbox, StrokeType type, double strokewidth, StrokeLineCap cap, StrokeLineJoin join, float miterLimit, BaseTransform tx) {
 215         throw new UnsupportedOperationException("Not supported yet.");
 216     }
 217 
 218     @Override
 219     public boolean strokeContains(Shape shape, double x, double y, StrokeType type, double strokewidth, StrokeLineCap cap, StrokeLineJoin join, float miterLimit) {
 220         throw new UnsupportedOperationException("Not supported yet.");
 221     }
 222 
 223     @Override
 224     public Shape createStrokedShape(Shape shape, StrokeType pgtype, double strokewidth, StrokeLineCap pgcap, StrokeLineJoin pgjoin, float miterLimit, float[] dashArray, float dashOffset) {
 225         throw new UnsupportedOperationException("Not supported yet.");
 226     }
 227 
 228     @Override
 229     public int getKeyCodeForChar(String character) {
 230         throw new UnsupportedOperationException("Not supported yet.");
 231     }
 232 
 233     @Override
 234     public Dimension2D getBestCursorSize(int preferredWidth, int preferredHeight) {
 235         throw new UnsupportedOperationException("Not supported yet.");
 236     }
 237 
 238     @Override
 239     public int getMaximumCursorColors() {
 240         throw new UnsupportedOperationException("Not supported yet.");
 241     }
 242 
 243 
 244     @Override
 245     public PathElement[] convertShapeToFXPath(Object shape) {
 246         throw new UnsupportedOperationException("Not supported yet.");
 247     }
 248 
 249     @Override
 250     public HitInfo convertHitInfoToFX(Object hit) {
 251         throw new UnsupportedOperationException("Not supported yet.");
 252     }
 253 
 254     @Override
 255     public Filterable toFilterable(Image img) {
 256         throw new UnsupportedOperationException("Not supported yet.");
 257     }
 258 
 259     @Override
 260     public FilterContext getFilterContext(Object config) {
 261         throw new UnsupportedOperationException("Not supported yet.");
 262     }
 263 
 264     @Override
 265     public boolean isForwardTraversalKey(KeyEvent e) {
 266         throw new UnsupportedOperationException("Not supported yet.");
 267     }
 268 
 269     @Override
 270     public boolean isBackwardTraversalKey(KeyEvent e) {
 271         throw new UnsupportedOperationException("Not supported yet.");
 272     }
 273 
 274     @Override
 275     public boolean isNestedLoopRunning() {
 276         throw new UnsupportedOperationException("Not supported yet.");
 277     }
 278 
 279     @Override
 280     public AbstractMasterTimer getMasterTimer() {
 281         return null;
 282     }
 283 
 284     @Override
 285     public FontLoader getFontLoader() {
 286         throw new UnsupportedOperationException("Not supported yet.");
 287     }
 288 
 289     @Override
 290     public TextLayoutFactory getTextLayoutFactory() {
 291         throw new UnsupportedOperationException("Not supported yet.");
 292     }
 293 
 294     @Override
 295     public Object createSVGPathObject(SVGPath svgpath) {
 296         throw new UnsupportedOperationException("Not supported yet.");
 297     }
 298 
 299     @Override
 300     public Path2D createSVGPath2D(SVGPath svgpath) {
 301         throw new UnsupportedOperationException("Not supported yet.");
 302     }
 303 
 304     @Override
 305     public boolean imageContains(Object image, float x, float y) {
 306         throw new UnsupportedOperationException("Not supported yet.");
 307     }
 308 
 309     @Override
 310     public com.sun.javafx.tk.TKClipboard getSystemClipboard() {
 311         throw new UnsupportedOperationException("Not supported yet.");
 312     }
 313 
 314     @Override
 315     public TKClipboard getNamedClipboard(String name) {
 316         throw new UnsupportedOperationException("Not supported yet.");
 317     }
 318 
 319     @Override
 320     public ScreenConfigurationAccessor setScreenConfigurationListener(TKScreenConfigurationListener listener) {
 321         throw new UnsupportedOperationException("Not supported yet.");
 322     }
 323 
 324     @Override
 325     public Object getPrimaryScreen() {
 326         throw new UnsupportedOperationException("Not supported yet.");
 327     }
 328 
 329     @Override
 330     public List<?> getScreens() {
 331         throw new UnsupportedOperationException("Not supported yet.");
 332     }
 333 
 334     @Override
 335     public ScreenConfigurationAccessor getScreenConfigurationAccessor() {
 336         throw new UnsupportedOperationException("Not supported yet.");
 337     }
 338 
 339     @Override
 340     public void registerDragGestureListener(TKScene s, Set<TransferMode> tms, TKDragGestureListener l) {
 341         throw new UnsupportedOperationException("Not supported yet.");
 342     }
 343 
 344     @Override
 345     public void startDrag(TKScene scene, Set<TransferMode> tms, TKDragSourceListener l, Dragboard dragboard) {
 346         throw new UnsupportedOperationException("Not supported yet.");
 347     }
 348 
 349     @Override
 350     public void enableDrop(TKScene s, TKDropTargetListener l) {
 351         throw new UnsupportedOperationException("Not supported yet.");
 352     }
 353 
 354     @Override
 355     public void installInputMethodRequests(TKScene scene, InputMethodRequests requests) {
 356         throw new UnsupportedOperationException("Not supported yet.");
 357     }
 358 
 359     @Override
 360     public Object renderToImage(ImageRenderingContext context) {
 361         throw new UnsupportedOperationException("Not supported yet.");
 362     }
 363 
 364     @Override
 365     public KeyCode getPlatformShortcutKey() {
 366         throw new UnsupportedOperationException("Not supported yet.");
 367     }
 368 
 369     @Override
 370     public FileChooserResult showFileChooser(TKStage ownerWindow,
 371                                       String title,
 372                                       File initialDirectory,
 373                                       String initialFileName,
 374                                       FileChooserType fileChooserType,
 375                                       List<ExtensionFilter> extensionFilters,
 376                                       ExtensionFilter selectedFilter) {
 377         throw new UnsupportedOperationException("Not supported yet.");
 378     }
 379 
 380 
 381     @Override
 382     public File showDirectoryChooser(TKStage ownerWindow,
 383                                      String title,
 384                                      File initialDirectory) {
 385         throw new UnsupportedOperationException("Not supported yet.");
 386     }
 387 
 388     @Override
 389     public long getMultiClickTime() {
 390         return 0L;
 391     }
 392 
 393     @Override
 394     public int getMultiClickMaxX() {
 395         return 0;
 396     }
 397 
 398     @Override
 399     public int getMultiClickMaxY() {
 400         return 0;
 401     }
 402 
 403     @Override
 404     public void requestNextPulse() {
 405         throw new UnsupportedOperationException("Not supported yet.");
 406     }
 407 
 408     }