Spec-Zone .ru
спецификации, руководства, описания, API
|
001/* 002 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 004 * 005 * This code is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU General Public License version 2 only, as 007 * published by the Free Software Foundation. Oracle designates this 008 * particular file as subject to the "Classpath" exception as provided 009 * by Oracle in the LICENSE file that accompanied this code. 010 * 011 * This code is distributed in the hope that it will be useful, but WITHOUT 012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 014 * version 2 for more details (a copy is included in the LICENSE file that 015 * accompanied this code). 016 * 017 * You should have received a copy of the GNU General Public License version 018 * 2 along with this work; if not, write to the Free Software Foundation, 019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 020 * 021 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 022 * or visit www.oracle.com if you need additional information or have any 023 * questions. 024 */ 025 026package javafx.scene.input; 027 028import java.util.Set; 029 030import com.sun.javafx.tk.TKClipboard; 031import com.sun.javafx.tk.TKScene; 032import javafx.scene.image.Image; 033 034/** 035 * A drag and drop specific {@link Clipboard}. 036 */ 037public final class Dragboard extends Clipboard { 038 039 Dragboard(TKClipboard peer) { 040 super(peer); 041 } 042 043 /** 044 * Gets set of transport modes supported by source of this drag opeation. 045 * @return set of supported transfer modes 046 */ 047 public final Set<TransferMode> getTransferModes() { 048 return peer.getTransferModes(); 049 } 050 051 /** 052 * @treatAsPrivate implementation detail 053 * @deprecated This is an internal API that is not intended for use and will be removed in the next version 054 */ 055 @Deprecated 056 public TKClipboard impl_getPeer() { 057 return peer; 058 } 059 060 /** 061 * @treatAsPrivate implementation detail 062 * @deprecated This is an internal API that is not intended for use and will be removed in the next version 063 */ 064 @Deprecated 065 public static Dragboard impl_createDragboard(TKScene scene, boolean isDragSource) { 066 return new Dragboard(scene.createDragboard(isDragSource)); 067 } 068 069 // PENDING_DOC_REVIEW 070 /** 071 * Sets the visual representation of data being transfered 072 * in a drag and drop gesture. 073 * Uses the given image for the drag view with the offsetX and offsetY 074 * specifying cursor position over the image. 075 * This method should be called only when starting drag and drop operation 076 * in the DRAG_DETECTED handler, calling it at other times 077 * doesn't have any effect. 078 * @param image image to use for the drag view 079 * @param offsetX x position of the cursor over the image 080 * @param offsetY y position of the cursor over the image 081 */ 082 public void setDragView(Image image, double offsetX, double offsetY) { 083 peer.setDragView(image); 084 peer.setDragViewOffsetX(offsetX); 085 peer.setDragViewOffsetY(offsetY); 086 } 087 088 /** 089 * Sets the visual representation of data being transfered 090 * in a drag and drop gesture. 091 * This method should be called only when starting drag and drop operation 092 * in the DRAG_DETECTED handler, calling it at other times 093 * doesn't have any effect. 094 * @param image image to use for the drag view 095 */ 096 public void setDragView(Image image) { 097 peer.setDragView(image); 098 } 099 100 /** 101 * Sets the x position of the cursor of the drag view image. 102 * This method should be called only when starting drag and drop operation 103 * in the DRAG_DETECTED handler, calling it at other times 104 * doesn't have any effect. 105 * @param offsetX x position of the cursor over the image 106 */ 107 public void setDragViewOffsetX(double offsetX) { 108 peer.setDragViewOffsetX(offsetX); 109 } 110 111 /** 112 * Sets the y position of the cursor of the drag view image. 113 * This method should be called only when starting drag and drop operation 114 * in the DRAG_DETECTED handler, calling it at other times 115 * doesn't have any effect. 116 * @param offsetY y position of the cursor over the image 117 */ 118 public void setDragViewOffsetY(double offsetY) { 119 peer.setDragViewOffsetY(offsetY); 120 } 121 122 /** 123 * Gets the image used as a drag view. 124 * This method returns meaningful value only when starting drag and drop 125 * operation in the DRAG_DETECTED handler, it returns null at other times. 126 * @return the image used as a drag view 127 */ 128 public Image getDragView() { 129 return peer.getDragView(); 130 } 131 132 /** 133 * Gets the x position of the cursor of the drag view image. 134 * This method returns meaningful value only when starting drag and drop 135 * operation in the DRAG_DETECTED handler, it returns 0 at other times. 136 * @return x position of the cursor over the image 137 */ 138 public double getDragViewOffsetX() { 139 return peer.getDragViewOffsetX(); 140 } 141 142 /** 143 * Gets the y position of the cursor of the drag view image. 144 * This method returns meaningful value only when starting drag and drop 145 * operation in the DRAG_DETECTED handler, it returns 0 at other times. 146 * @return y position of the cursor over the image 147 */ 148 public double getDragViewOffsetY() { 149 return peer.getDragViewOffsetY(); 150 } 151}