|
Extension SDK 10.1.2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.javatools.editor.plugins.DropTargetPlugin oracle.javatools.editor.plugins.DragDropPlugin
The DragDropPlugin
is an editor plugin which extends
the DropTargetPlugin
to support full Drag-N-Drop
functionality for the BasicEditorPane
.
Nested Class Summary | |
protected class |
DragDropPlugin.DragCaret
The DragCaret class extends the editor caret
implementation to support the initiation of dragging without
moving the cursor. |
protected class |
DragDropPlugin.DragTransferable
The DragTransferable class provides extra
information like the editor and offset where the data comes from. |
Field Summary | |
protected static EditDescriptor |
DRAG_DESCRIPTOR
The edit (undo) descriptor for a drag operation. |
protected static EditDescriptor |
DRAGDROP_DESCRIPTOR
The edit (undo) descriptor for a drag and drop operation within the same editor. |
protected boolean |
dragInProgress
Whether a drag operation was actually started. |
protected java.awt.dnd.DragGestureRecognizer |
dragRecognizer
The drag gesture recognizer associated with this editor. |
protected int |
dropOffset
The offset where the drop occurred. |
protected boolean |
focusWasGained
Whether the focus was just gained. |
protected javax.swing.text.Caret |
originalCaret
Preserve the old caret that was used before the Drag plugin was installed. |
protected static java.awt.datatransfer.DataFlavor |
OUR_FLAVOR
Our custom data flavor which has extra information, like the editor and offset info. |
protected boolean |
queuedPopupTrigger
Whether an "isPopupTrigger = true" from a mousePressed has been queued due to us eating the mousePressed for drag and drop. |
protected boolean |
selectionClicked
Whether the current mouse press occurred in a selection. |
Fields inherited from class oracle.javatools.editor.plugins.DropTargetPlugin |
DROP_DESCRIPTOR, DROP_RECT_WIDTH, dropTarget, editor, lastDropRect, PLAIN_FLAVOR, STRING_FLAVOR |
Constructor Summary | |
DragDropPlugin()
Constructs a new DragDropPlugin instance that
adds drag-n-drop capability to the editor. |
Method Summary | |
protected void |
cancelDragEvent(java.awt.dnd.DragSourceEvent event)
Utility method to handle the case where the drag cursor has exited a viable DropTarget - note that this does not mean that the drag operation has been cancelled completely though. |
void |
deinstall(BasicEditorPane editor)
Called when the plugin is being removed from the BasicEditorPane (for example when the editor is closed.) This is used to notify plugins that they should unregister any listeners that were attached. |
protected void |
deinstallDragCaret()
Utility method to swap out our custom drag caret when this plugin is deinstalled. |
void |
dragDropEnd(java.awt.dnd.DragSourceDropEvent event)
This method is invoked to signify that the Drag and Drop operation is complete. |
void |
dragEnter(java.awt.dnd.DragSourceDragEvent event)
Called as the hotspot enters a platform dependent drop site. |
void |
dragExit(java.awt.dnd.DragSourceEvent event)
Called as the hotspot exits a platform dependent drop site. |
void |
dragGestureRecognized(java.awt.dnd.DragGestureEvent event)
A DragGestureRecognizer has detected a
platform-dependent drag initiating gesture and is notifying this
listener in order for it to initiate the action for the user. |
void |
dragOver(java.awt.dnd.DragSourceDragEvent event)
Called as the hotspot moves over a platform dependent drop site. |
void |
dropActionChanged(java.awt.dnd.DragSourceDragEvent event)
Called when the user has modified the drop gesture. |
protected void |
exchangeCaret(javax.swing.text.Caret oldCaret,
javax.swing.text.Caret newCaret)
Utility method to swap editor carets. |
protected void |
handleDragEvent(java.awt.dnd.DragSourceDragEvent event)
Utility method to handle the various drag events that occur on the DragSource side before the actual drop occurs. |
protected void |
handleDropEvent(java.awt.dnd.DragSourceDropEvent event)
Utility method to handle the actual drop event for the DragSource side of things. |
protected void |
handleDropEvent(java.awt.dnd.DropTargetDropEvent event)
Utility method to handle the actual drop event that occurred. |
void |
install(BasicEditorPane editor)
Called when this plugin is being installed into the BasicEditorPane. |
protected void |
installDragCaret()
Utility method to install and swap in our custom drag caret to support drag functionality. |
void |
propertyChange(java.beans.PropertyChangeEvent event)
This method gets called when a bound property is changed. |
protected void |
removeSelectedText()
Utility method to remove the selected text of editor. |
protected void |
updateDragCursor(java.awt.dnd.DragSourceEvent event,
int dropAction)
Utility method to update the drag cursor based on the given event. |
Methods inherited from class oracle.javatools.editor.plugins.DropTargetPlugin |
cancelDragEvent, clearDropLocation, dragEnter, dragExit, dragOver, drop, dropActionChanged, getDocument, getDropRectangle, getPreferredDataFlavor, getSupportedFlavors, getTransferText, handleDragEvent, isDataFlavorSupported, isDataFlavorSupported, isDropActionSupported, paintDropLocation |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected javax.swing.text.Caret originalCaret
protected java.awt.dnd.DragGestureRecognizer dragRecognizer
protected boolean selectionClicked
protected boolean queuedPopupTrigger
protected boolean dragInProgress
protected int dropOffset
protected static final EditDescriptor DRAG_DESCRIPTOR
protected static final EditDescriptor DRAGDROP_DESCRIPTOR
protected boolean focusWasGained
protected static final java.awt.datatransfer.DataFlavor OUR_FLAVOR
Constructor Detail |
public DragDropPlugin()
DragDropPlugin
instance that
adds drag-n-drop capability to the editor.
Method Detail |
public void install(BasicEditorPane editor)
install
in interface EditorPlugin
install
in class DropTargetPlugin
editor
- the editor panepublic void deinstall(BasicEditorPane editor)
deinstall
in interface EditorPlugin
deinstall
in class DropTargetPlugin
editor
- the editor paneprotected void installDragCaret()
protected void deinstallDragCaret()
protected void exchangeCaret(javax.swing.text.Caret oldCaret, javax.swing.text.Caret newCaret)
oldCaret
- the old caret that is currently in the editornewCaret
- the new caret to be installed into the editorpublic void propertyChange(java.beans.PropertyChangeEvent event)
propertyChange
in interface java.beans.PropertyChangeListener
propertyChange
in class DropTargetPlugin
event
- A PropertyChangeEvent object describing the event source
and the property that has changed.public void dragGestureRecognized(java.awt.dnd.DragGestureEvent event)
DragGestureRecognizer
has detected a
platform-dependent drag initiating gesture and is notifying this
listener in order for it to initiate the action for the user.
dragGestureRecognized
in interface java.awt.dnd.DragGestureListener
event
- the event describing the gesture that has just occurredpublic void dragEnter(java.awt.dnd.DragSourceDragEvent event)
dragEnter
in interface java.awt.dnd.DragSourceListener
event
- the drag source eventpublic void dragOver(java.awt.dnd.DragSourceDragEvent event)
dragOver
in interface java.awt.dnd.DragSourceListener
event
- the drag source eventpublic void dropActionChanged(java.awt.dnd.DragSourceDragEvent event)
dropActionChanged
in interface java.awt.dnd.DragSourceListener
event
- the drag source eventpublic void dragExit(java.awt.dnd.DragSourceEvent event)
dragExit
in interface java.awt.dnd.DragSourceListener
event
- the drag source eventpublic void dragDropEnd(java.awt.dnd.DragSourceDropEvent event)
dragDropEnd
in interface java.awt.dnd.DragSourceListener
event
- the drag source eventprotected void handleDragEvent(java.awt.dnd.DragSourceDragEvent event)
event
- the event that occurredprotected void cancelDragEvent(java.awt.dnd.DragSourceEvent event)
event
- the drag event that occurredprotected void handleDropEvent(java.awt.dnd.DragSourceDropEvent event)
event
- the actual drop event that occurredprotected void removeSelectedText()
protected void handleDropEvent(java.awt.dnd.DropTargetDropEvent event)
handleDropEvent
in class DropTargetPlugin
event
- the actual drop event that occurredprotected void updateDragCursor(java.awt.dnd.DragSourceEvent event, int dropAction)
event
- the event that occurreddropAction
- the current drop action
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.