/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package de.drop_converter.components;

import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import de.drop_converter.PluginHandler;
import de.drop_converter.PluginWrapper;

/**
 * Configure the installed plugins.
 * 
 * @author Thomas Chojecki
 */
public class JPluginConfiguration extends JPanel
{
  private final PluginHandler pluginHandler;

  private JList<PluginWrapper> pluginList;

  private JTable pluginOverviewe = new JTable();

  public JPluginConfiguration(PluginHandler pluginHandler)
  {
    this.pluginHandler = pluginHandler;

    add(new JLabel("Dummy plugin configuration."));

    // Set<PluginWrapper> plugins = pluginHandler.getPlugins();

    add(new JScrollPane(pluginOverviewe));

  }
}

@@ -237,16 +237,96 @@
 nents;%0A%0A
+import java.awt.BorderLayout;%0Aimport java.util.Iterator;%0Aimport java.util.Set;%0A%0A
 import j
@@ -337,21 +337,24 @@
 .swing.J
-Label
+CheckBox
 ;%0Aimport
@@ -368,19 +368,20 @@
 swing.JL
-ist
+abel
 ;%0Aimport
@@ -459,16 +459,60 @@
 .JTable;
+%0Aimport javax.swing.table.DefaultTableModel;
 %0A%0Aimport
@@ -584,16 +584,66 @@
 Wrapper;
+%0Aimport de.drop_converter.listener.PluginListener;
 %0A%0A/**%0A *
@@ -759,16 +759,42 @@
 s JPanel
+ implements PluginListener
 %0A%7B%0A  pri
@@ -848,39 +848,37 @@
 ate 
-JList%3CPluginWrapper%3E pluginList
+final DefaultTableModel model
 ;%0A%0A 
@@ -886,16 +886,22 @@
 private 
+final 
 JTable p
@@ -918,23 +918,8 @@
 iewe
- = new JTable()
 ;%0A%0A 
@@ -1020,16 +1020,93 @@
 andler;%0A
+    pluginHandler.addPluginListener(this);%0A    setLayout(new BorderLayout());
 %0A    add
@@ -1151,18 +1151,35 @@
 n.%22)
+, BorderLayout.NORTH
 );%0A%0A   
- //
  Set
@@ -1236,51 +1236,855 @@
 ();%0A
-%0A    add(new JScrollPane(pluginOverviewe));
+    Iterator%3CPluginWrapper%3E it = plugins.iterator();%0A%0A    String%5B%5D t = new String%5B%5D %7B %22Name%22, %22Description%22, %22Version%22, %22Website%22, %22Author%22, %22Email%22, %22Enabled?%22 %7D;%0A    model = new DefaultTableModel(t, 0);%0A    %0A    while (it.hasNext()) %7B%0A      addPlugin((PluginWrapper) it.next());%0A    %7D%0A%0A    pluginOverviewe = new JTable(model);%0A    add(new JScrollPane(pluginOverviewe), BorderLayout.CENTER);%0A%0A  %7D%0A%0A  private void addPlugin(PluginWrapper p)%0A  %7B%0A    Object%5B%5D v = new Object%5B%5D %7B p.getPluginName(), p.getPluginDescription(), p.getPluginVersion(), %0A                                p.getPluginWebsite(), p.getAuthorName(),p.getAuthorEmail(), new JCheckBox(%22%22, true) %7D;%0A    model.addRow(v);%0A  %7D%0A%0A  @Override%0A  public void addedPlugin(PluginWrapper plugin)%0A  %7B%0A    addPlugin(plugin);%0A  %7D%0A%0A  @Override%0A  public void removedPlugin(PluginWrapper plugin)%0A  %7B
 %0A%0A  

add new plugin configuration. - overview with the loaded plugins - tabs with specific plugin configuration