< prev index next >

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

Print this page
rev 10598 : 8185767: Fix broken links in Javadocs


 263 
 264     /**
 265      * This event occurs when drag gesture progresses within this node.
 266      */
 267     public static final EventType<DragEvent> DRAG_OVER =
 268             new EventType<DragEvent>(DragEvent.ANY, "DRAG_OVER");
 269 
 270     // Do we want DRAG_TRANSFER_MODE_CHANGED event?
 271 //    /**
 272 //     * This event occurs on a potential drag-and-drop target when the user
 273 //     * takes action to change the intended {@code TransferMode}.
 274 //     * The user can change the intended {@link TransferMode} by holding down
 275 //     * or releasing key modifiers.
 276 //     */
 277 //    public static final EventType<DragEvent> DRAG_TRANSFER_MODE_CHANGED =
 278 //            new EventType<DragEvent>(DragEvent.ANY, "DRAG_TRANSFER_MODE_CHANGED");
 279 
 280     /**
 281      * This event occurs when the mouse button is released during drag and drop
 282      * gesture on a drop target. Transfer of data from the
 283      * {@link DragEvent}'s {@link DragEvent#dragboard dragboard} should happen
 284      * in handler of this event.
 285      */
 286     public static final EventType<DragEvent> DRAG_DROPPED =
 287             new EventType<DragEvent>(DragEvent.ANY, "DRAG_DROPPED");
 288 
 289     /**
 290      * This event occurs on drag-and-drop gesture source after its data has
 291      * been dropped on a drop target. The {@code transferMode} of the
 292      * event shows what just happened at the drop target.
 293      * If {@code transferMode} has the value {@code MOVE}, then the source can
 294      * clear out its data. Clearing the source's data gives the appropriate
 295      * appearance to a user that the data has been moved by the drag and drop
 296      * gesture. A {@code transferMode} that has the value {@code NONE}
 297      * indicates that no data was transferred during the drag and drop gesture.
 298      */
 299     public static final EventType<DragEvent> DRAG_DONE =
 300             new EventType<DragEvent>(DragEvent.ANY, "DRAG_DONE");
 301 
 302     /**
 303      * Creates a copy of the given drag event with the given fields substituted.


 710             state.accepted = false;
 711             return;
 712         }
 713 
 714         TransferMode tm = chooseTransferMode(dragboard.getTransferModes(),
 715                 transferModes, transferMode);
 716 
 717         if (tm == null && getEventType() == DRAG_DROPPED) {
 718             throw new IllegalStateException("Accepting unsupported transfer "
 719                     + "modes inside DRAG_DROPPED handler");
 720         }
 721 
 722         state.accepted = tm != null;
 723         state.acceptedTransferMode = tm;
 724         state.acceptingObject = state.accepted ? source : null;
 725     }
 726 
 727     /**
 728      * Indicates that transfer handling of this {@code DragEvent} was completed
 729      * successfully during a {@code DRAG_DROPPED} event handler.
 730      * No {@link #dragboard} access can happen after this call.
 731      *
 732      * @param isTransferDone {@code true} indicates that the transfer was successful.
 733      * @throws IllegalStateException if this is not a DRAG_DROPPED event
 734      */
 735     public void setDropCompleted(boolean isTransferDone) {
 736         if (getEventType() != DRAG_DROPPED) {
 737             throw new IllegalStateException("setDropCompleted can be called " +
 738                     "only from DRAG_DROPPED handler");
 739         }
 740 
 741         state.dropCompleted = isTransferDone;
 742     }
 743 
 744     /**
 745      * Whether {@code setDropCompleted(true)} has been called on this event.
 746      * @return true if {@code setDropCompleted(true)} has been called
 747      */
 748     public boolean isDropCompleted() {
 749         return state.dropCompleted;
 750     }




 263 
 264     /**
 265      * This event occurs when drag gesture progresses within this node.
 266      */
 267     public static final EventType<DragEvent> DRAG_OVER =
 268             new EventType<DragEvent>(DragEvent.ANY, "DRAG_OVER");
 269 
 270     // Do we want DRAG_TRANSFER_MODE_CHANGED event?
 271 //    /**
 272 //     * This event occurs on a potential drag-and-drop target when the user
 273 //     * takes action to change the intended {@code TransferMode}.
 274 //     * The user can change the intended {@link TransferMode} by holding down
 275 //     * or releasing key modifiers.
 276 //     */
 277 //    public static final EventType<DragEvent> DRAG_TRANSFER_MODE_CHANGED =
 278 //            new EventType<DragEvent>(DragEvent.ANY, "DRAG_TRANSFER_MODE_CHANGED");
 279 
 280     /**
 281      * This event occurs when the mouse button is released during drag and drop
 282      * gesture on a drop target. Transfer of data from the
 283      * {@link DragEvent}'s {@link DragEvent#getDragboard() dragboard} should happen
 284      * in handler of this event.
 285      */
 286     public static final EventType<DragEvent> DRAG_DROPPED =
 287             new EventType<DragEvent>(DragEvent.ANY, "DRAG_DROPPED");
 288 
 289     /**
 290      * This event occurs on drag-and-drop gesture source after its data has
 291      * been dropped on a drop target. The {@code transferMode} of the
 292      * event shows what just happened at the drop target.
 293      * If {@code transferMode} has the value {@code MOVE}, then the source can
 294      * clear out its data. Clearing the source's data gives the appropriate
 295      * appearance to a user that the data has been moved by the drag and drop
 296      * gesture. A {@code transferMode} that has the value {@code NONE}
 297      * indicates that no data was transferred during the drag and drop gesture.
 298      */
 299     public static final EventType<DragEvent> DRAG_DONE =
 300             new EventType<DragEvent>(DragEvent.ANY, "DRAG_DONE");
 301 
 302     /**
 303      * Creates a copy of the given drag event with the given fields substituted.


 710             state.accepted = false;
 711             return;
 712         }
 713 
 714         TransferMode tm = chooseTransferMode(dragboard.getTransferModes(),
 715                 transferModes, transferMode);
 716 
 717         if (tm == null && getEventType() == DRAG_DROPPED) {
 718             throw new IllegalStateException("Accepting unsupported transfer "
 719                     + "modes inside DRAG_DROPPED handler");
 720         }
 721 
 722         state.accepted = tm != null;
 723         state.acceptedTransferMode = tm;
 724         state.acceptingObject = state.accepted ? source : null;
 725     }
 726 
 727     /**
 728      * Indicates that transfer handling of this {@code DragEvent} was completed
 729      * successfully during a {@code DRAG_DROPPED} event handler.
 730      * No {@link #getDragboard() dragboard} access can happen after this call.
 731      *
 732      * @param isTransferDone {@code true} indicates that the transfer was successful.
 733      * @throws IllegalStateException if this is not a DRAG_DROPPED event
 734      */
 735     public void setDropCompleted(boolean isTransferDone) {
 736         if (getEventType() != DRAG_DROPPED) {
 737             throw new IllegalStateException("setDropCompleted can be called " +
 738                     "only from DRAG_DROPPED handler");
 739         }
 740 
 741         state.dropCompleted = isTransferDone;
 742     }
 743 
 744     /**
 745      * Whether {@code setDropCompleted(true)} has been called on this event.
 746      * @return true if {@code setDropCompleted(true)} has been called
 747      */
 748     public boolean isDropCompleted() {
 749         return state.dropCompleted;
 750     }


< prev index next >