AuthorDnDListener - multiple DropTargetDropEvent managment
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 240
- Joined: Wed Jun 17, 2015 12:46 pm
AuthorDnDListener - multiple DropTargetDropEvent managment
Hi,
In my application I need to drag'n drop a swing object to an oxygen XML document. I'm using an ro.sync.exml.editor.xmleditor.pageauthor.AuthorDnDListener to catch the drop action with the authorDrop(Transferable transferable, DropTargetDropEvent dropTargetDropEvent) method. It works perfectly.
My issue is that when I drop my object to my XML document, I have to write different actions according to the drag'n drop :
- "normal" drag'n drop
- drag'n drop + CTRL
- drag'n drop + ALT etc..
I succeeded in catching "normal" and "CTRL" drag'n drop with the DropTargetDropEvent :
- "normal" drag'n drop => dropTargetDropEvent.getDropAction() = 2
- drag'n drop + CTRL => dropTargetDropEvent.getDropAction() = 1
But these are the only different drag'n drops I differentiate.
How can I have other drag'n drops ? Is it possible ? Are there options somewhere ?
Thanks for your help,
Johann
In my application I need to drag'n drop a swing object to an oxygen XML document. I'm using an ro.sync.exml.editor.xmleditor.pageauthor.AuthorDnDListener to catch the drop action with the authorDrop(Transferable transferable, DropTargetDropEvent dropTargetDropEvent) method. It works perfectly.
My issue is that when I drop my object to my XML document, I have to write different actions according to the drag'n drop :
- "normal" drag'n drop
- drag'n drop + CTRL
- drag'n drop + ALT etc..
I succeeded in catching "normal" and "CTRL" drag'n drop with the DropTargetDropEvent :
- "normal" drag'n drop => dropTargetDropEvent.getDropAction() = 2
- drag'n drop + CTRL => dropTargetDropEvent.getDropAction() = 1
But these are the only different drag'n drops I differentiate.
How can I have other drag'n drops ? Is it possible ? Are there options somewhere ?
Thanks for your help,
Johann
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: AuthorDnDListener - multiple DropTargetDropEvent managme
Hi Johann,
I think that the only official modifiers for DND are Ctrl and Shift. For example if you press Ctrl+Shift and drag you should receive on the getDropAction() a java.awt.dnd.DnDConstants.ACTION_LINK value.
So the Swing drop event does not seem to be able to tell you if the ALT key is pressed when the drag is done.
Possibly you could add a static listener (a static block in your class) which listens for all key events in the application:
and if the last key event has the ALT DOWN modifier consider that the drag and drop is done using that.
Regards,
Radu
I think that the only official modifiers for DND are Ctrl and Shift. For example if you press Ctrl+Shift and drag you should receive on the getDropAction() a java.awt.dnd.DnDConstants.ACTION_LINK value.
So the Swing drop event does not seem to be able to tell you if the ALT key is pressed when the drag is done.
Possibly you could add a static listener (a static block in your class) which listens for all key events in the application:
Code: Select all
Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
@Override
public void eventDispatched(AWTEvent ev) {
if (ev.getClass() == KeyEvent.class) {
............
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 240
- Joined: Wed Jun 17, 2015 12:46 pm
Re: AuthorDnDListener - multiple DropTargetDropEvent managme
Hi Radu,
You were right about the official modifiers. These are CTRL and SHIFT.
I was able to detect only CTRL because my swing source forced SourceActions at COPY_OR_MOVE.
I put COPY | MOVE | LINK instead. Now I'm able to detect CTRL+SHIFT when the drag is done which suits me perfectly. The ALT key was not mandatory.
Thanks for your response,
Johann
You were right about the official modifiers. These are CTRL and SHIFT.
I was able to detect only CTRL because my swing source forced SourceActions at COPY_OR_MOVE.
I put COPY | MOVE | LINK instead. Now I'm able to detect CTRL+SHIFT when the drag is done which suits me perfectly. The ALT key was not mandatory.
Thanks for your response,
Johann
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service