diff options
author | geronimo <geronimo013@gmx.de> | 2012-08-15 19:36:18 +0200 |
---|---|---|
committer | geronimo <geronimo013@gmx.de> | 2012-08-15 19:36:18 +0200 |
commit | 7573668ef0324f4a5050be428b15e40f7fa61ac3 (patch) | |
tree | 3a2da0271bdb4ad1bc038edfa73a461dade4e5c5 /cmpcj | |
parent | 317c25c4fd88b2f7611f249b2ae73cf2aa80d051 (diff) | |
download | cmp-7573668ef0324f4a5050be428b15e40f7fa61ac3.tar.gz cmp-7573668ef0324f4a5050be428b15e40f7fa61ac3.tar.bz2 |
fixed dnd for media from table, fixed editing of genre to update real genre node
Diffstat (limited to 'cmpcj')
4 files changed, 66 insertions, 53 deletions
diff --git a/cmpcj/src/de/schwarzrot/control/app/CMPCJ.java b/cmpcj/src/de/schwarzrot/control/app/CMPCJ.java index 639d9fc..cd28f0a 100644 --- a/cmpcj/src/de/schwarzrot/control/app/CMPCJ.java +++ b/cmpcj/src/de/schwarzrot/control/app/CMPCJ.java @@ -98,6 +98,7 @@ import de.schwarzrot.control.dnd.TreeSourceAndDestTransferHandler; import de.schwarzrot.control.support.MediaTextFilterator; import de.schwarzrot.control.support.MediaTypeSelector; import de.schwarzrot.control.support.SelectedMedia; +import de.schwarzrot.control.support.TreeCellEditor; import de.schwarzrot.control.support.TreeSelectionFilter; import de.schwarzrot.control.table.MediaTableFormat; import de.schwarzrot.media.domain.AbstractMediaNode; @@ -469,8 +470,9 @@ public class CMPCJ extends WindowAdapter implements PropertyChangeListener, Succ }); tree.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "removeGenre"); //$NON-NLS-1$ tree.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, 0), "createGenre"); //$NON-NLS-1$ - tree.setDropMode(DropMode.USE_SELECTION); tree.setTransferHandler(new TreeSourceAndDestTransferHandler(tree, nodeCache, changes)); + tree.setDropMode(DropMode.USE_SELECTION); + tree.setCellEditor(new TreeCellEditor(tree, changes)); JScrollPane treeView = new JScrollPane(tree); return treeView; @@ -680,7 +682,7 @@ public class CMPCJ extends WindowAdapter implements PropertyChangeListener, Succ } } ApplicationServiceProvider.registerService(ActionManager.class, new ActionManager<Commands>()); - ApplicationServiceProvider.registerService(DataManager.class, new DataManager(input)); + ApplicationServiceProvider.registerService(DataManager.class, new DataManager(input, nodeCache)); ApplicationServiceProvider.registerService(ImageFactory.class, new ImageFactory()); ApplicationServiceProvider.registerService(MedialistParser.class, new MedialistParser()); diff --git a/cmpcj/src/de/schwarzrot/media/domain/AbstractMediaNode.java b/cmpcj/src/de/schwarzrot/media/domain/AbstractMediaNode.java index 573726c..95659aa 100644 --- a/cmpcj/src/de/schwarzrot/media/domain/AbstractMediaNode.java +++ b/cmpcj/src/de/schwarzrot/media/domain/AbstractMediaNode.java @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== * - * File: AbstractMediaNode.java - * Created: 13. June 2012, 04:57 - * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> - * Project: cmpc - a java frontend (client) part of compound media player - * uses external players to play the media + * File: AbstractMediaNode.java Created: 13. June 2012, 04:57 Author: <a + * href="mailto:geronimo013@gmx.de">Geronimo</a> Project: cmpc - a java frontend + * (client) part of compound media player uses external players to play the + * media * * CMP - compound media player * - * is a client/server mediaplayer intended to play any media from any workstation - * without the need to export or mount shares. cmps is an easy to use backend - * with a (ready to use) HTML-interface. Additionally the backend supports - * authentication via HTTP-digest authorization. - * cmpc is a client with vdr-like osd-menues. + * is a client/server mediaplayer intended to play any media from any + * workstation without the need to export or mount shares. cmps is an easy to + * use backend with a (ready to use) HTML-interface. Additionally the backend + * supports authentication via HTTP-digest authorization. cmpc is a client with + * vdr-like osd-menues. * - * Copyright (c) 2012 Reinhard Mantey, some rights reserved! - * published under Creative Commons by-sa - * For details see http://creativecommons.org/licenses/by-sa/3.0/ + * Copyright (c) 2012 Reinhard Mantey, some rights reserved! published under + * Creative Commons by-sa For details see + * http://creativecommons.org/licenses/by-sa/3.0/ * - * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp + * The cmp project's homepage is at + * http://projects.vdr-developer.org/projects/cmp * * -------------------------------------------------------------- */ @@ -143,6 +143,7 @@ public abstract class AbstractMediaNode implements Serializable, Comparable<Abst public void setName(String name) { this.name = name; properties.put(NAME_PROPERTY, name); + refresh(); } @@ -227,7 +228,7 @@ public abstract class AbstractMediaNode implements Serializable, Comparable<Abst protected void refresh() { if (parent != null && realPath != null) - realPath = new File(parent.getRealPath(), realPath.getName()); + realPath = new File(parent.getRealPath(), getName()); } diff --git a/cmpcj/src/de/schwarzrot/media/domain/Genre.java b/cmpcj/src/de/schwarzrot/media/domain/Genre.java index 5bbb463..b19c550 100644 --- a/cmpcj/src/de/schwarzrot/media/domain/Genre.java +++ b/cmpcj/src/de/schwarzrot/media/domain/Genre.java @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== * - * File: Genre.java - * Created: 13. June 2012, 04:57 - * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> - * Project: cmpc - a java frontend (client) part of compound media player - * uses external players to play the media + * File: Genre.java Created: 13. June 2012, 04:57 Author: <a + * href="mailto:geronimo013@gmx.de">Geronimo</a> Project: cmpc - a java frontend + * (client) part of compound media player uses external players to play the + * media * * CMP - compound media player * - * is a client/server mediaplayer intended to play any media from any workstation - * without the need to export or mount shares. cmps is an easy to use backend - * with a (ready to use) HTML-interface. Additionally the backend supports - * authentication via HTTP-digest authorization. - * cmpc is a client with vdr-like osd-menues. + * is a client/server mediaplayer intended to play any media from any + * workstation without the need to export or mount shares. cmps is an easy to + * use backend with a (ready to use) HTML-interface. Additionally the backend + * supports authentication via HTTP-digest authorization. cmpc is a client with + * vdr-like osd-menues. * - * Copyright (c) 2012 Reinhard Mantey, some rights reserved! - * published under Creative Commons by-sa - * For details see http://creativecommons.org/licenses/by-sa/3.0/ + * Copyright (c) 2012 Reinhard Mantey, some rights reserved! published under + * Creative Commons by-sa For details see + * http://creativecommons.org/licenses/by-sa/3.0/ * - * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp + * The cmp project's homepage is at + * http://projects.vdr-developer.org/projects/cmp * * -------------------------------------------------------------- */ @@ -70,6 +70,13 @@ public class Genre extends AbstractMediaNode { } + @Override + public void refresh() { + super.refresh(); + update(); + } + + public void removeGenre(Genre g) { children.remove(g); } @@ -108,12 +115,16 @@ public class Genre extends AbstractMediaNode { public void update() { // instances has moved, so all children and media members must be updated - for (Genre g : children) { - g.refresh(); - g.update(); + if (children != null) { + for (Genre g : children) { + g.refresh(); + g.update(); + } + } + if (mediaList != null) { + for (Media m : mediaList) + m.refresh(); } - for (Media m : mediaList) - m.refresh(); } private List<Media> mediaList; diff --git a/cmpcj/src/de/schwarzrot/media/service/DataManager.java b/cmpcj/src/de/schwarzrot/media/service/DataManager.java index 3d6940f..ce76934 100644 --- a/cmpcj/src/de/schwarzrot/media/service/DataManager.java +++ b/cmpcj/src/de/schwarzrot/media/service/DataManager.java @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== * - * File: DataManager.java - * Created: 13. June 2012, 04:57 - * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> - * Project: cmpc - a java frontend (client) part of compound media player - * uses external players to play the media + * File: DataManager.java Created: 13. June 2012, 04:57 Author: <a + * href="mailto:geronimo013@gmx.de">Geronimo</a> Project: cmpc - a java frontend + * (client) part of compound media player uses external players to play the + * media * * CMP - compound media player * - * is a client/server mediaplayer intended to play any media from any workstation - * without the need to export or mount shares. cmps is an easy to use backend - * with a (ready to use) HTML-interface. Additionally the backend supports - * authentication via HTTP-digest authorization. - * cmpc is a client with vdr-like osd-menues. + * is a client/server mediaplayer intended to play any media from any + * workstation without the need to export or mount shares. cmps is an easy to + * use backend with a (ready to use) HTML-interface. Additionally the backend + * supports authentication via HTTP-digest authorization. cmpc is a client with + * vdr-like osd-menues. * - * Copyright (c) 2012 Reinhard Mantey, some rights reserved! - * published under Creative Commons by-sa - * For details see http://creativecommons.org/licenses/by-sa/3.0/ + * Copyright (c) 2012 Reinhard Mantey, some rights reserved! published under + * Creative Commons by-sa For details see + * http://creativecommons.org/licenses/by-sa/3.0/ * - * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp + * The cmp project's homepage is at + * http://projects.vdr-developer.org/projects/cmp * * -------------------------------------------------------------- */ @@ -27,7 +27,6 @@ package de.schwarzrot.media.service; import java.io.File; -import java.util.HashMap; import java.util.Map; import java.util.Stack; import javax.swing.SwingUtilities; @@ -43,9 +42,9 @@ import de.schwarzrot.media.util.ListLoader; public class DataManager implements Runnable, ElementConsumer<Media> { - public DataManager(File input) { + public DataManager(File input, Map<File, DefaultMutableTreeNode> cache) { this.input = input; - nodeCache = new HashMap<File, DefaultMutableTreeNode>(); + nodeCache = cache; } |