package de.gurkenlabs.utiliti.swing.panels;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.Graphics2D;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextPane;
import javax.swing.border.LineBorder;
import javax.swing.text.BadLocationException;

import com.github.weisj.darklaf.components.ClosableTabbedPane;
import com.github.weisj.darklaf.components.tabframe.JTabFrame;
import com.github.weisj.darklaf.components.tabframe.TabbedPopup;
import com.github.weisj.darklaf.components.text.NonWrappingTextPane;
import com.github.weisj.darklaf.components.text.NumberedTextComponent;
import com.github.weisj.darklaf.components.text.NumberingPane;
import com.github.weisj.darklaf.util.Alignment;
import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.StringUtil;

import de.gurkenlabs.litiengine.Game;
import de.gurkenlabs.litiengine.environment.tilemap.IMap;
import de.gurkenlabs.litiengine.environment.tilemap.IMapObject;
import de.gurkenlabs.litiengine.environment.tilemap.IMapObjectLayer;
import de.gurkenlabs.litiengine.graphics.emitters.xml.CustomEmitter;
import de.gurkenlabs.litiengine.resources.Resources;
import de.gurkenlabs.litiengine.util.Imaging;
import de.gurkenlabs.utiliti.UndoManager;
import de.gurkenlabs.utiliti.swing.Icons;
import de.gurkenlabs.utiliti.swing.JCheckBoxList;
import de.gurkenlabs.utiliti.swing.PropertyListCellRenderer;

import javax.swing.GroupLayout;
import javax.swing.JRadioButton;
import java.awt.GridBagLayout;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.Collections;
import java.awt.GridBagConstraints;
import javax.swing.BoxLayout;
import javax.swing.DefaultListModel;

import java.awt.FlowLayout;
import javax.swing.JToolBar;
import javax.swing.SwingConstants;
import javax.swing.JSplitPane;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.AbstractListModel;
import javax.swing.ListSelectionModel;

public class UpdatedEmitterPanel extends PropertyPanel {
  private transient CustomEmitter emitter;
  private final DefaultListModel<JCheckBox> layerModel;

  private final String[] listItems = { "emission", "shape", "color", "size", "offset", "velocity", "acceleration", "collision" };
  private JPanel controlPanel;

  public UpdatedEmitterPanel() {
    super("panel_emitter", Icons.EMITTER);
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    JSplitPane splitPane = new JSplitPane();

    JList<JCheckBox> list = new JCheckBoxList();
    this.layerModel = new DefaultListModel<>();

    list.setModel(this.layerModel);
    this.initEmitterPropertyList();
    list.setSelectedIndex(0);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list.setCellRenderer(new PropertyListCellRenderer());

    splitPane.setLeftComponent(list);
    this.controlPanel = new JPanel();
    splitPane.setRightComponent(this.controlPanel);

    splitPane.setEnabled(true);
    splitPane.setDividerSize(1);
    add(splitPane);

    // this.setupChangedListeners();

  }

  private void initEmitterPropertyList() {
    for (String propertyGroup : listItems) {
      String localized = Resources.strings().get(String.format("emitter_%s", propertyGroup));
      JCheckBox newBox = new JCheckBox(localized);
      newBox.setName(localized);
      newBox.addItemListener(sel -> {

      });
      this.layerModel.addElement(newBox);
    }
  }

  private JPanel getGroup(String groupName) {
    return new JPanel();
  }
  // private void setupChangedListeners() {
  // this.btnPause.addActionListener(a -> {
  // if (this.emitter != null) {
  // this.emitter.togglePaused();
  // }
  //
  // if (!btnPause.isSelected()) {
  // this.btnPause.setIcon(Icons.PLAY);
  // } else {
  // this.btnPause.setIcon(Icons.PAUSE);
  // }
  // });
  // }

  @Override
  protected void clearControls() {
    // TODO Auto-generated method stub

  }

  @Override
  protected void setControlValues(IMapObject mapObject) {
    this.emitter = (CustomEmitter) Game.world().environment().getEmitter(mapObject.getId());

  }

}

@@ -53,19 +53,19 @@
 java
-.awt.Border
+x.swing.Box
 Layo
@@ -83,121 +83,32 @@
 java
-.awt.Color;%0Aimport java.awt.Component;%0Aimport java.awt.Font;%0Aimport java.awt.Graphics2D;%0A%0Aimport javax.swing.Icon
+x.swing.DefaultListModel
 ;%0Aim
@@ -128,17 +128,17 @@
 ing.
-ImageIcon
+JCheckBox
 ;%0Aim
@@ -160,12 +160,11 @@
 g.JL
-abel
+ist
 ;%0Aim
@@ -212,903 +212,159 @@
 ng.J
-TabbedPane;%0Aimport javax.swing.JTextPane;%0Aimport javax.swing.border.LineBorder;%0Aimport javax.swing.text.BadLocationException;%0A%0Aimport com.github.weisj.darklaf.components.ClosableTabbedPane;%0Aimport com.github.weisj.darklaf.components.tabframe.JTabFrame;%0Aimport com.github.weisj.darklaf.components.tabframe.TabbedPopup;%0Aimport com.github.weisj.darklaf.components.text.NonWrappingTextPane;%0Aimport com.github.weisj.darklaf.components.text.NumberedTextComponent;%0Aimport com.github.weisj.darklaf.components.text.NumberingPane;%0Aimport com.github.weisj.darklaf.util.Alignment;%0Aimport com.github.weisj.darklaf.util.DarkUIUtil;%0Aimport com.github.weisj.darklaf.util.StringUtil;%0A%0Aimport de.gurkenlabs.litiengine.Game;%0Aimport de.gurkenlabs.litiengine.environment.tilemap.IMap;%0Aimport de.gurkenlabs.litiengine.environment.tilemap.IMapObject;%0Aimport de.gurkenlabs.litiengine.environment.tilemap.IMapObjectLayer
+SplitPane;%0Aimport javax.swing.ListSelectionModel;%0A%0Aimport de.gurkenlabs.litiengine.Game;%0Aimport de.gurkenlabs.litiengine.environment.tilemap.IMapObject
 ;%0Aim
@@ -487,96 +487,8 @@
 es;%0A
-import de.gurkenlabs.litiengine.util.Imaging;%0Aimport de.gurkenlabs.utiliti.UndoManager;%0A
 impo
@@ -578,710 +578,8 @@
 ist;
-%0Aimport de.gurkenlabs.utiliti.swing.PropertyListCellRenderer;%0A%0Aimport javax.swing.GroupLayout;%0Aimport javax.swing.JRadioButton;%0Aimport java.awt.GridBagLayout;%0Aimport java.awt.image.BufferedImage;%0Aimport java.util.ArrayList;%0Aimport java.util.Collections;%0Aimport java.awt.GridBagConstraints;%0Aimport javax.swing.BoxLayout;%0Aimport javax.swing.DefaultListModel;%0A%0Aimport java.awt.FlowLayout;%0Aimport javax.swing.JToolBar;%0Aimport javax.swing.SwingConstants;%0Aimport javax.swing.JSplitPane;%0Aimport javax.swing.JButton;%0Aimport javax.swing.JCheckBox;%0Aimport javax.swing.JComboBox;%0Aimport javax.swing.JComponent;%0Aimport javax.swing.JList;%0Aimport javax.swing.AbstractListModel;%0Aimport javax.swing.ListSelectionModel;
 %0A%0Apu
@@ -1339,66 +1339,8 @@
 ON);
-%0A    list.setCellRenderer(new PropertyListCellRenderer());
 %0A%0A  

Clean up updated emitter panel.