16 package net.squiz.matrix.ui;
18 import java.awt.datatransfer.*;
19 import net.squiz.matrix.matrixtree.MatrixTreeTransferable;
22 import javax.swing.tree.*;
28 private static boolean inExchange =
false;
34 throw new IllegalStateException(
"There is already an exchange open by " + dragSource.getClass());
42 throw new IllegalStateException(
"There is no exchange open");
48 throw new IllegalStateException(
"There is no exchange open");
52 public static TreePath[] getDragPaths() {
54 throw new IllegalStateException(
"There is no exchange open");
55 java.util.List paths = null;
57 paths = (java.util.List) transfer.getTransferData(
59 }
catch (UnsupportedFlavorException ufe) {
61 ufe.printStackTrace();
62 }
catch (java.io.IOException ioe) {
64 ioe.printStackTrace();
66 return (TreePath[]) paths.toArray(
new TreePath[paths.size()]);
69 public static Image translateImage(
Draggable draggable) {
71 throw new IllegalStateException(
"There is no exchange open");
72 TreePath[] pathsArr = getDragPaths();
74 return draggable.getDragImage(pathsArr);
77 public static void completeExchange() {
79 throw new IllegalStateException(
"There is no exchange open");