|
From: Alexander S. <as...@us...> - 2006-07-24 11:57:17
|
Update of /cvsroot/jxtaim/jxtaim/src/vsis/im/model In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22636/src/vsis/im/model Modified Files: Buddy.java Log Message: Make buddy a good dnd droppable. It now presents itself with its profile adv id URL. This is the start to add buddies by link Index: Buddy.java =================================================================== RCS file: /cvsroot/jxtaim/jxtaim/src/vsis/im/model/Buddy.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Buddy.java 13 Nov 2005 17:50:09 -0000 1.9 --- Buddy.java 24 Jul 2006 11:57:14 -0000 1.10 *************** *** 33,36 **** --- 33,40 ---- import java.util.Vector; + import java.awt.datatransfer.DataFlavor; + import java.awt.datatransfer.Transferable; + import java.awt.datatransfer.UnsupportedFlavorException; + import java.io.IOException; import java.io.Serializable; import java.security.PublicKey; *************** *** 52,56 **** * @version $Revision$ */ ! public class Buddy implements Serializable { static final Logger log = Logger.getLogger(Buddy.class);; static final long serialVersionUID = 8121364880227432880L; --- 56,60 ---- * @version $Revision$ */ ! public class Buddy implements Serializable, Transferable { static final Logger log = Logger.getLogger(Buddy.class);; static final long serialVersionUID = 8121364880227432880L; *************** *** 344,347 **** --- 348,375 ---- } + public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { + if(flavor.equals(DataFlavor.stringFlavor)) + return getProfileAdv().getID().toURI().toString(); + return null; + } + + public DataFlavor[] getTransferDataFlavors() { + return new DataFlavor[] { DataFlavor.stringFlavor }; + } + + public boolean isDataFlavorSupported(DataFlavor flavor) { + if(flavor.equals(DataFlavor.stringFlavor)) + return true; + return false; + } + + @Override + public String toString() + { + if(getProfileAdv() == null) + return super.toString(); + + return getProfileAdv().getID().toURI().toString(); + } } |