1 /*
   2  * Copyright (c) 2018, 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.embed.swing;
  27 
  28 import javafx.scene.Node;
  29 import javafx.event.EventHandler;
  30 import java.awt.AWTEvent;
  31 import com.sun.javafx.geom.BaseBounds;
  32 import com.sun.javafx.geom.transform.BaseTransform;
  33 import com.sun.javafx.sg.prism.NGNode;
  34 import javax.swing.JComponent;
  35 import java.awt.event.MouseWheelEvent;
  36 import javafx.scene.input.ScrollEvent;
  37 import java.awt.event.WindowFocusListener;
  38 import javafx.stage.Window;
  39 import javafx.scene.Scene;
  40 import com.sun.javafx.embed.swing.DisposerRecord;
  41 import javafx.geometry.Point2D;
  42 import java.util.concurrent.locks.ReentrantLock;
  43 
  44 import javafx.embed.swing.SwingNode;
  45 
  46 public abstract class SwingNodeInterop {
  47     
  48     public abstract Object createLightweightFrame(); 
  49     public abstract Object getLightweightFrame(); 
  50     public abstract void disposeFrame(Object frame);
  51 
  52     public abstract java.awt.event.MouseEvent createMouseEvent(Object lwFrame,
  53                             int swingID, long swingWhen, int swingModifiers,
  54                             int relX, int relY, int absX, int absY,
  55                             int clickCount, boolean swingPopupTrigger,
  56                             int swingButton); 
  57 
  58     public abstract MouseWheelEvent createMouseWheelEvent(Object lwFrame,
  59                             int swingModifiers, int x, int y, int wheelRotation); 
  60 
  61     public abstract java.awt.event.KeyEvent createKeyEvent(Object lwFrame,
  62                                    int swingID, long swingWhen,
  63                                    int swingModifiers,
  64                                    int swingKeyCode, char swingChar);
  65 
  66     public abstract AWTEvent createUngrabEvent(Object lwFrame);
  67 
  68     public abstract void overrideNativeWindowHandle(long handle, Runnable closeWindow);
  69     public abstract void addWindowFocusListener(Object frame, WindowFocusListener l);
  70     public abstract void notifyDisplayChanged(Object frame, Window w);
  71     public abstract void setHostBounds(Object frame, Window w);
  72     public abstract void setContent(Object frame, Object content);
  73     public abstract void setVisible(Object frame, boolean visible);
  74     public abstract void setBounds(Object frame, int frameX, int frameY, int frameW, int frameH);
  75 
  76     public abstract void disposeLwFrame();
  77 
  78     public abstract void setLwFrameScale(final double scaleX, final double scaleY);
  79     public abstract void setLwFrameVisible(boolean visible);
  80 
  81     public abstract void activateLwFrame(Object lwFrame, final boolean activate);
  82 
  83     public abstract Object createSwingNodeContent(JComponent content, SwingNode node);
  84 
  85     public abstract DisposerRecord createSwingNodeDisposer(Object lwFrame);
  86 
  87 }