< prev index next >

modules/web/src/main/java/com/sun/javafx/webkit/WebPageClientImpl.java

Print this page




   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.webkit;
  27 

  28 import java.security.AccessController;
  29 import java.security.PrivilegedAction;
  30 
  31 import com.sun.javafx.scene.traversal.Direction;
  32 import javafx.geometry.Point2D;
  33 import javafx.geometry.Rectangle2D;
  34 import javafx.scene.Cursor;
  35 import javafx.scene.Scene;
  36 import javafx.scene.control.Tooltip;
  37 import javafx.scene.web.WebView;
  38 import javafx.stage.Screen;
  39 import javafx.stage.Window;
  40 
  41 import com.sun.javafx.util.Utils;
  42 import com.sun.webkit.CursorManager;
  43 import com.sun.webkit.WebPageClient;
  44 import com.sun.webkit.graphics.WCGraphicsManager;
  45 import com.sun.webkit.graphics.WCPageBackBuffer;
  46 import com.sun.webkit.graphics.WCPoint;
  47 import com.sun.webkit.graphics.WCRectangle;


  84     private boolean  isTooltipRegistered = false;
  85     @Override public void setTooltip(final String tooltipText) {
  86         WebView view = accessor.getView();
  87         if (tooltipText != null) {
  88             if (tooltip == null) {
  89                 tooltip = new Tooltip(tooltipText);
  90             } else {
  91                 tooltip.setText(tooltipText);
  92             }
  93             if (!isTooltipRegistered) {
  94                 Tooltip.install(view, tooltip);
  95                 isTooltipRegistered = true;
  96             }
  97         } else if (isTooltipRegistered) {
  98             Tooltip.uninstall(view, tooltip);
  99             isTooltipRegistered = false;
 100         }
 101     }
 102 
 103     @Override public void transferFocus(boolean forward) {
 104         accessor.getView().impl_traverse(forward ? Direction.NEXT : Direction.PREVIOUS);
 105     }
 106 
 107     @Override public WCRectangle getScreenBounds(boolean available) {
 108         WebView view = accessor.getView();
 109 
 110         Screen screen = Utils.getScreen(view);
 111         if (screen != null) {
 112             Rectangle2D r = available
 113                     ? screen.getVisualBounds()
 114                     : screen.getBounds();
 115             return new WCRectangle(
 116                     (float)r.getMinX(),  (float)r.getMinY(),
 117                     (float)r.getWidth(), (float)r.getHeight());
 118         }
 119         return null;
 120     }
 121 
 122     @Override public int getScreenDepth() {
 123         // no way to determine screen color depth, return a default
 124         return 24;




   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.webkit;
  27 
  28 import com.sun.javafx.scene.NodeHelper;
  29 import java.security.AccessController;
  30 import java.security.PrivilegedAction;
  31 
  32 import com.sun.javafx.scene.traversal.Direction;
  33 import javafx.geometry.Point2D;
  34 import javafx.geometry.Rectangle2D;
  35 import javafx.scene.Cursor;
  36 import javafx.scene.Scene;
  37 import javafx.scene.control.Tooltip;
  38 import javafx.scene.web.WebView;
  39 import javafx.stage.Screen;
  40 import javafx.stage.Window;
  41 
  42 import com.sun.javafx.util.Utils;
  43 import com.sun.webkit.CursorManager;
  44 import com.sun.webkit.WebPageClient;
  45 import com.sun.webkit.graphics.WCGraphicsManager;
  46 import com.sun.webkit.graphics.WCPageBackBuffer;
  47 import com.sun.webkit.graphics.WCPoint;
  48 import com.sun.webkit.graphics.WCRectangle;


  85     private boolean  isTooltipRegistered = false;
  86     @Override public void setTooltip(final String tooltipText) {
  87         WebView view = accessor.getView();
  88         if (tooltipText != null) {
  89             if (tooltip == null) {
  90                 tooltip = new Tooltip(tooltipText);
  91             } else {
  92                 tooltip.setText(tooltipText);
  93             }
  94             if (!isTooltipRegistered) {
  95                 Tooltip.install(view, tooltip);
  96                 isTooltipRegistered = true;
  97             }
  98         } else if (isTooltipRegistered) {
  99             Tooltip.uninstall(view, tooltip);
 100             isTooltipRegistered = false;
 101         }
 102     }
 103 
 104     @Override public void transferFocus(boolean forward) {
 105         NodeHelper.traverse(accessor.getView(), forward ? Direction.NEXT : Direction.PREVIOUS);
 106     }
 107 
 108     @Override public WCRectangle getScreenBounds(boolean available) {
 109         WebView view = accessor.getView();
 110 
 111         Screen screen = Utils.getScreen(view);
 112         if (screen != null) {
 113             Rectangle2D r = available
 114                     ? screen.getVisualBounds()
 115                     : screen.getBounds();
 116             return new WCRectangle(
 117                     (float)r.getMinX(),  (float)r.getMinY(),
 118                     (float)r.getWidth(), (float)r.getHeight());
 119         }
 120         return null;
 121     }
 122 
 123     @Override public int getScreenDepth() {
 124         // no way to determine screen color depth, return a default
 125         return 24;


< prev index next >