Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / February 2005

Tip: Looking for answers? Try searching our database.

native topic names and Drag and Drop Flavors - How?

Thread view: 
Thomas Strauss - 11 Sep 2004 13:40 GMT
Hi,

I try to accept a native drop from eg MS Outlook or the CardScan business
card scanning application.

But my problem is that I can only choose between a multitude of text/plain
flavors and (in the case of the cardscan app) an image type.

I think that the problem ist the flavormap.properties file, where I have to
map topic names to mime types and classes. The more special topics Outlook
Contact and VCard are not part of the file.

How can I find out, which topic names arrive at my application, so that I
can create the flavormap?

Any help appreciated,

Best regards,

       Thomas

- --
Thomas Strauß, located in Frankfurt, Germany
Alexander Ames - 13 Sep 2004 02:36 GMT
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
[quoted text clipped - 19 lines]
>
>        Thomas

Isn't it just the file extension?
Thomas Strauss - 13 Sep 2004 20:01 GMT
>>How can I find out, which topic names arrive at my application, so that I
>>can create the flavormap?
[quoted text clipped - 6 lines]
>
> Isn't it just the file extension?

Interesting approach, I don't think it will work, but I will try that.

Thanks,
 Thomas

- --
Thomas Strauß - Java Programming in unusual Places
Thomas Strauss - 13 Sep 2004 23:12 GMT
>>>How can I find out, which topic names arrive at my application, so that I
>>>can create the flavormap?

Hi Folks,

I finally did it! I managed to receive dataformats that are not part of the
default flavormap.properties.

My problem was, that I could not identify the name of the datatype in the
Windows clipboard. Since I didnt know the name I couldnt setup a flavormap.

Attached, you find a small utility, which dumps the current
content-type-names of the system-clipboard.

HowTo:

1- compile the cpp-code
2- copy the data you want to identify into clipboard
3- run the cpp-app

output should be sth like this (Outlook 2002 eMail in clipboard)

Clipboard contents:
Format 49161 is DataObject
Format 49694 is RenPrivateSourceFolder
Format 49695 is RenPrivateMessages
Format 49315 is FileGroupDescriptor
Format 49314 is FileContents
Format 49166 is Object Descriptor
Format 1 is
Format 49171 is Ole Private Data
Format 16 is
Format 7 is
Format 13 is

4- register the content type you want as DataFlavor in SystemFlavorMap:
       SystemFlavorMap sfm =
               (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap();

       try {
               sfm.setFlavorsForNative("FileContents", new DataFlavor[]{
                       new DataFlavor("text/x-mail; class=java.io.InputStream")
               });
       }
       catch (ClassNotFoundException e) {
               // TODO Auto-generated catch block
               String aMsg = e.getMessage();
               e.printStackTrace();
       }

5- In a drop, you will receive the data from the clipboard offered as the
mimetype you registered for your new dataflavor (text/x-mail in this case)

That's it!

Happy Coding,


 Thomas

PS: If you require the CPP executable, mail me.

- --
Thomas Strauß - Java Programming in unusual Places
Maria De Piano - 23 Feb 2005 10:13 GMT
Thomas,

Is it possible to get the CPP executable?

Regards,
Maria


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.