summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgeronimo <geronimo013@gmx.de>2012-08-16 07:47:55 (GMT)
committergeronimo <geronimo013@gmx.de>2012-08-16 07:47:55 (GMT)
commit301f77acdd559f0a5acb5d6750e025c4bd195b82 (patch)
tree071ec43d81f101b7beb720767b3f0ee098754004
parent7573668ef0324f4a5050be428b15e40f7fa61ac3 (diff)
downloadcmp-301f77acdd559f0a5acb5d6750e025c4bd195b82.tar.gz
cmp-301f77acdd559f0a5acb5d6750e025c4bd195b82.tar.bz2
fixed revoke of config dialog, and genre editing, improved visual consistency
-rw-r--r--cmpcj/res/de/schwarzrot/control/app/lang/messages.properties2
-rw-r--r--cmpcj/res/de/schwarzrot/control/app/lang/messages_de.properties2
-rw-r--r--cmpcj/src/de/schwarzrot/base/util/AbstractDialog.java42
-rw-r--r--cmpcj/src/de/schwarzrot/control/app/CMPCJ.java2
-rw-r--r--cmpcj/src/de/schwarzrot/control/config/ConfigDialog.java76
-rw-r--r--cmpcj/src/de/schwarzrot/control/config/ConfigFactory.java35
-rw-r--r--cmpcj/src/de/schwarzrot/control/dnd/ListSelectionSourceTransferHandler.java31
-rw-r--r--cmpcj/src/de/schwarzrot/control/dnd/TreeSourceAndDestTransferHandler.java40
-rw-r--r--cmpcj/src/de/schwarzrot/control/support/TreeCellEditor.java52
-rw-r--r--cmpcj/src/de/schwarzrot/media/domain/MediaServer.java41
-rw-r--r--cmpcj/src/de/schwarzrot/media/domain/PlayerDefinition.java43
11 files changed, 266 insertions, 100 deletions
diff --git a/cmpcj/res/de/schwarzrot/control/app/lang/messages.properties b/cmpcj/res/de/schwarzrot/control/app/lang/messages.properties
index b3a5f8d..963b1a1 100644
--- a/cmpcj/res/de/schwarzrot/control/app/lang/messages.properties
+++ b/cmpcj/res/de/schwarzrot/control/app/lang/messages.properties
@@ -63,6 +63,8 @@ Commands.HelpAbout.long.desc=long: about
ConfigDialog.title=Preferences
ConfigDialog.Approve=OK
ConfigDialog.Cancel=Cancel
+ConfigDialog.servers=known servers
+ConfigDialog.players=player definitions
ServerDefinitionTableFormat.col0=Hostname
ServerDefinitionTableFormat.col1=Port
PlayerDefinitionTableFormat.col0=Mediatype
diff --git a/cmpcj/res/de/schwarzrot/control/app/lang/messages_de.properties b/cmpcj/res/de/schwarzrot/control/app/lang/messages_de.properties
index 6cad2a1..0e45d5e 100644
--- a/cmpcj/res/de/schwarzrot/control/app/lang/messages_de.properties
+++ b/cmpcj/res/de/schwarzrot/control/app/lang/messages_de.properties
@@ -63,6 +63,8 @@ Commands.HelpAbout.long.desc=Lang: Über
ConfigDialog.title=Einstellungen
ConfigDialog.Approve=OK
ConfigDialog.Cancel=Abbrechen
+ConfigDialog.servers=Medien-Server
+ConfigDialog.players=Spieler-Einstellungen
ServerDefinitionTableFormat.col0=Medienserver
ServerDefinitionTableFormat.col1=Port
PlayerDefinitionTableFormat.col0=Medien-Typ
diff --git a/cmpcj/src/de/schwarzrot/base/util/AbstractDialog.java b/cmpcj/src/de/schwarzrot/base/util/AbstractDialog.java
index 80fed51..e51b46d 100644
--- a/cmpcj/src/de/schwarzrot/base/util/AbstractDialog.java
+++ b/cmpcj/src/de/schwarzrot/base/util/AbstractDialog.java
@@ -1,25 +1,25 @@
/**
* ======================== legal notice ======================
*
- * File: AbstractDialog.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: AbstractDialog.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,6 +27,7 @@ package de.schwarzrot.base.util;
import java.awt.BorderLayout;
+import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Window;
import java.awt.event.ActionEvent;
@@ -57,7 +58,6 @@ public abstract class AbstractDialog extends JDialog {
setTitle(msgBundle.getMessage(getClass().getSimpleName() + ".title"));
this.dialogMode = dialogMode;
this.buttonOrientation = buttonOrientation;
- msgBundle = ApplicationServiceProvider.getService(MessageBundle.class);
}
@@ -137,6 +137,10 @@ public abstract class AbstractDialog extends JDialog {
getContentPane().add(createContentPane(), BorderLayout.CENTER);
getContentPane().add(createButtons(), BorderLayout.SOUTH);
pack();
+ if (fixedSize != null) {
+ setSize(fixedSize);
+ setResizable(false);
+ }
setLocationRelativeTo(parent);
setVisible(true);
dispose();
@@ -167,8 +171,14 @@ public abstract class AbstractDialog extends JDialog {
protected void performReset() {
}
- protected MessageBundle msgBundle;
+
+ protected void setFixedSize(Dimension size) {
+ fixedSize = size;
+ }
+
+ protected final MessageBundle msgBundle;
private int result = CLOSE_OPTION;
+ private Dimension fixedSize;
private DialogMode dialogMode;
private Orientation buttonOrientation;
}
diff --git a/cmpcj/src/de/schwarzrot/control/app/CMPCJ.java b/cmpcj/src/de/schwarzrot/control/app/CMPCJ.java
index cd28f0a..9dc2158 100644
--- a/cmpcj/src/de/schwarzrot/control/app/CMPCJ.java
+++ b/cmpcj/src/de/schwarzrot/control/app/CMPCJ.java
@@ -69,6 +69,7 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeModel;
import bibliothek.gui.dock.common.CControl;
import bibliothek.gui.dock.common.CGrid;
+import bibliothek.gui.dock.common.theme.ThemeMap;
import ca.odell.glazedlists.BasicEventList;
import ca.odell.glazedlists.EventList;
import ca.odell.glazedlists.FilterList;
@@ -223,6 +224,7 @@ public class CMPCJ extends WindowAdapter implements PropertyChangeListener, Succ
JMenuBar menuBar = new JMenuBar();
frame = new JFrame(mb.getMessage(CMPMessageBundle.MCC_7));
control = new CControl(frame);
+ control.setTheme(ThemeMap.KEY_ECLIPSE_THEME);
frame.addWindowListener(this);
frame.add(setupPerspective(frame));
frame.setJMenuBar(menuBar);
diff --git a/cmpcj/src/de/schwarzrot/control/config/ConfigDialog.java b/cmpcj/src/de/schwarzrot/control/config/ConfigDialog.java
index 4bc71c7..923a8c9 100644
--- a/cmpcj/src/de/schwarzrot/control/config/ConfigDialog.java
+++ b/cmpcj/src/de/schwarzrot/control/config/ConfigDialog.java
@@ -26,20 +26,29 @@
package de.schwarzrot.control.config;
+import java.awt.Dimension;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
+import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import javax.swing.AbstractAction;
import javax.swing.JComponent;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.KeyStroke;
+import javax.swing.ListSelectionModel;
+import bibliothek.gui.dock.common.CControl;
+import bibliothek.gui.dock.common.CGrid;
+import bibliothek.gui.dock.common.theme.ThemeMap;
+import bibliothek.gui.dock.util.WindowProvider;
+import bibliothek.gui.dock.util.WindowProviderListener;
import ca.odell.glazedlists.BasicEventList;
import ca.odell.glazedlists.EventList;
-import ca.odell.glazedlists.GlazedLists;
import ca.odell.glazedlists.swing.DefaultEventTableModel;
+import de.schwarzrot.base.dock.BasicDockable;
import de.schwarzrot.base.util.AbstractDialog;
import de.schwarzrot.base.util.ApplicationServiceProvider;
import de.schwarzrot.control.table.PlayerDefinitionTableFormat;
@@ -50,18 +59,26 @@ import de.schwarzrot.media.domain.MediaServer;
import de.schwarzrot.media.domain.PlayerDefinition;
-public class ConfigDialog extends AbstractDialog {
+public class ConfigDialog extends AbstractDialog implements WindowProvider {
private static final long serialVersionUID = 713L;
public ConfigDialog(Window parent) {
super(parent, true, DialogMode.CANCEL_APPROVE, Orientation.Right);
config = ApplicationServiceProvider.getService(Config.class);
+ listeners = new ArrayList<WindowProviderListener>();
+ setFixedSize(new Dimension(520, 320));
}
@Override
- public JComponent createContentPane() {
+ public void addWindowProviderListener(WindowProviderListener windowproviderlistener) {
+ if (!listeners.contains(windowproviderlistener))
+ listeners.add(windowproviderlistener);
+ }
+
+
+ public JComponent create_Old_ContentPane() {
JTabbedPane rv = new JTabbedPane();
rv.addTab("server", createServerTable());
@@ -71,12 +88,50 @@ public class ConfigDialog extends AbstractDialog {
}
+ @Override
+ public JComponent createContentPane() {
+ CControl docking = new CControl(this);
+ CGrid grid = new CGrid(docking);
+
+ docking.setTheme(ThemeMap.KEY_ECLIPSE_THEME);
+ BasicDockable servers = new BasicDockable("servers", msgBundle.getMessage(getClass().getSimpleName()
+ + ".servers"), createServerTable());
+ BasicDockable players = new BasicDockable("players", msgBundle.getMessage(getClass().getSimpleName()
+ + ".players"), createPlayerTable());
+
+ servers.setMinimizable(false);
+ servers.setExternalizable(false);
+ servers.setMaximizable(false);
+ players.setMinimizable(false);
+ players.setExternalizable(false);
+ players.setMaximizable(false);
+ grid.add(0, 0, 1, 1, players);
+ grid.add(0, 0, 1, 1, servers);
+ docking.getContentArea().deploy(grid);
+
+ return docking.getContentArea();
+ }
+
+
+ @Override
+ public void removeWindowProviderListener(WindowProviderListener windowproviderlistener) {
+ if (listeners.contains(windowproviderlistener))
+ listeners.remove(windowproviderlistener);
+ }
+
+
+ @Override
+ public Window searchWindow() {
+ return this;
+ }
+
+
protected JComponent createPlayerTable() {
playerDefinitions = new BasicEventList<PlayerDefinition>();
for (AbstractMediaNode.SupportedMediaType mt : AbstractMediaNode.SupportedMediaType.values()) {
if (mt == AbstractMediaNode.SupportedMediaType.Unknown)
break;
- PlayerDefinition pd = config.getPlayerMap().get(mt);
+ PlayerDefinition pd = (PlayerDefinition) config.getPlayerMap().get(mt).clone(); // so we can revert changes
pd.setMediaType(mt);
playerDefinitions.add(pd);
@@ -96,6 +151,8 @@ public class ConfigDialog extends AbstractDialog {
playerTable.getColumnModel().getColumn(i).setMaxWidth(cw);
}
}
+ playerTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+
return playerTableScrollPane;
}
@@ -106,7 +163,9 @@ public class ConfigDialog extends AbstractDialog {
protected JComponent createServerTable() {
- serverDefinitions = GlazedLists.eventList(config.getKnownServers());
+ serverDefinitions = new BasicEventList<MediaServer>();
+ for (MediaServer s : config.getKnownServers())
+ serverDefinitions.add((MediaServer) s.clone());
ServerDefinitionTableFormat stf = new ServerDefinitionTableFormat();
DefaultEventTableModel<MediaServer> tm = new DefaultEventTableModel<MediaServer>(serverDefinitions, stf);
JTable serverTable = new JTable(tm);
@@ -131,6 +190,7 @@ public class ConfigDialog extends AbstractDialog {
}
});
serverTable.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, 0), "createServerDefinition");
+ serverTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
return serverTableScrollPane;
}
@@ -140,12 +200,18 @@ public class ConfigDialog extends AbstractDialog {
protected void performApprove() {
System.out.println("should save config now!?!");
List<MediaServer> cfgServers = config.getKnownServers();
+ AbstractMediaNode.SupportedMediaType[] allTypes = AbstractMediaNode.SupportedMediaType.values();
+ Map<AbstractMediaNode.SupportedMediaType, PlayerDefinition> cfgPlayers = config.getPlayerMap();
+ int mx = allTypes.length - 1;
cfgServers.clear();
cfgServers.addAll(serverDefinitions);
+ for (int i = 0; i < mx; ++i)
+ cfgPlayers.put(allTypes[i], playerDefinitions.get(i));
}
private EventList<MediaServer> serverDefinitions;
private EventList<PlayerDefinition> playerDefinitions;
+ private List<WindowProviderListener> listeners;
private Config config;
}
diff --git a/cmpcj/src/de/schwarzrot/control/config/ConfigFactory.java b/cmpcj/src/de/schwarzrot/control/config/ConfigFactory.java
index 5424ef5..edf438a 100644
--- a/cmpcj/src/de/schwarzrot/control/config/ConfigFactory.java
+++ b/cmpcj/src/de/schwarzrot/control/config/ConfigFactory.java
@@ -1,25 +1,25 @@
/**
* ======================== legal notice ======================
*
- * File: ConfigFactory.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: ConfigFactory.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
*
* --------------------------------------------------------------
*/
@@ -107,13 +107,8 @@ public class ConfigFactory {
if (parts.length > 1) {
pd = new PlayerDefinition();
- String[] cmdline = parts[1].split("\\s+");
- pd.setExecutable(cmdline[0]);
-
- for (int i = 1; i < cmdline.length; ++i) {
- pd.addParameter(cmdline[i]);
- }
+ pd.setCommandLine(parts[1]);
if (parts[0].compareTo("*") == 0) {
// default player
for (Media.SupportedMediaType cmt : Media.SupportedMediaType.values())
diff --git a/cmpcj/src/de/schwarzrot/control/dnd/ListSelectionSourceTransferHandler.java b/cmpcj/src/de/schwarzrot/control/dnd/ListSelectionSourceTransferHandler.java
index e396e17..4b47960 100644
--- a/cmpcj/src/de/schwarzrot/control/dnd/ListSelectionSourceTransferHandler.java
+++ b/cmpcj/src/de/schwarzrot/control/dnd/ListSelectionSourceTransferHandler.java
@@ -1,25 +1,25 @@
/**
* ======================== legal notice ======================
*
- * File: ListSelectionSourceTransferHandler.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: ListSelectionSourceTransferHandler.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
*
* --------------------------------------------------------------
*/
@@ -53,9 +53,12 @@ public class ListSelectionSourceTransferHandler extends TransferHandler {
EventList<Media> selection = sm.getSelected();
List<File> transferList = new ArrayList<File>();
+ selection.getReadWriteLock().readLock().lock();
for (Media m : selection) {
transferList.add(m.getRealPath());
}
+ selection.getReadWriteLock().readLock().unlock();
+
return new FilelistTransferable(transferList);
}
diff --git a/cmpcj/src/de/schwarzrot/control/dnd/TreeSourceAndDestTransferHandler.java b/cmpcj/src/de/schwarzrot/control/dnd/TreeSourceAndDestTransferHandler.java
index d9c3285..e400cea 100644
--- a/cmpcj/src/de/schwarzrot/control/dnd/TreeSourceAndDestTransferHandler.java
+++ b/cmpcj/src/de/schwarzrot/control/dnd/TreeSourceAndDestTransferHandler.java
@@ -1,25 +1,25 @@
/**
* ======================== legal notice ======================
*
- * File: TreeSourceAndDestTransferHandler.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: TreeSourceAndDestTransferHandler.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
*
* --------------------------------------------------------------
*/
@@ -190,6 +190,18 @@ public class TreeSourceAndDestTransferHandler extends TransferHandler {
changes.getReadWriteLock().writeLock().unlock();
}
}
+ // } else {
+ // if (targetGenre == null)
+ // System.err.println("failed to determine target genre!");
+ // if (node == null)
+ // System.err.println("failed to determine source parent of media: <|" + mediaPath.getAbsolutePath()
+ // + "|>");
+ // for (File f : nodeCache.keySet()) {
+ // String ap = f.getAbsolutePath();
+ //
+ // if (ap.startsWith("/audio/in/"))
+ // System.out.println("nodeCache contains: " + ap);
+ // }
}
}
diff --git a/cmpcj/src/de/schwarzrot/control/support/TreeCellEditor.java b/cmpcj/src/de/schwarzrot/control/support/TreeCellEditor.java
new file mode 100644
index 0000000..b436207
--- /dev/null
+++ b/cmpcj/src/de/schwarzrot/control/support/TreeCellEditor.java
@@ -0,0 +1,52 @@
+package de.schwarzrot.control.support;
+
+
+import java.util.List;
+import javax.swing.JTree;
+import javax.swing.event.CellEditorListener;
+import javax.swing.event.ChangeEvent;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeCellEditor;
+import javax.swing.tree.DefaultTreeCellRenderer;
+import de.schwarzrot.media.domain.AbstractMediaNode;
+import de.schwarzrot.media.domain.Genre;
+
+
+public class TreeCellEditor extends DefaultTreeCellEditor implements CellEditorListener {
+ public TreeCellEditor(JTree tree, List<AbstractMediaNode> changes) {
+ super(tree, (DefaultTreeCellRenderer) tree.getCellRenderer());
+ this.changes = changes;
+ addCellEditorListener(this);
+ }
+
+
+ @Override
+ public void editingCanceled(ChangeEvent e) {
+ System.out.println("editing cancelled");
+ }
+
+
+ @Override
+ public void editingStopped(ChangeEvent e) {
+ System.out.println("editing stopped");
+ Genre genre = (Genre) editedNode.getUserObject();
+
+ genre.setName((String) editedValue);
+ if (!changes.contains(genre))
+ changes.add(genre);
+ }
+
+
+ @Override
+ public Object getCellEditorValue() {
+ editedValue = super.getCellEditorValue();
+ editedNode = (DefaultMutableTreeNode) lastPath.getLastPathComponent();
+ Genre genre = (Genre) editedNode.getUserObject();
+
+ return genre;
+ }
+
+ private Object editedValue;
+ private DefaultMutableTreeNode editedNode;
+ private List<AbstractMediaNode> changes;
+}
diff --git a/cmpcj/src/de/schwarzrot/media/domain/MediaServer.java b/cmpcj/src/de/schwarzrot/media/domain/MediaServer.java
index a8968c4..5ee0371 100644
--- a/cmpcj/src/de/schwarzrot/media/domain/MediaServer.java
+++ b/cmpcj/src/de/schwarzrot/media/domain/MediaServer.java
@@ -1,32 +1,43 @@
/**
* ======================== legal notice ======================
*
- * File: MediaServer.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: MediaServer.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
*
* --------------------------------------------------------------
*/
package de.schwarzrot.media.domain;
-public class MediaServer {
+public class MediaServer implements Cloneable {
+ @Override
+ public Object clone() {
+ MediaServer rv = new MediaServer();
+
+ rv.hostName = hostName;
+ rv.port = port;
+
+ return rv;
+ }
+
+
public String getHostName() {
return hostName;
}
diff --git a/cmpcj/src/de/schwarzrot/media/domain/PlayerDefinition.java b/cmpcj/src/de/schwarzrot/media/domain/PlayerDefinition.java
index 05b9bbc..85f4f3c 100644
--- a/cmpcj/src/de/schwarzrot/media/domain/PlayerDefinition.java
+++ b/cmpcj/src/de/schwarzrot/media/domain/PlayerDefinition.java
@@ -1,25 +1,25 @@
/**
* ======================== legal notice ======================
*
- * File: PlayerDefinition.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: PlayerDefinition.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
*
* --------------------------------------------------------------
*/
@@ -30,7 +30,7 @@ import java.util.ArrayList;
import java.util.List;
-public class PlayerDefinition {
+public class PlayerDefinition implements Cloneable {
public PlayerDefinition() {
parameters = new ArrayList<String>();
}
@@ -41,6 +41,17 @@ public class PlayerDefinition {
}
+ @Override
+ public Object clone() {
+ PlayerDefinition pd = new PlayerDefinition();
+
+ pd.mediaType = mediaType;
+ pd.setCommandLine(getCommandLine());
+
+ return pd;
+ }
+
+
public String getCommandLine() {
if (commandLine == null)
assembleCommandLine();
@@ -87,7 +98,7 @@ public class PlayerDefinition {
protected void assembleCommandLine() {
- if (executable == null || parameters == null || parameters.size() < 1)
+ if (executable == null || parameters == null)
return;
StringBuilder sb = new StringBuilder(executable);