< prev index next >

modules/graphics/src/main/java/javafx/scene/input/Dragboard.java

Print this page




  53     Object getContentImpl(DataFormat dataFormat) {
  54         if (dataAccessRestricted) {
  55             final SecurityManager securityManager = System.getSecurityManager();
  56             if (securityManager != null) {
  57                 final Permission clipboardPerm =
  58                         PermissionHelper.getAccessClipboardPermission();
  59                 securityManager.checkPermission(clipboardPerm);
  60             }
  61         }
  62         return super.getContentImpl(dataFormat);
  63     }
  64 
  65     /**
  66      * Gets set of transport modes supported by source of this drag opeation.
  67      * @return set of supported transfer modes
  68      */
  69     public final Set<TransferMode> getTransferModes() {
  70         return peer.getTransferModes();
  71     }
  72 
  73     /**
  74      * @treatAsPrivate implementation detail
  75      * @deprecated This is an internal API that is not intended for use and will be removed in the next version
  76      */
  77     @Deprecated
  78     public TKClipboard impl_getPeer() {
  79         return peer;
  80     }
  81 
  82     /**
  83      * @treatAsPrivate implementation detail
  84      * @deprecated This is an internal API that is not intended for use and will be removed in the next version
  85      */
  86     @Deprecated
  87     public static Dragboard impl_createDragboard(TKClipboard peer) {
  88         return new Dragboard(peer);
  89     }
  90 
  91     // PENDING_DOC_REVIEW
  92     /**
  93      * Sets the visual representation of data being transfered
  94      * in a drag and drop gesture.
  95      * Uses the given image for the drag view with the offsetX and offsetY
  96      * specifying cursor position over the image.
  97      * This method should be called only when starting drag and drop operation
  98      * in the DRAG_DETECTED handler, calling it at other times
  99      * doesn't have any effect.
 100      * @param image image to use for the drag view
 101      * @param offsetX x position of the cursor over the image
 102      * @param offsetY y position of the cursor over the image
 103      * @since JavaFX 8.0
 104      */
 105     public void setDragView(Image image, double offsetX, double offsetY) {
 106         peer.setDragView(image);
 107         peer.setDragViewOffsetX(offsetX);


 164      * @since JavaFX 8.0
 165      */
 166     public double getDragViewOffsetX() {
 167         return peer.getDragViewOffsetX();
 168     }
 169 
 170     /**
 171      * Gets the y position of the cursor of the drag view image.
 172      * This method returns meaningful value only when starting drag and drop
 173      * operation in the DRAG_DETECTED handler, it returns 0 at other times.
 174      * @return y position of the cursor over the image
 175      * @since JavaFX 8.0
 176      */
 177     public double getDragViewOffsetY() {
 178         return peer.getDragViewOffsetY();
 179     }
 180 
 181     static {
 182         // This is used by classes in different packages to get access to
 183         // private and package private methods.
 184         DragboardHelper.setDragboardAccessor((dragboard, restricted) -> {



 185             dragboard.dataAccessRestricted = restricted;











 186         });
 187     }
 188 }


  53     Object getContentImpl(DataFormat dataFormat) {
  54         if (dataAccessRestricted) {
  55             final SecurityManager securityManager = System.getSecurityManager();
  56             if (securityManager != null) {
  57                 final Permission clipboardPerm =
  58                         PermissionHelper.getAccessClipboardPermission();
  59                 securityManager.checkPermission(clipboardPerm);
  60             }
  61         }
  62         return super.getContentImpl(dataFormat);
  63     }
  64 
  65     /**
  66      * Gets set of transport modes supported by source of this drag opeation.
  67      * @return set of supported transfer modes
  68      */
  69     public final Set<TransferMode> getTransferModes() {
  70         return peer.getTransferModes();
  71     }
  72 
  73     private TKClipboard getPeer() {





  74         return peer;
  75     }
  76 
  77     private static Dragboard createDragboard(TKClipboard peer) {





  78         return new Dragboard(peer);
  79     }
  80 
  81     // PENDING_DOC_REVIEW
  82     /**
  83      * Sets the visual representation of data being transfered
  84      * in a drag and drop gesture.
  85      * Uses the given image for the drag view with the offsetX and offsetY
  86      * specifying cursor position over the image.
  87      * This method should be called only when starting drag and drop operation
  88      * in the DRAG_DETECTED handler, calling it at other times
  89      * doesn't have any effect.
  90      * @param image image to use for the drag view
  91      * @param offsetX x position of the cursor over the image
  92      * @param offsetY y position of the cursor over the image
  93      * @since JavaFX 8.0
  94      */
  95     public void setDragView(Image image, double offsetX, double offsetY) {
  96         peer.setDragView(image);
  97         peer.setDragViewOffsetX(offsetX);


 154      * @since JavaFX 8.0
 155      */
 156     public double getDragViewOffsetX() {
 157         return peer.getDragViewOffsetX();
 158     }
 159 
 160     /**
 161      * Gets the y position of the cursor of the drag view image.
 162      * This method returns meaningful value only when starting drag and drop
 163      * operation in the DRAG_DETECTED handler, it returns 0 at other times.
 164      * @return y position of the cursor over the image
 165      * @since JavaFX 8.0
 166      */
 167     public double getDragViewOffsetY() {
 168         return peer.getDragViewOffsetY();
 169     }
 170 
 171     static {
 172         // This is used by classes in different packages to get access to
 173         // private and package private methods.
 174         DragboardHelper.setDragboardAccessor(new DragboardHelper.DragboardAccessor() {
 175 
 176             @Override
 177             public void setDataAccessRestriction(Dragboard dragboard, boolean restricted) {
 178                 dragboard.dataAccessRestricted = restricted;
 179             }
 180 
 181             @Override
 182             public TKClipboard getPeer(Dragboard dragboard) {
 183                 return dragboard.getPeer();
 184             }
 185 
 186             @Override
 187             public Dragboard createDragboard(TKClipboard peer) {
 188                 return Dragboard.createDragboard(peer);
 189             }
 190         });
 191     }
 192 }
< prev index next >