Răsfoiți Sursa

Editor intermediate functionality

LH 10 ani în urmă
părinte
comite
bb33649e9f

+ 4 - 3
build.gradle

@@ -1,16 +1,17 @@
 defaultTasks 'distZip',':izsetup:izsetupDist'
-
 buildscript {
   repositories { jcenter() }
   dependencies {
     classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.0'
   }
 }
+
+
+
 allprojects {
 	repositories{
 		jcenter()
-		
-		
+
 		maven {
 			url "https://repository.apache.org/content/repositories/snapshots"
 		}

+ 6 - 0
iZpl/src/main/java/de/nplusc/izc/iZpl/API/IZPLApi.java

@@ -159,4 +159,10 @@ public class IZPLApi
         return PLReader2.readSingleList(path);
     }
     
+    
+    public static FeaturePlugin getSelectedFeature()
+    {
+        return Main.getSelectedFeaturePlugin();
+    }
+    
 }

+ 9 - 0
iZpl/src/main/java/de/nplusc/izc/iZpl/Main.java

@@ -127,6 +127,8 @@ public class Main extends javax.swing.JFrame
     private static Image playListIcon;
     
     private static FeaturePlugin selectedFeaturePlugin;
+
+
     
     private static boolean pluginsAlreadyLoaded=false;
     
@@ -1230,6 +1232,13 @@ public class Main extends javax.swing.JFrame
     {
         return verboseMode;
     }
+    
+        public static FeaturePlugin getSelectedFeaturePlugin()
+    {
+        return selectedFeaturePlugin;
+    }
+    
+    
     //</editor-fold>
     
     // Variables declaration - do not modify//GEN-BEGIN:variables

+ 0 - 1
iZpl/src/main/java/de/nplusc/izc/iZpl/Utils/PLReader2.java

@@ -48,7 +48,6 @@ public class PLReader2
     private static final Logger l = LogManager.getLogger();
     public static List<SinglePlayListItem> readSingleList(String path) throws InvalidPlayListFileException
     {
-        
         String plbd = FileTK.getFilePath(path)+File.separator;
         l.trace("Location:{}",new File(path).getAbsolutePath());
         try

+ 1 - 1
iZplPlugins/Editor/build.gradle

@@ -2,7 +2,7 @@ apply plugin:'java'
 task distZip(dependsOn: 'jar') {
 	//NO-OPtask als redirect
 }
-
+compileJava.options.encoding = 'UTF-8'
 dependencies
 {
 	compile fileTree(dir: 'lib', include: '*.jar')

+ 12 - 3
iZplPlugins/Editor/src/main/java/de/nplusc/izc/izpl/plugins/editor/Editor.java

@@ -25,7 +25,8 @@ import org.yaml.snakeyaml.Yaml;
 public class Editor implements FeaturePlugin
 {
     private ListIncludeGraph parseGraph = new ListIncludeGraph();
-    
+
+
     private PlayListFile rootFile=null;
     
     private static final Logger l = LogManager.getLogger();
@@ -89,7 +90,7 @@ public class Editor implements FeaturePlugin
        return false;
     }
     
-    private void loadPlayListIntoGraph(String path)
+     /*packageprotected*/ void loadPlayListIntoGraph(String path)
     {
         
         try
@@ -104,7 +105,7 @@ public class Editor implements FeaturePlugin
             //ex.printStackTrace();
         }
     }
-    private void loadPlayListIntoGraph(String path,int rd,PlayListFile fromFile) throws InvalidPlayListFileException
+    /*packageprotected*/ void loadPlayListIntoGraph(String path,int rd,PlayListFile fromFile) throws InvalidPlayListFileException
     {
         List<SinglePlayListItem> data = IZPLApi.readPlayList(path);
         PlayListFile f = new PlayListFile();
@@ -127,6 +128,7 @@ public class Editor implements FeaturePlugin
         {
             if(spi.isIncludeElement())
             {                               //Do not use path here or nice O(includecount^rd) loop
+                l.trace(spi.getPath());
                 loadPlayListIntoGraph(spi.getPath(),rd-1,f);
             }
         }
@@ -136,4 +138,11 @@ public class Editor implements FeaturePlugin
         }
     }
     
+    
+        public ListIncludeGraph getParseGraph()
+    {
+        return parseGraph;
+    }
+    
+    
 }

+ 32 - 5
iZplPlugins/Editor/src/main/java/de/nplusc/izc/izpl/plugins/editor/EditorUICommon.java

@@ -8,7 +8,9 @@ package de.nplusc.izc.izpl.plugins.editor;
 
 import de.nplusc.izc.iZpl.API.SinglePlayListItem;
 import de.nplusc.izc.tools.IOtools.FileTK;
+import java.util.Collection;
 import java.util.HashMap;
+import java.util.HashSet;
 
 /**
  *
@@ -17,17 +19,23 @@ import java.util.HashMap;
 public class EditorUICommon extends javax.swing.JFrame
 {
     private HashMap<PlayListFile,EditorUIFileWise> tabRemapping = new HashMap<>();
-    private HashMap<String,PlayListFile> lookupCache = new HashMap<>();
+    private HashMap<String,PlayListFile> lookupCache;
     ListIncludeGraph parseGraph;
+    
     /**
      * Creates new form EditorUICommon
      * @param r00t
      * @param pParseGraph
      */
+    
+    
+    
+    
     public EditorUICommon(PlayListFile r00t,ListIncludeGraph pParseGraph)
     {
         parseGraph = pParseGraph;
-        lookupCache = parseGraph.generateLookupCache();
+        parseGraph.generateLookupCache();
+        lookupCache=parseGraph.getLookupCache();
         initComponents();
         openFileTab(r00t);
     }
@@ -40,8 +48,6 @@ public class EditorUICommon extends javax.swing.JFrame
     
     public void openFileTab(PlayListFile f)
     {
-        
-        
         int tc = tpMain.getTabCount();
         //tpMain.setSelectedIndex(tc);
         if(tabRemapping.containsKey(f))
@@ -54,7 +60,7 @@ public class EditorUICommon extends javax.swing.JFrame
             EditorUIFileWise efw = new EditorUIFileWise(f, this);
             tabRemapping.put(f,efw);
             tpMain.add(FileTK.getFileName(f.getPath()), efw);
-            pack();
+            tpMain.setSelectedComponent(tabRemapping.get(f));
         }
     }
     
@@ -67,8 +73,29 @@ public class EditorUICommon extends javax.swing.JFrame
     public void recalculatePriorities(PlayListFile f)
     {
         parseGraph.recalcPriorities(f);
+        for (PlayListFile playListFile : tabRemapping.keySet())
+        {
+            tabRemapping.get(playListFile).resyncPriority();
+        }
     }
     
+    public void zapFile(SinglePlayListItem i)
+    {
+        PlayListFile f = lookupCache.get(i.getPath());
+        parseGraph.zapElement(f);
+        parseGraph.generateLookupCache();
+        Collection<PlayListFile> lcv = lookupCache.values();
+        
+        for (PlayListFile plf : new HashSet<>(tabRemapping.keySet()))
+        {
+            if(!lcv.contains(plf))
+            {
+                
+                tpMain.remove(tabRemapping.remove(plf));
+                
+            }
+        }
+    }
     
     /**
      * This method is called from within the constructor to

+ 304 - 218
iZplPlugins/Editor/src/main/java/de/nplusc/izc/izpl/plugins/editor/EditorUIFileWise.form

@@ -21,57 +21,36 @@
     <DimensionLayout dim="0">
       <Group type="103" groupAlignment="0" attributes="0">
           <Group type="102" alignment="0" attributes="0">
-              <EmptySpace max="-2" attributes="0"/>
-              <Component id="jScrollPane1" min="-2" pref="216" max="-2" attributes="0"/>
-              <EmptySpace max="-2" attributes="0"/>
-              <Component id="jSeparator2" min="-2" max="-2" attributes="0"/>
               <Group type="103" groupAlignment="0" attributes="0">
                   <Group type="102" attributes="0">
-                      <Group type="103" groupAlignment="0" attributes="0">
-                          <Group type="102" alignment="1" attributes="0">
-                              <EmptySpace pref="223" max="32767" attributes="0"/>
-                              <Component id="jSeparator1" min="-2" pref="749" max="-2" attributes="0"/>
-                          </Group>
-                          <Group type="102" attributes="0">
-                              <EmptySpace min="-2" pref="21" max="-2" attributes="0"/>
-                              <Component id="jLabel3" min="-2" max="-2" attributes="0"/>
-                              <EmptySpace type="separate" max="-2" attributes="0"/>
-                              <Component id="iPath" max="32767" attributes="0"/>
-                              <EmptySpace min="-2" pref="12" max="-2" attributes="0"/>
-                              <Component id="pathSelect" min="-2" pref="182" max="-2" attributes="0"/>
-                          </Group>
-                          <Group type="102" attributes="0">
-                              <Group type="103" groupAlignment="0" attributes="0">
-                                  <Group type="102" attributes="0">
-                                      <EmptySpace min="-2" pref="31" max="-2" attributes="0"/>
-                                      <Component id="btnApply" min="-2" max="-2" attributes="0"/>
-                                  </Group>
-                                  <Group type="102" alignment="0" attributes="0">
-                                      <EmptySpace type="separate" max="-2" attributes="0"/>
-                                      <Group type="103" groupAlignment="0" attributes="0">
-                                          <Group type="103" alignment="0" groupAlignment="1" attributes="0">
-                                              <Component id="pnlPrio" min="-2" max="-2" attributes="0"/>
-                                              <Group type="103" groupAlignment="0" attributes="0">
-                                                  <Group type="103" alignment="0" groupAlignment="0" max="-2" attributes="0">
-                                                      <Component id="jButton2" pref="139" max="32767" attributes="0"/>
-                                                      <Component id="jButton3" max="32767" attributes="0"/>
-                                                      <Component id="jButton4" max="32767" attributes="0"/>
-                                                  </Group>
-                                                  <Component id="pnlInclude" alignment="0" min="-2" max="-2" attributes="0"/>
-                                              </Group>
-                                          </Group>
-                                          <Component id="pnlGroup" alignment="0" min="-2" max="-2" attributes="0"/>
-                                      </Group>
-                                  </Group>
-                              </Group>
-                              <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
-                          </Group>
-                      </Group>
                       <EmptySpace max="-2" attributes="0"/>
+                      <Component id="jScrollPane1" min="-2" pref="216" max="-2" attributes="0"/>
                   </Group>
                   <Group type="102" alignment="0" attributes="0">
-                      <EmptySpace type="separate" max="-2" attributes="0"/>
-                      <Component id="pnlTitel" min="-2" max="-2" attributes="0"/>
+                      <EmptySpace min="-2" pref="64" max="-2" attributes="0"/>
+                      <Group type="103" groupAlignment="0" max="-2" attributes="0">
+                          <Component id="btnDown" max="32767" attributes="0"/>
+                          <Component id="btnUp" max="32767" attributes="0"/>
+                      </Group>
+                  </Group>
+              </Group>
+              <EmptySpace max="-2" attributes="0"/>
+              <Component id="jSeparator2" min="-2" max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="1" attributes="0">
+                  <Group type="102" alignment="1" attributes="0">
+                      <Group type="103" groupAlignment="0" max="-2" attributes="0">
+                          <Component id="btnSublist" pref="139" max="32767" attributes="0"/>
+                          <Component id="btnAddElement" max="32767" attributes="0"/>
+                          <Component id="btnZapElement" max="32767" attributes="0"/>
+                      </Group>
+                      <EmptySpace min="-2" pref="582" max="-2" attributes="0"/>
+                  </Group>
+                  <Group type="102" alignment="0" attributes="0">
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Group type="103" groupAlignment="0" attributes="0">
+                          <Component id="pnlEdit" min="-2" max="-2" attributes="0"/>
+                          <Component id="jSeparator1" min="-2" pref="687" max="-2" attributes="0"/>
+                      </Group>
                       <EmptySpace max="32767" attributes="0"/>
                   </Group>
               </Group>
@@ -85,34 +64,27 @@
                   <Group type="102" attributes="0">
                       <EmptySpace max="-2" attributes="0"/>
                       <Group type="103" groupAlignment="0" attributes="0">
-                          <Component id="jScrollPane1" alignment="0" max="32767" attributes="0"/>
-                          <Component id="jSeparator2" alignment="0" max="32767" attributes="0"/>
+                          <Component id="jSeparator2" max="32767" attributes="0"/>
+                          <Group type="102" attributes="0">
+                              <Component id="jScrollPane1" min="-2" pref="538" max="-2" attributes="0"/>
+                              <EmptySpace type="unrelated" max="-2" attributes="0"/>
+                              <Component id="btnUp" min="-2" max="-2" attributes="0"/>
+                              <EmptySpace max="32767" attributes="0"/>
+                              <Component id="btnDown" min="-2" max="-2" attributes="0"/>
+                          </Group>
                       </Group>
                   </Group>
-                  <Group type="102" attributes="0">
-                      <Component id="pnlTitel" min="-2" max="-2" attributes="0"/>
-                      <EmptySpace max="-2" attributes="0"/>
-                      <Group type="103" groupAlignment="3" attributes="0">
-                          <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
-                          <Component id="iPath" alignment="3" min="-2" max="-2" attributes="0"/>
-                          <Component id="pathSelect" alignment="3" min="-2" max="-2" attributes="0"/>
-                      </Group>
-                      <EmptySpace min="-2" pref="69" max="-2" attributes="0"/>
-                      <Component id="pnlPrio" min="-2" max="-2" attributes="0"/>
+                  <Group type="102" alignment="1" attributes="0">
+                      <EmptySpace min="-2" pref="5" max="-2" attributes="0"/>
+                      <Component id="pnlEdit" max="32767" attributes="0"/>
                       <EmptySpace max="-2" attributes="0"/>
-                      <Component id="pnlGroup" min="-2" max="-2" attributes="0"/>
-                      <EmptySpace min="-2" pref="23" max="-2" attributes="0"/>
-                      <Component id="pnlInclude" min="-2" max="-2" attributes="0"/>
-                      <EmptySpace min="-2" pref="72" max="-2" attributes="0"/>
-                      <Component id="btnApply" min="-2" max="-2" attributes="0"/>
-                      <EmptySpace type="unrelated" max="-2" attributes="0"/>
                       <Component id="jSeparator1" min="-2" pref="10" max="-2" attributes="0"/>
                       <EmptySpace type="separate" max="-2" attributes="0"/>
-                      <Component id="jButton2" min="-2" max="-2" attributes="0"/>
+                      <Component id="btnSublist" min="-2" max="-2" attributes="0"/>
                       <EmptySpace type="unrelated" max="-2" attributes="0"/>
-                      <Component id="jButton3" min="-2" max="-2" attributes="0"/>
-                      <EmptySpace max="-2" attributes="0"/>
-                      <Component id="jButton4" min="-2" max="-2" attributes="0"/>
+                      <Component id="btnAddElement" min="-2" max="-2" attributes="0"/>
+                      <EmptySpace min="-2" max="-2" attributes="0"/>
+                      <Component id="btnZapElement" min="-2" max="-2" attributes="0"/>
                   </Group>
               </Group>
               <EmptySpace max="-2" attributes="0"/>
@@ -137,18 +109,6 @@
         </Component>
       </SubComponents>
     </Container>
-    <Component class="javax.swing.JLabel" name="jLabel3">
-      <Properties>
-        <Property name="text" type="java.lang.String" value="Datei"/>
-      </Properties>
-    </Component>
-    <Component class="javax.swing.JTextField" name="iPath">
-    </Component>
-    <Component class="javax.swing.JButton" name="pathSelect">
-      <Properties>
-        <Property name="text" type="java.lang.String" value="Durchsuchen"/>
-      </Properties>
-    </Component>
     <Component class="javax.swing.JSeparator" name="jSeparator1">
     </Component>
     <Component class="javax.swing.JSeparator" name="jSeparator2">
@@ -156,22 +116,47 @@
         <Property name="orientation" type="int" value="1"/>
       </Properties>
     </Component>
-    <Component class="javax.swing.JButton" name="jButton2">
+    <Component class="javax.swing.JButton" name="btnSublist">
       <Properties>
         <Property name="text" type="java.lang.String" value="Neue Sub-Liste"/>
       </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnSublistActionPerformed"/>
+      </Events>
     </Component>
-    <Component class="javax.swing.JButton" name="jButton3">
+    <Component class="javax.swing.JButton" name="btnAddElement">
       <Properties>
         <Property name="text" type="java.lang.String" value="Neues Element"/>
       </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnAddElementActionPerformed"/>
+      </Events>
     </Component>
-    <Component class="javax.swing.JButton" name="jButton4">
+    <Component class="javax.swing.JButton" name="btnZapElement">
       <Properties>
         <Property name="text" type="java.lang.String" value="Element entfernen"/>
       </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnZapElementActionPerformed"/>
+      </Events>
+    </Component>
+    <Component class="javax.swing.JButton" name="btnUp">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="1 hoch"/>
+      </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnUpActionPerformed"/>
+      </Events>
+    </Component>
+    <Component class="javax.swing.JButton" name="btnDown">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="1 runter"/>
+      </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnDownActionPerformed"/>
+      </Events>
     </Component>
-    <Container class="javax.swing.JPanel" name="pnlInclude">
+    <Container class="javax.swing.JPanel" name="pnlEdit">
 
       <Layout>
         <DimensionLayout dim="0">
@@ -179,12 +164,49 @@
               <Group type="102" attributes="0">
                   <EmptySpace max="-2" attributes="0"/>
                   <Group type="103" groupAlignment="0" attributes="0">
-                      <Component id="jLabel5" min="-2" max="-2" attributes="0"/>
-                      <Component id="rbtnIExpand" alignment="0" min="-2" max="-2" attributes="0"/>
-                      <Component id="rbtnINoexpand" alignment="0" min="-2" max="-2" attributes="0"/>
-                      <Component id="btnLoadForEdit" alignment="0" min="-2" max="-2" attributes="0"/>
+                      <Group type="102" attributes="0">
+                          <EmptySpace min="10" pref="10" max="-2" attributes="0"/>
+                          <Component id="pnlGroup" min="-2" max="-2" attributes="0"/>
+                          <EmptySpace max="32767" attributes="0"/>
+                      </Group>
+                      <Group type="102" attributes="0">
+                          <Group type="103" groupAlignment="0" attributes="0">
+                              <Group type="102" alignment="1" attributes="0">
+                                  <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
+                                  <Component id="pathSelect" min="-2" pref="182" max="-2" attributes="0"/>
+                              </Group>
+                              <Group type="102" attributes="0">
+                                  <Component id="pnlPrio" min="-2" max="-2" attributes="0"/>
+                                  <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
+                              </Group>
+                          </Group>
+                          <EmptySpace max="-2" attributes="0"/>
+                      </Group>
+                      <Group type="102" alignment="0" attributes="0">
+                          <Component id="pnlInclude" min="-2" max="-2" attributes="0"/>
+                          <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
+                      </Group>
                   </Group>
-                  <EmptySpace max="32767" attributes="0"/>
+              </Group>
+              <Group type="102" attributes="0">
+                  <Group type="103" groupAlignment="0" attributes="0">
+                      <Group type="102" alignment="0" attributes="0">
+                          <EmptySpace min="-2" pref="36" max="-2" attributes="0"/>
+                          <Component id="btnApply" min="-2" max="-2" attributes="0"/>
+                      </Group>
+                      <Group type="102" alignment="0" attributes="0">
+                          <EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
+                          <Group type="103" groupAlignment="0" attributes="0">
+                              <Group type="102" attributes="0">
+                                  <Component id="jLabel3" min="-2" max="-2" attributes="0"/>
+                                  <EmptySpace type="separate" max="-2" attributes="0"/>
+                                  <Component id="iPath" min="-2" pref="437" max="-2" attributes="0"/>
+                              </Group>
+                              <Component id="pnlTitel" min="-2" max="-2" attributes="0"/>
+                          </Group>
+                      </Group>
+                  </Group>
+                  <EmptySpace min="0" pref="153" max="32767" attributes="0"/>
               </Group>
           </Group>
         </DimensionLayout>
@@ -192,162 +214,226 @@
           <Group type="103" groupAlignment="0" attributes="0">
               <Group type="102" alignment="0" attributes="0">
                   <EmptySpace max="-2" attributes="0"/>
-                  <Component id="jLabel5" min="-2" max="-2" attributes="0"/>
-                  <EmptySpace type="unrelated" max="-2" attributes="0"/>
-                  <Component id="rbtnIExpand" min="-2" max="-2" attributes="0"/>
-                  <EmptySpace type="unrelated" max="-2" attributes="0"/>
-                  <Component id="rbtnINoexpand" min="-2" max="-2" attributes="0"/>
+                  <Component id="pnlTitel" min="-2" max="-2" attributes="0"/>
                   <EmptySpace max="-2" attributes="0"/>
-                  <Component id="btnLoadForEdit" min="-2" max="-2" attributes="0"/>
-                  <EmptySpace pref="26" max="32767" attributes="0"/>
+                  <Group type="103" groupAlignment="0" attributes="0">
+                      <Group type="103" groupAlignment="3" attributes="0">
+                          <Component id="pathSelect" alignment="3" min="-2" max="-2" attributes="0"/>
+                          <Component id="iPath" alignment="3" min="-2" max="-2" attributes="0"/>
+                      </Group>
+                      <Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
+                  </Group>
+                  <EmptySpace min="-2" pref="41" max="-2" attributes="0"/>
+                  <Component id="pnlPrio" min="-2" max="-2" attributes="0"/>
+                  <EmptySpace type="unrelated" max="-2" attributes="0"/>
+                  <Component id="pnlGroup" min="-2" max="-2" attributes="0"/>
+                  <EmptySpace min="-2" pref="34" max="-2" attributes="0"/>
+                  <Component id="pnlInclude" min="-2" max="-2" attributes="0"/>
+                  <EmptySpace max="32767" attributes="0"/>
+                  <Component id="btnApply" min="-2" max="-2" attributes="0"/>
+                  <EmptySpace min="-2" pref="36" max="-2" attributes="0"/>
               </Group>
           </Group>
         </DimensionLayout>
       </Layout>
       <SubComponents>
-        <Component class="javax.swing.JLabel" name="jLabel5">
-          <Properties>
-            <Property name="text" type="java.lang.String" value="Include-Modus"/>
-          </Properties>
-        </Component>
-        <Component class="javax.swing.JRadioButton" name="rbtnIExpand">
-          <Properties>
-            <Property name="text" type="java.lang.String" value="Expandierend: Liste wirdin mischbare Elemente zerlegt"/>
-          </Properties>
-        </Component>
-        <Component class="javax.swing.JRadioButton" name="rbtnINoexpand">
-          <Properties>
-            <Property name="text" type="java.lang.String" value="Nicht expandierend: Liste wird als ein nicht mischbarer Block behandelt"/>
-          </Properties>
-        </Component>
-        <Component class="javax.swing.JButton" name="btnLoadForEdit">
+        <Component class="javax.swing.JButton" name="pathSelect">
           <Properties>
-            <Property name="text" type="java.lang.String" value="Liste zum Bearbeiten &#xf6;ffnen"/>
+            <Property name="text" type="java.lang.String" value="Durchsuchen"/>
           </Properties>
           <Events>
-            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnLoadForEditActionPerformed"/>
+            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="pathSelectActionPerformed"/>
           </Events>
         </Component>
-      </SubComponents>
-    </Container>
-    <Component class="javax.swing.JButton" name="btnApply">
-      <Properties>
-        <Property name="text" type="java.lang.String" value="&#xdc;bernehmen"/>
-      </Properties>
-    </Component>
-    <Container class="javax.swing.JPanel" name="pnlGroup">
+        <Component class="javax.swing.JTextField" name="iPath">
+        </Component>
+        <Container class="javax.swing.JPanel" name="pnlPrio">
 
-      <Layout>
-        <DimensionLayout dim="0">
-          <Group type="103" groupAlignment="0" attributes="0">
-              <Group type="102" alignment="1" attributes="0">
-                  <EmptySpace max="-2" attributes="0"/>
-                  <Component id="jLabel4" min="-2" max="-2" attributes="0"/>
-                  <EmptySpace max="-2" attributes="0"/>
-                  <Component id="iGroupNumber" min="-2" pref="118" max="-2" attributes="0"/>
-                  <EmptySpace pref="42" max="32767" attributes="0"/>
+          <Layout>
+            <DimensionLayout dim="0">
+              <Group type="103" groupAlignment="0" attributes="0">
+                  <Group type="102" alignment="1" attributes="0">
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
+                      <EmptySpace min="-2" pref="30" max="-2" attributes="0"/>
+                      <Component id="iPriority" min="-2" pref="118" max="-2" attributes="0"/>
+                      <EmptySpace pref="38" max="32767" attributes="0"/>
+                      <Component id="oCalculatedPriority" min="-2" max="-2" attributes="0"/>
+                      <EmptySpace min="-2" pref="32" max="-2" attributes="0"/>
+                  </Group>
               </Group>
-          </Group>
-        </DimensionLayout>
-        <DimensionLayout dim="1">
-          <Group type="103" groupAlignment="0" attributes="0">
-              <Group type="102" alignment="1" attributes="0">
-                  <EmptySpace min="0" pref="11" max="32767" attributes="0"/>
-                  <Group type="103" groupAlignment="3" attributes="0">
-                      <Component id="iGroupNumber" alignment="3" min="-2" max="-2" attributes="0"/>
-                      <Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
+            </DimensionLayout>
+            <DimensionLayout dim="1">
+              <Group type="103" groupAlignment="0" attributes="0">
+                  <Group type="102" alignment="0" attributes="0">
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Group type="103" groupAlignment="3" attributes="0">
+                          <Component id="oCalculatedPriority" alignment="3" min="-2" max="-2" attributes="0"/>
+                          <Component id="iPriority" alignment="3" min="-2" max="-2" attributes="0"/>
+                          <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
+                      </Group>
+                      <EmptySpace pref="21" max="32767" attributes="0"/>
                   </Group>
               </Group>
-          </Group>
-        </DimensionLayout>
-      </Layout>
-      <SubComponents>
-        <Component class="javax.swing.JSpinner" name="iGroupNumber">
-        </Component>
-        <Component class="javax.swing.JLabel" name="jLabel4">
-          <Properties>
-            <Property name="text" type="java.lang.String" value="Group Number"/>
-          </Properties>
-        </Component>
-      </SubComponents>
-    </Container>
-    <Container class="javax.swing.JPanel" name="pnlPrio">
+            </DimensionLayout>
+          </Layout>
+          <SubComponents>
+            <Component class="javax.swing.JLabel" name="oCalculatedPriority">
+              <Properties>
+                <Property name="text" type="java.lang.String" value="Berechnete Priorit&#xe4;t: 0"/>
+              </Properties>
+            </Component>
+            <Component class="javax.swing.JSpinner" name="iPriority">
+            </Component>
+            <Component class="javax.swing.JLabel" name="jLabel2">
+              <Properties>
+                <Property name="text" type="java.lang.String" value="Priorit&#xe4;t"/>
+              </Properties>
+            </Component>
+          </SubComponents>
+        </Container>
+        <Container class="javax.swing.JPanel" name="pnlGroup">
 
-      <Layout>
-        <DimensionLayout dim="0">
-          <Group type="103" groupAlignment="0" attributes="0">
-              <Group type="102" alignment="1" attributes="0">
-                  <EmptySpace max="-2" attributes="0"/>
-                  <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
-                  <EmptySpace min="-2" pref="30" max="-2" attributes="0"/>
-                  <Component id="iPriority" min="-2" pref="118" max="-2" attributes="0"/>
-                  <EmptySpace pref="38" max="32767" attributes="0"/>
-                  <Component id="oCalculatedPriority" min="-2" max="-2" attributes="0"/>
-                  <EmptySpace min="-2" pref="32" max="-2" attributes="0"/>
+          <Layout>
+            <DimensionLayout dim="0">
+              <Group type="103" groupAlignment="0" attributes="0">
+                  <Group type="102" alignment="1" attributes="0">
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Component id="jLabel4" min="-2" max="-2" attributes="0"/>
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Component id="iGroupNumber" min="-2" pref="118" max="-2" attributes="0"/>
+                      <EmptySpace pref="42" max="32767" attributes="0"/>
+                  </Group>
               </Group>
-          </Group>
-        </DimensionLayout>
-        <DimensionLayout dim="1">
-          <Group type="103" groupAlignment="0" attributes="0">
-              <Group type="102" alignment="0" attributes="0">
-                  <EmptySpace max="-2" attributes="0"/>
-                  <Group type="103" groupAlignment="3" attributes="0">
-                      <Component id="oCalculatedPriority" alignment="3" min="-2" max="-2" attributes="0"/>
-                      <Component id="iPriority" alignment="3" min="-2" max="-2" attributes="0"/>
-                      <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
+            </DimensionLayout>
+            <DimensionLayout dim="1">
+              <Group type="103" groupAlignment="0" attributes="0">
+                  <Group type="102" alignment="1" attributes="0">
+                      <EmptySpace min="0" pref="11" max="32767" attributes="0"/>
+                      <Group type="103" groupAlignment="3" attributes="0">
+                          <Component id="iGroupNumber" alignment="3" min="-2" max="-2" attributes="0"/>
+                          <Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
+                      </Group>
                   </Group>
-                  <EmptySpace pref="21" max="32767" attributes="0"/>
               </Group>
-          </Group>
-        </DimensionLayout>
-      </Layout>
-      <SubComponents>
-        <Component class="javax.swing.JLabel" name="oCalculatedPriority">
-          <Properties>
-            <Property name="text" type="java.lang.String" value="Berechnete Priorit&#xe4;t: 0"/>
-          </Properties>
-        </Component>
-        <Component class="javax.swing.JSpinner" name="iPriority">
-        </Component>
-        <Component class="javax.swing.JLabel" name="jLabel2">
+            </DimensionLayout>
+          </Layout>
+          <SubComponents>
+            <Component class="javax.swing.JSpinner" name="iGroupNumber">
+            </Component>
+            <Component class="javax.swing.JLabel" name="jLabel4">
+              <Properties>
+                <Property name="text" type="java.lang.String" value="Group Number"/>
+              </Properties>
+            </Component>
+          </SubComponents>
+        </Container>
+        <Container class="javax.swing.JPanel" name="pnlInclude">
+
+          <Layout>
+            <DimensionLayout dim="0">
+              <Group type="103" groupAlignment="0" attributes="0">
+                  <Group type="102" attributes="0">
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Group type="103" groupAlignment="0" attributes="0">
+                          <Component id="jLabel5" min="-2" max="-2" attributes="0"/>
+                          <Component id="rbtnIExpand" alignment="0" min="-2" max="-2" attributes="0"/>
+                          <Component id="rbtnINoexpand" alignment="0" min="-2" max="-2" attributes="0"/>
+                          <Component id="btnLoadForEdit" alignment="0" min="-2" max="-2" attributes="0"/>
+                      </Group>
+                      <EmptySpace max="32767" attributes="0"/>
+                  </Group>
+              </Group>
+            </DimensionLayout>
+            <DimensionLayout dim="1">
+              <Group type="103" groupAlignment="0" attributes="0">
+                  <Group type="102" alignment="0" attributes="0">
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Component id="jLabel5" min="-2" max="-2" attributes="0"/>
+                      <EmptySpace type="unrelated" max="-2" attributes="0"/>
+                      <Component id="rbtnIExpand" min="-2" max="-2" attributes="0"/>
+                      <EmptySpace type="unrelated" max="-2" attributes="0"/>
+                      <Component id="rbtnINoexpand" min="-2" max="-2" attributes="0"/>
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Component id="btnLoadForEdit" min="-2" max="-2" attributes="0"/>
+                      <EmptySpace pref="26" max="32767" attributes="0"/>
+                  </Group>
+              </Group>
+            </DimensionLayout>
+          </Layout>
+          <SubComponents>
+            <Component class="javax.swing.JLabel" name="jLabel5">
+              <Properties>
+                <Property name="text" type="java.lang.String" value="Include-Modus"/>
+              </Properties>
+            </Component>
+            <Component class="javax.swing.JRadioButton" name="rbtnIExpand">
+              <Properties>
+                <Property name="text" type="java.lang.String" value="Expandierend: Liste wirdin mischbare Elemente zerlegt"/>
+              </Properties>
+            </Component>
+            <Component class="javax.swing.JRadioButton" name="rbtnINoexpand">
+              <Properties>
+                <Property name="text" type="java.lang.String" value="Nicht expandierend: Liste wird als ein nicht mischbarer Block behandelt"/>
+              </Properties>
+            </Component>
+            <Component class="javax.swing.JButton" name="btnLoadForEdit">
+              <Properties>
+                <Property name="text" type="java.lang.String" value="Liste zum Bearbeiten &#xf6;ffnen"/>
+              </Properties>
+              <Events>
+                <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnLoadForEditActionPerformed"/>
+              </Events>
+            </Component>
+          </SubComponents>
+        </Container>
+        <Component class="javax.swing.JButton" name="btnApply">
           <Properties>
-            <Property name="text" type="java.lang.String" value="Priorit&#xe4;t"/>
+            <Property name="text" type="java.lang.String" value="&#xdc;bernehmen"/>
           </Properties>
+          <Events>
+            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnApplyActionPerformed"/>
+          </Events>
         </Component>
-      </SubComponents>
-    </Container>
-    <Container class="javax.swing.JPanel" name="pnlTitel">
+        <Container class="javax.swing.JPanel" name="pnlTitel">
 
-      <Layout>
-        <DimensionLayout dim="0">
-          <Group type="103" groupAlignment="0" attributes="0">
-              <Group type="102" alignment="1" attributes="0">
-                  <Component id="jLabel1" min="-2" pref="42" max="-2" attributes="0"/>
-                  <EmptySpace max="-2" attributes="0"/>
-                  <Component id="iTitle" min="-2" pref="439" max="-2" attributes="0"/>
-                  <EmptySpace pref="41" max="32767" attributes="0"/>
+          <Layout>
+            <DimensionLayout dim="0">
+              <Group type="103" groupAlignment="0" attributes="0">
+                  <Group type="102" alignment="1" attributes="0">
+                      <Component id="jLabel1" min="-2" pref="42" max="-2" attributes="0"/>
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Component id="iTitle" min="-2" pref="439" max="-2" attributes="0"/>
+                      <EmptySpace pref="64" max="32767" attributes="0"/>
+                  </Group>
               </Group>
-          </Group>
-        </DimensionLayout>
-        <DimensionLayout dim="1">
-          <Group type="103" groupAlignment="0" attributes="0">
-              <Group type="102" alignment="1" attributes="0">
-                  <EmptySpace pref="21" max="32767" attributes="0"/>
-                  <Group type="103" groupAlignment="3" attributes="0">
-                      <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
-                      <Component id="iTitle" alignment="3" min="-2" max="-2" attributes="0"/>
+            </DimensionLayout>
+            <DimensionLayout dim="1">
+              <Group type="103" groupAlignment="0" attributes="0">
+                  <Group type="102" alignment="1" attributes="0">
+                      <EmptySpace pref="25" max="32767" attributes="0"/>
+                      <Group type="103" groupAlignment="3" attributes="0">
+                          <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
+                          <Component id="iTitle" alignment="3" min="-2" max="-2" attributes="0"/>
+                      </Group>
+                      <EmptySpace max="-2" attributes="0"/>
                   </Group>
-                  <EmptySpace max="-2" attributes="0"/>
               </Group>
-          </Group>
-        </DimensionLayout>
-      </Layout>
-      <SubComponents>
-        <Component class="javax.swing.JTextField" name="iTitle">
-        </Component>
-        <Component class="javax.swing.JLabel" name="jLabel1">
+            </DimensionLayout>
+          </Layout>
+          <SubComponents>
+            <Component class="javax.swing.JLabel" name="jLabel1">
+              <Properties>
+                <Property name="text" type="java.lang.String" value="Titel"/>
+              </Properties>
+            </Component>
+            <Component class="javax.swing.JTextField" name="iTitle">
+            </Component>
+          </SubComponents>
+        </Container>
+        <Component class="javax.swing.JLabel" name="jLabel3">
           <Properties>
-            <Property name="text" type="java.lang.String" value="Titel"/>
+            <Property name="text" type="java.lang.String" value="Datei"/>
           </Properties>
         </Component>
       </SubComponents>

+ 391 - 139
iZplPlugins/Editor/src/main/java/de/nplusc/izc/izpl/plugins/editor/EditorUIFileWise.java

@@ -6,7 +6,13 @@
 
 package de.nplusc.izc.izpl.plugins.editor;
 
+import de.nplusc.izc.iZpl.API.IZPLApi;
+import de.nplusc.izc.iZpl.API.InvalidPlayListFileException;
 import de.nplusc.izc.iZpl.API.SinglePlayListItem;
+import de.nplusc.izc.tools.IOtools.FileTK;
+import de.nplusc.izc.tools.baseTools.Tools;
+import java.io.File;
+import java.util.Collections;
 import java.util.List;
 import javax.swing.DefaultListModel;
 import javax.swing.event.ListSelectionEvent;
@@ -30,19 +36,37 @@ public class EditorUIFileWise extends javax.swing.JPanel
         backingFile=f;
         paremtUI=ec;
         initComponents();
-        List<SinglePlayListItem> pld = backingFile.getEntries();
-        for (SinglePlayListItem spli : pld)
-        {
-            lm.addElement(new PLIWrapper(spli));
-        } 
+        refresh();
         lstElements.addListSelectionListener((ListSelectionEvent e) ->
         {
-           SinglePlayListItem itm =  ((PLIWrapper)lstElements.getSelectedValue()).pli;
-           select(itm);
+            PLIWrapper w = (PLIWrapper)lstElements.getSelectedValue();
+            if(w!=null)
+            {
+            SinglePlayListItem itm =  (w).pli;
+
+               select(itm);
+            }
            
         });
+        lstElements.setSelectedIndex(0);
+        recheckUIState();
     }
 
+    private void refresh()
+    {
+        lm.clear();
+        List<SinglePlayListItem> pld = backingFile.getEntries();
+        for (SinglePlayListItem spli : pld)
+        {
+            lm.addElement(new PLIWrapper(spli));
+        } 
+        
+        recheckUIState();
+    }
+    
+    
+    
+    
     private void select(SinglePlayListItem i)
     {
         pnlInclude.setVisible(false);
@@ -70,11 +94,19 @@ public class EditorUIFileWise extends javax.swing.JPanel
             pnlGroup.setVisible(true);
             iGroupNumber.setValue(i.getGID());
         }
+        recheckUIState();
     }
     
     public void resyncPriority()
     {
-
+        PLIWrapper w = (PLIWrapper)lstElements.getSelectedValue();
+        if(w!=null)
+        {
+        SinglePlayListItem itm =  (w).pli;
+        
+           select(itm);
+        }
+        recheckUIState();
     }
     
     
@@ -93,45 +125,142 @@ public class EditorUIFileWise extends javax.swing.JPanel
         bGInclude = new javax.swing.ButtonGroup();
         jScrollPane1 = new javax.swing.JScrollPane();
         lstElements = new javax.swing.JList();
-        jLabel3 = new javax.swing.JLabel();
-        iPath = new javax.swing.JTextField();
-        pathSelect = new javax.swing.JButton();
         jSeparator1 = new javax.swing.JSeparator();
         jSeparator2 = new javax.swing.JSeparator();
-        jButton2 = new javax.swing.JButton();
-        jButton3 = new javax.swing.JButton();
-        jButton4 = new javax.swing.JButton();
+        btnSublist = new javax.swing.JButton();
+        btnAddElement = new javax.swing.JButton();
+        btnZapElement = new javax.swing.JButton();
+        btnUp = new javax.swing.JButton();
+        btnDown = new javax.swing.JButton();
+        pnlEdit = new javax.swing.JPanel();
+        pathSelect = new javax.swing.JButton();
+        iPath = new javax.swing.JTextField();
+        pnlPrio = new javax.swing.JPanel();
+        oCalculatedPriority = new javax.swing.JLabel();
+        iPriority = new javax.swing.JSpinner();
+        jLabel2 = new javax.swing.JLabel();
+        pnlGroup = new javax.swing.JPanel();
+        iGroupNumber = new javax.swing.JSpinner();
+        jLabel4 = new javax.swing.JLabel();
         pnlInclude = new javax.swing.JPanel();
         jLabel5 = new javax.swing.JLabel();
         rbtnIExpand = new javax.swing.JRadioButton();
         rbtnINoexpand = new javax.swing.JRadioButton();
         btnLoadForEdit = new javax.swing.JButton();
         btnApply = new javax.swing.JButton();
-        pnlGroup = new javax.swing.JPanel();
-        iGroupNumber = new javax.swing.JSpinner();
-        jLabel4 = new javax.swing.JLabel();
-        pnlPrio = new javax.swing.JPanel();
-        oCalculatedPriority = new javax.swing.JLabel();
-        iPriority = new javax.swing.JSpinner();
-        jLabel2 = new javax.swing.JLabel();
         pnlTitel = new javax.swing.JPanel();
-        iTitle = new javax.swing.JTextField();
         jLabel1 = new javax.swing.JLabel();
+        iTitle = new javax.swing.JTextField();
+        jLabel3 = new javax.swing.JLabel();
 
         lstElements.setModel(lm);
         jScrollPane1.setViewportView(lstElements);
 
-        jLabel3.setText("Datei");
+        jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL);
+
+        btnSublist.setText("Neue Sub-Liste");
+        btnSublist.addActionListener(new java.awt.event.ActionListener()
+        {
+            public void actionPerformed(java.awt.event.ActionEvent evt)
+            {
+                btnSublistActionPerformed(evt);
+            }
+        });
+
+        btnAddElement.setText("Neues Element");
+        btnAddElement.addActionListener(new java.awt.event.ActionListener()
+        {
+            public void actionPerformed(java.awt.event.ActionEvent evt)
+            {
+                btnAddElementActionPerformed(evt);
+            }
+        });
+
+        btnZapElement.setText("Element entfernen");
+        btnZapElement.addActionListener(new java.awt.event.ActionListener()
+        {
+            public void actionPerformed(java.awt.event.ActionEvent evt)
+            {
+                btnZapElementActionPerformed(evt);
+            }
+        });
+
+        btnUp.setText("1 hoch");
+        btnUp.addActionListener(new java.awt.event.ActionListener()
+        {
+            public void actionPerformed(java.awt.event.ActionEvent evt)
+            {
+                btnUpActionPerformed(evt);
+            }
+        });
+
+        btnDown.setText("1 runter");
+        btnDown.addActionListener(new java.awt.event.ActionListener()
+        {
+            public void actionPerformed(java.awt.event.ActionEvent evt)
+            {
+                btnDownActionPerformed(evt);
+            }
+        });
 
         pathSelect.setText("Durchsuchen");
+        pathSelect.addActionListener(new java.awt.event.ActionListener()
+        {
+            public void actionPerformed(java.awt.event.ActionEvent evt)
+            {
+                pathSelectActionPerformed(evt);
+            }
+        });
 
-        jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL);
+        oCalculatedPriority.setText("Berechnete Priorität: 0");
 
-        jButton2.setText("Neue Sub-Liste");
+        jLabel2.setText("Priorität");
 
-        jButton3.setText("Neues Element");
+        javax.swing.GroupLayout pnlPrioLayout = new javax.swing.GroupLayout(pnlPrio);
+        pnlPrio.setLayout(pnlPrioLayout);
+        pnlPrioLayout.setHorizontalGroup(
+            pnlPrioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlPrioLayout.createSequentialGroup()
+                .addContainerGap()
+                .addComponent(jLabel2)
+                .addGap(30, 30, 30)
+                .addComponent(iPriority, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 38, Short.MAX_VALUE)
+                .addComponent(oCalculatedPriority)
+                .addGap(32, 32, 32))
+        );
+        pnlPrioLayout.setVerticalGroup(
+            pnlPrioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+            .addGroup(pnlPrioLayout.createSequentialGroup()
+                .addContainerGap()
+                .addGroup(pnlPrioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+                    .addComponent(oCalculatedPriority)
+                    .addComponent(iPriority, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                    .addComponent(jLabel2))
+                .addContainerGap(21, Short.MAX_VALUE))
+        );
+
+        jLabel4.setText("Group Number");
 
-        jButton4.setText("Element entfernen");
+        javax.swing.GroupLayout pnlGroupLayout = new javax.swing.GroupLayout(pnlGroup);
+        pnlGroup.setLayout(pnlGroupLayout);
+        pnlGroupLayout.setHorizontalGroup(
+            pnlGroupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlGroupLayout.createSequentialGroup()
+                .addContainerGap()
+                .addComponent(jLabel4)
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                .addComponent(iGroupNumber, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
+                .addContainerGap(42, Short.MAX_VALUE))
+        );
+        pnlGroupLayout.setVerticalGroup(
+            pnlGroupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlGroupLayout.createSequentialGroup()
+                .addGap(0, 11, Short.MAX_VALUE)
+                .addGroup(pnlGroupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+                    .addComponent(iGroupNumber, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                    .addComponent(jLabel4)))
+        );
 
         jLabel5.setText("Include-Modus");
 
@@ -176,56 +305,13 @@ public class EditorUIFileWise extends javax.swing.JPanel
         );
 
         btnApply.setText("Übernehmen");
-
-        jLabel4.setText("Group Number");
-
-        javax.swing.GroupLayout pnlGroupLayout = new javax.swing.GroupLayout(pnlGroup);
-        pnlGroup.setLayout(pnlGroupLayout);
-        pnlGroupLayout.setHorizontalGroup(
-            pnlGroupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlGroupLayout.createSequentialGroup()
-                .addContainerGap()
-                .addComponent(jLabel4)
-                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                .addComponent(iGroupNumber, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
-                .addContainerGap(42, Short.MAX_VALUE))
-        );
-        pnlGroupLayout.setVerticalGroup(
-            pnlGroupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlGroupLayout.createSequentialGroup()
-                .addGap(0, 11, Short.MAX_VALUE)
-                .addGroup(pnlGroupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
-                    .addComponent(iGroupNumber, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
-                    .addComponent(jLabel4)))
-        );
-
-        oCalculatedPriority.setText("Berechnete Priorität: 0");
-
-        jLabel2.setText("Priorität");
-
-        javax.swing.GroupLayout pnlPrioLayout = new javax.swing.GroupLayout(pnlPrio);
-        pnlPrio.setLayout(pnlPrioLayout);
-        pnlPrioLayout.setHorizontalGroup(
-            pnlPrioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlPrioLayout.createSequentialGroup()
-                .addContainerGap()
-                .addComponent(jLabel2)
-                .addGap(30, 30, 30)
-                .addComponent(iPriority, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
-                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 38, Short.MAX_VALUE)
-                .addComponent(oCalculatedPriority)
-                .addGap(32, 32, 32))
-        );
-        pnlPrioLayout.setVerticalGroup(
-            pnlPrioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-            .addGroup(pnlPrioLayout.createSequentialGroup()
-                .addContainerGap()
-                .addGroup(pnlPrioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
-                    .addComponent(oCalculatedPriority)
-                    .addComponent(iPriority, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
-                    .addComponent(jLabel2))
-                .addContainerGap(21, Short.MAX_VALUE))
-        );
+        btnApply.addActionListener(new java.awt.event.ActionListener()
+        {
+            public void actionPerformed(java.awt.event.ActionEvent evt)
+            {
+                btnApplyActionPerformed(evt);
+            }
+        });
 
         jLabel1.setText("Titel");
 
@@ -237,62 +323,108 @@ public class EditorUIFileWise extends javax.swing.JPanel
                 .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                 .addComponent(iTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 439, javax.swing.GroupLayout.PREFERRED_SIZE)
-                .addContainerGap(41, Short.MAX_VALUE))
+                .addContainerGap(64, Short.MAX_VALUE))
         );
         pnlTitelLayout.setVerticalGroup(
             pnlTitelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlTitelLayout.createSequentialGroup()
-                .addContainerGap(21, Short.MAX_VALUE)
+                .addContainerGap(25, Short.MAX_VALUE)
                 .addGroup(pnlTitelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                     .addComponent(jLabel1)
                     .addComponent(iTitle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                 .addContainerGap())
         );
 
+        jLabel3.setText("Datei");
+
+        javax.swing.GroupLayout pnlEditLayout = new javax.swing.GroupLayout(pnlEdit);
+        pnlEdit.setLayout(pnlEditLayout);
+        pnlEditLayout.setHorizontalGroup(
+            pnlEditLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+            .addGroup(pnlEditLayout.createSequentialGroup()
+                .addContainerGap()
+                .addGroup(pnlEditLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                    .addGroup(pnlEditLayout.createSequentialGroup()
+                        .addGap(10, 10, 10)
+                        .addComponent(pnlGroup, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+                    .addGroup(pnlEditLayout.createSequentialGroup()
+                        .addGroup(pnlEditLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlEditLayout.createSequentialGroup()
+                                .addGap(0, 0, Short.MAX_VALUE)
+                                .addComponent(pathSelect, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE))
+                            .addGroup(pnlEditLayout.createSequentialGroup()
+                                .addComponent(pnlPrio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                                .addGap(0, 0, Short.MAX_VALUE)))
+                        .addContainerGap())
+                    .addGroup(pnlEditLayout.createSequentialGroup()
+                        .addComponent(pnlInclude, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                        .addGap(0, 0, Short.MAX_VALUE))))
+            .addGroup(pnlEditLayout.createSequentialGroup()
+                .addGroup(pnlEditLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                    .addGroup(pnlEditLayout.createSequentialGroup()
+                        .addGap(36, 36, 36)
+                        .addComponent(btnApply))
+                    .addGroup(pnlEditLayout.createSequentialGroup()
+                        .addGap(18, 18, 18)
+                        .addGroup(pnlEditLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                            .addGroup(pnlEditLayout.createSequentialGroup()
+                                .addComponent(jLabel3)
+                                .addGap(18, 18, 18)
+                                .addComponent(iPath, javax.swing.GroupLayout.PREFERRED_SIZE, 437, javax.swing.GroupLayout.PREFERRED_SIZE))
+                            .addComponent(pnlTitel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
+                .addGap(0, 153, Short.MAX_VALUE))
+        );
+        pnlEditLayout.setVerticalGroup(
+            pnlEditLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+            .addGroup(pnlEditLayout.createSequentialGroup()
+                .addContainerGap()
+                .addComponent(pnlTitel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                .addGroup(pnlEditLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                    .addGroup(pnlEditLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+                        .addComponent(pathSelect)
+                        .addComponent(iPath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+                    .addComponent(jLabel3))
+                .addGap(41, 41, 41)
+                .addComponent(pnlPrio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+                .addComponent(pnlGroup, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                .addGap(34, 34, 34)
+                .addComponent(pnlInclude, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                .addComponent(btnApply)
+                .addGap(36, 36, 36))
+        );
+
         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
         this.setLayout(layout);
         layout.setHorizontalGroup(
             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
             .addGroup(layout.createSequentialGroup()
-                .addContainerGap()
-                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 216, javax.swing.GroupLayout.PREFERRED_SIZE)
+                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                    .addGroup(layout.createSequentialGroup()
+                        .addContainerGap()
+                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 216, javax.swing.GroupLayout.PREFERRED_SIZE))
+                    .addGroup(layout.createSequentialGroup()
+                        .addGap(64, 64, 64)
+                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+                            .addComponent(btnDown, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                            .addComponent(btnUp, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                 .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
-                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                     .addGroup(layout.createSequentialGroup()
+                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+                            .addComponent(btnSublist, javax.swing.GroupLayout.DEFAULT_SIZE, 139, Short.MAX_VALUE)
+                            .addComponent(btnAddElement, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                            .addComponent(btnZapElement, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+                        .addGap(582, 582, 582))
+                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
+                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
-                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 223, Short.MAX_VALUE)
-                                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 749, javax.swing.GroupLayout.PREFERRED_SIZE))
-                            .addGroup(layout.createSequentialGroup()
-                                .addGap(21, 21, 21)
-                                .addComponent(jLabel3)
-                                .addGap(18, 18, 18)
-                                .addComponent(iPath)
-                                .addGap(12, 12, 12)
-                                .addComponent(pathSelect, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE))
-                            .addGroup(layout.createSequentialGroup()
-                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-                                    .addGroup(layout.createSequentialGroup()
-                                        .addGap(31, 31, 31)
-                                        .addComponent(btnApply))
-                                    .addGroup(layout.createSequentialGroup()
-                                        .addGap(18, 18, 18)
-                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-                                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
-                                                .addComponent(pnlPrio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
-                                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-                                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
-                                                        .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, 139, Short.MAX_VALUE)
-                                                        .addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
-                                                        .addComponent(jButton4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
-                                                    .addComponent(pnlInclude, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
-                                            .addComponent(pnlGroup, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
-                                .addGap(0, 0, Short.MAX_VALUE)))
-                        .addContainerGap())
-                    .addGroup(layout.createSequentialGroup()
-                        .addGap(18, 18, 18)
-                        .addComponent(pnlTitel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                            .addComponent(pnlEdit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                            .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 687, javax.swing.GroupLayout.PREFERRED_SIZE))
                         .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
         );
         layout.setVerticalGroup(
@@ -302,31 +434,24 @@ public class EditorUIFileWise extends javax.swing.JPanel
                     .addGroup(layout.createSequentialGroup()
                         .addContainerGap()
                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-                            .addComponent(jScrollPane1)
-                            .addComponent(jSeparator2)))
-                    .addGroup(layout.createSequentialGroup()
-                        .addComponent(pnlTitel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
-                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
-                            .addComponent(jLabel3)
-                            .addComponent(iPath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
-                            .addComponent(pathSelect))
-                        .addGap(69, 69, 69)
-                        .addComponent(pnlPrio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                            .addComponent(jSeparator2)
+                            .addGroup(layout.createSequentialGroup()
+                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 538, javax.swing.GroupLayout.PREFERRED_SIZE)
+                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+                                .addComponent(btnUp)
+                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                                .addComponent(btnDown))))
+                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+                        .addGap(5, 5, 5)
+                        .addComponent(pnlEdit, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                        .addComponent(pnlGroup, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
-                        .addGap(23, 23, 23)
-                        .addComponent(pnlInclude, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
-                        .addGap(72, 72, 72)
-                        .addComponent(btnApply)
-                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                         .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                         .addGap(18, 18, 18)
-                        .addComponent(jButton2)
+                        .addComponent(btnSublist)
                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
-                        .addComponent(jButton3)
+                        .addComponent(btnAddElement)
                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                        .addComponent(jButton4)))
+                        .addComponent(btnZapElement)))
                 .addContainerGap())
         );
     }// </editor-fold>//GEN-END:initComponents
@@ -336,21 +461,147 @@ public class EditorUIFileWise extends javax.swing.JPanel
         SinglePlayListItem itm =  ((PLIWrapper)lstElements.getSelectedValue()).pli;
         paremtUI.openFileTab(itm);
     }//GEN-LAST:event_btnLoadForEditActionPerformed
-    
-  
+
+    private void btnApplyActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnApplyActionPerformed
+    {//GEN-HEADEREND:event_btnApplyActionPerformed
+        SinglePlayListItem i =  ((PLIWrapper)lstElements.getSelectedValue()).pli;
+        boolean include = i.isIncludeElement();
+        if(include && !(FileTK.getFileExt(iPath.getText()).equalsIgnoreCase("izpl")))
+        {
+            i.setIncludeElements(false, false);
+        }
+        if(!include&&(FileTK.getFileExt(iPath.getText()).equalsIgnoreCase("izpl")))
+        {
+            i.setIncludeElements(true, rbtnINoexpand.isSelected());
+        }
+        include = i.isIncludeElement(); //resync
+        i.setTargetPlaycount(Integer.valueOf(iPriority.getValue()+""));
+        i.setPath(iPath.getText());
+        if(include)
+        {
+             i.setIncludeElements(true, rbtnINoexpand.isSelected());
+             paremtUI.recalculatePriorities(backingFile);
+        }
+        else
+        {
+            i.setTitle(i.getTitle().split(",")[0]+","+iTitle.getText());
+             i.setGID(Integer.valueOf(iGroupNumber.getValue()+""));
+             select(i);
+        }
+        paremtUI.pack();
+    }//GEN-LAST:event_btnApplyActionPerformed
+
+    private void btnAddElementActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnAddElementActionPerformed
+    {//GEN-HEADEREND:event_btnAddElementActionPerformed
+        SinglePlayListItem i = new SinglePlayListItem("C:\\test.mp3", "##EXTINF:0,Neues Element", 1);
+        backingFile.getEntries().add(i);
+        refresh();
+        lstElements.setSelectedValue(new PLIWrapper(i), true);
+        //select(i);
+        recheckUIState();
+    }//GEN-LAST:event_btnAddElementActionPerformed
+
+    private void pathSelectActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_pathSelectActionPerformed
+    {//GEN-HEADEREND:event_pathSelectActionPerformed
+        String p = Tools.FileChooseDlg(paremtUI);
+        if(!p.equals(""))
+        {
+            iPath.setText(p);
+        }
+    }//GEN-LAST:event_pathSelectActionPerformed
+
+    private void btnZapElementActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnZapElementActionPerformed
+    {//GEN-HEADEREND:event_btnZapElementActionPerformed
+        PLIWrapper w = (PLIWrapper)lstElements.getSelectedValue();
+        if(w!=null)
+        {
+        SinglePlayListItem itm =  (w).pli;
+            if(itm.isIncludeElement())
+            {
+                paremtUI.zapFile(itm);
+            }
+            backingFile.getEntries().remove(itm);
+            refresh();
+        }
+        paremtUI.pack();
+        recheckUIState();
+    }//GEN-LAST:event_btnZapElementActionPerformed
+
+    private void recheckUIState()
+    {
+        int lsi=lstElements.getSelectedIndex();
+        int lsm=lm.getSize();
+        pnlEdit.setVisible(lsi!=-1);
+        btnZapElement.setEnabled(lsi!=-1);
+        btnUp.setEnabled(lsi!=-1&&lsi<lsm-1);
+        btnDown.setEnabled(lsi!=-1&&lsi>0);
+    }
+
+    private void btnUpActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnUpActionPerformed
+    {//GEN-HEADEREND:event_btnUpActionPerformed
+        int si = lstElements.getSelectedIndex();
+        if(si>0)
+        {
+            List<SinglePlayListItem> data = backingFile.getEntries();
+            Collections.swap(data, si-1, si);
+        }
+        refresh();
+    }//GEN-LAST:event_btnUpActionPerformed
+
+    private void btnDownActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnDownActionPerformed
+    {//GEN-HEADEREND:event_btnDownActionPerformed
+        int si = lstElements.getSelectedIndex();
+        if(si<lm.getSize()-1)
+        {
+            List<SinglePlayListItem> data = backingFile.getEntries();
+            Collections.swap(data, si, si+1);
+        }
+        refresh();
+    }//GEN-LAST:event_btnDownActionPerformed
+
+    private void btnSublistActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnSublistActionPerformed
+    {//GEN-HEADEREND:event_btnSublistActionPerformed
+        String fp = Tools.FileChooseDlg(paremtUI, true,false,new String[]{"izpl"});
+        if(!fp.equals(""))
+        {
+            if(new File(fp).exists())
+            {
+                
+                try
+                {
+                    ((Editor)IZPLApi.getSelectedFeature()).loadPlayListIntoGraph(fp, 20, backingFile);
+                    ((Editor)IZPLApi.getSelectedFeature()).getParseGraph().generateLookupCache();
+                    refresh();
+                    
+                    
+                }
+                catch (InvalidPlayListFileException ex)
+                {
+                    ex.printStackTrace();
+                }
+            }
+            else
+            {
+                
+            }
+        }
+    }//GEN-LAST:event_btnSublistActionPerformed
+
     
 
     // Variables declaration - do not modify//GEN-BEGIN:variables
     private javax.swing.ButtonGroup bGInclude;
+    private javax.swing.JButton btnAddElement;
     private javax.swing.JButton btnApply;
+    private javax.swing.JButton btnDown;
     private javax.swing.JButton btnLoadForEdit;
+    private javax.swing.JButton btnSublist;
+    private javax.swing.JButton btnUp;
+    private javax.swing.JButton btnZapElement;
     private javax.swing.JSpinner iGroupNumber;
     private javax.swing.JTextField iPath;
     private javax.swing.JSpinner iPriority;
     private javax.swing.JTextField iTitle;
-    private javax.swing.JButton jButton2;
-    private javax.swing.JButton jButton3;
-    private javax.swing.JButton jButton4;
     private javax.swing.JLabel jLabel1;
     private javax.swing.JLabel jLabel2;
     private javax.swing.JLabel jLabel3;
@@ -362,6 +613,7 @@ public class EditorUIFileWise extends javax.swing.JPanel
     private javax.swing.JList lstElements;
     private javax.swing.JLabel oCalculatedPriority;
     private javax.swing.JButton pathSelect;
+    private javax.swing.JPanel pnlEdit;
     private javax.swing.JPanel pnlGroup;
     private javax.swing.JPanel pnlInclude;
     private javax.swing.JPanel pnlPrio;

+ 41 - 13
iZplPlugins/Editor/src/main/java/de/nplusc/izc/izpl/plugins/editor/ListIncludeGraph.java

@@ -10,6 +10,8 @@ import de.nplusc.izc.iZpl.API.SinglePlayListItem;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 
 /**
  *
@@ -17,13 +19,20 @@ import java.util.List;
  */
 public class ListIncludeGraph
 {
+    
+    private static final Logger l = LogManager.getLogger();
     private HashMap<PlayListFile,PlayListFile> upMap = new HashMap<>();
     private HashMap<PlayListFile,List<PlayListFile>> downMap = new HashMap<>();
-    HashMap<String, PlayListFile> lookupCCH;
+    private HashMap<String, PlayListFile> lookupCache  = new HashMap<>();
     public HashMap<PlayListFile, PlayListFile> getUpMap()
     {
         return upMap;
     }
+
+    public HashMap<String, PlayListFile> getLookupCache()
+    {
+        return lookupCache;
+    }
     
 
     public void setUpMap(HashMap<PlayListFile, PlayListFile> upMap)
@@ -52,16 +61,17 @@ public class ListIncludeGraph
         }
         return new ArrayList<>();
     }
-    public HashMap<String,PlayListFile> generateLookupCache()
+    public void generateLookupCache()
     {
-        HashMap<String, PlayListFile> cch = new HashMap<>();
-        upMap.forEach((f,g)->cch.put(f.getPath(), f));
-        lookupCCH=cch;
-        return cch;
+        lookupCache.clear();
+        upMap.forEach((f,g)->{
+            lookupCache.put(f.getPath(), f);
+            l.trace(f.getPath());
+                });
     }
     
     
-    public PlayListFile getParentList(PlayListFile reference)
+   /* public PlayListFile getParentList(PlayListFile reference)
     {
         if(upMap.containsKey(reference))
         {
@@ -69,7 +79,7 @@ public class ListIncludeGraph
         }
         return null;
     }
-    
+    */
     public void addListLink(PlayListFile parent,PlayListFile newList) throws InvalidGraphReferenceException, DupeAddException
     {
         //parent=null ist für die rootListe notwendig um die zu registrieren
@@ -91,7 +101,10 @@ public class ListIncludeGraph
             }
             else
             {
-                throw new InvalidGraphReferenceException();
+                l.trace("INIT:"+parent.getPath()+"|"+newList.getPath());
+                downMap.put(parent, new ArrayList<>());
+                downMap.get(parent).add(newList);
+                upMap.put(newList, parent);
             }
         }
     }
@@ -113,7 +126,7 @@ public class ListIncludeGraph
     public void recalcPriorities(PlayListFile f)
     {
         int basePriority = f.getCalculatedBasePriority();
-        if(lookupCCH==null)
+        if(lookupCache==null)
         {
             generateLookupCache();
         }
@@ -122,10 +135,25 @@ public class ListIncludeGraph
             if(pi.isIncludeElement())
             {
                 int intPrio=pi.getTargetPlaycount()*basePriority;
-                lookupCCH.get(pi.getPath()).setCalculatedBasePriority(intPrio);
-                recalcPriorities(lookupCCH.get(pi.getPath()));
+                l.trace(pi.getPath());
+                lookupCache.get(pi.getPath()).setCalculatedBasePriority(intPrio);
+                recalcPriorities(lookupCache.get(pi.getPath()));
             }
         }
-        
+    }
+    public void zapElement(PlayListFile f)
+    {
+        List<PlayListFile> lstElements = downMap.get(f);
+        if(lstElements!=null)
+        {
+            for (PlayListFile playListFile : lstElements)
+            {
+                zapElement(playListFile);
+                //upMap.remove(playListFile);
+            }
+
+            downMap.remove(f);
+        }
+        upMap.remove(f);
     }
 }