Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

x-app dragging of private data flavors



I'm trying to implement a plugin for a pure Java (Swing) application. The plugin modifies the behavior of one of the host windows by allowing it to accept private data flavors dragged from a native app.

The plugin works fine on Windows, but not on OSX (Java 1.4.2_05)... Adding private DataFlavor(s) to the SystemFlavorMap doesn't work. putting appropriate mappings directly into the flavormap.properties (or a separate file pointed to by the AWT.DnD.flavorMapFileURL property) seems to have no effect, either.

Various posts on this list indicate it's a well known problem, so it's time for me to look for the solution elsewhere - including the Cocoa API...

Well, getting data from the general pasteboard (clipboard) is a breeze, but the default drag pasteboard is not being used for inter-app dnd - so something like this won't work:

// java.awt.dnd.DropTarget
public void dragEnter (DropTargetDragEvent evt) {
NSPasteboard pb = NSPasteboard.pasteboardWithName(NSPasteboard.DragPboard);
int count = pb.types().count(); // returns 0
}


Presumably, a custom responder added at the end of the window's responder chain can be notified of the drag events and get passed a reference to the pasteboard... But this doesn't seem to be happening here - my NSDraggingDestination subclass receives mouse events, but none of the draggingEntered/Exited/etc. methods get called.

So here are the questions:

1. Can a private data flavor dropped from a native app be accessed without resorting to Cocoa or JNI/Carbon?

2. If Cocoa is the only answer, how can the dragged data be accessed from a pure java app?

3. Also, what correponding mime format should used for identifying native 'XXXX' flavor in Java 1.4.2 on OSX?

	Cocoa:      "CorePasteboardFlavorType 0x58585858"
	Java 1.3: 	 "application/x-mac-ostype-58585858"
	Java 1.4:    ????


Thanks in advance, alex

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.