summaryrefslogtreecommitdiff
path: root/cmpcj/src/de/schwarzrot/control/dnd/TreeSourceAndDestTransferHandler.java
diff options
context:
space:
mode:
authorgeronimo <geronimo013@gmx.de>2012-08-18 17:56:25 +0200
committergeronimo <geronimo013@gmx.de>2012-08-18 17:56:25 +0200
commit8a5e0576efd267ee9acb4e74bb482d3513eb0012 (patch)
tree05f677988a7a2dd6ba70683d287ef8b3c4137800 /cmpcj/src/de/schwarzrot/control/dnd/TreeSourceAndDestTransferHandler.java
parent4866f2c251513937ec7745eda248b5ee8e6d083b (diff)
downloadcmp-master.tar.gz
cmp-master.tar.bz2
worked out missing messages, extended delete genre support to non-empty genres, worked out dark color schemeHEADmaster
Diffstat (limited to 'cmpcj/src/de/schwarzrot/control/dnd/TreeSourceAndDestTransferHandler.java')
-rw-r--r--cmpcj/src/de/schwarzrot/control/dnd/TreeSourceAndDestTransferHandler.java26
1 files changed, 19 insertions, 7 deletions
diff --git a/cmpcj/src/de/schwarzrot/control/dnd/TreeSourceAndDestTransferHandler.java b/cmpcj/src/de/schwarzrot/control/dnd/TreeSourceAndDestTransferHandler.java
index 4c481f2..c61d943 100644
--- a/cmpcj/src/de/schwarzrot/control/dnd/TreeSourceAndDestTransferHandler.java
+++ b/cmpcj/src/de/schwarzrot/control/dnd/TreeSourceAndDestTransferHandler.java
@@ -37,9 +37,10 @@ import javax.swing.TransferHandler;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreePath;
import ca.odell.glazedlists.EventList;
-import de.schwarzrot.media.domain.AbstractMediaNode;
import de.schwarzrot.media.domain.Genre;
import de.schwarzrot.media.domain.Media;
+import de.schwarzrot.media.service.AbstractMediaChangeCommand;
+import de.schwarzrot.media.service.ChangeMediaCommand;
public class TreeSourceAndDestTransferHandler extends TransferHandler {
@@ -47,7 +48,7 @@ public class TreeSourceAndDestTransferHandler extends TransferHandler {
public TreeSourceAndDestTransferHandler(JTree tree, Map<File, DefaultMutableTreeNode> cache,
- EventList<AbstractMediaNode> changes) {
+ EventList<AbstractMediaChangeCommand> changes) {
this.tree = tree;
nodeCache = cache;
this.changes = changes;
@@ -123,7 +124,7 @@ public class TreeSourceAndDestTransferHandler extends TransferHandler {
refreshNodeCache();
if (!changes.contains(transfer)) {
changes.getReadWriteLock().writeLock().lock();
- changes.add(transfer);
+ changes.add(new ChangeMediaCommand(transfer));
changes.getReadWriteLock().writeLock().unlock();
}
} catch (Throwable t) {
@@ -178,11 +179,22 @@ public class TreeSourceAndDestTransferHandler extends TransferHandler {
if (transferMedia != null) {
transferMedia.setParent(targetGenre);
if (!changes.contains(transferMedia)) {
- changes.getReadWriteLock().writeLock().lock();
- changes.add(transferMedia);
- changes.getReadWriteLock().writeLock().unlock();
+ try {
+ changes.getReadWriteLock().writeLock().lock();
+ changes.add(new ChangeMediaCommand(transferMedia));
+ changes.getReadWriteLock().writeLock().unlock();
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
}
+ } else {
+ System.err.println("transfer media not found in genre medialist!");
}
+ } else {
+ if (targetGenre == null)
+ System.err.println("failed to determine target genre!");
+ if (node == null)
+ System.err.println("failed to determine source parent node of " + mediaPath.getAbsolutePath());
}
}
@@ -195,6 +207,6 @@ public class TreeSourceAndDestTransferHandler extends TransferHandler {
}
private JTree tree;
- private EventList<AbstractMediaNode> changes;
+ private EventList<AbstractMediaChangeCommand> changes;
private Map<File, DefaultMutableTreeNode> nodeCache;
}