package org.jhv.dataset.tree.views;
/**
 * @author Freek Verstringe
 */
import org.jhv.dataset.tree.views.FixedHeightButton;
import javax.swing.JPanel;

import org.helioviewer.jhv.layers.LayerDescriptor;
import org.jhv.dataset.tree.actions.IntervalListener;
import org.jhv.dataset.tree.models.DatasetInterval;
import org.jhv.dataset.tree.models.DatasetLayerTreeModel;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.util.ArrayList;
import java.util.TreeMap;

public class IntervalPanel extends JPanel implements IntervalListener{
	private static final long serialVersionUID = 4342443227686604174L;
	
	private FixedHeightButton buttonLeft;
	private FixedHeightButton buttonCenter;
	private FixedHeightButton buttonRight;
	
	private JPanel typePanelContainer;
	private ArrayList<JPanel> typePanels;
	DatasetInterval model;
	
	public IntervalPanel( DatasetInterval model) {
		super();
		this.model = model;
		setLayout(new BorderLayout(0, 0));
		
		buttonLeft = new FixedHeightButton("l");
		FixedHeightButton spacerLeft = new FixedHeightButton("s");
		JPanel left = new JPanel();
		left.setLayout(new FlowLayout());
		left.add(spacerLeft);
		left.add(buttonLeft);
		
		add(left, BorderLayout.WEST);
		
		buttonCenter = new FixedHeightButton("c");
		add(buttonCenter, BorderLayout.CENTER);
		
		buttonRight = new FixedHeightButton("r");
		add(buttonRight, BorderLayout.EAST);
		
		typePanels = new ArrayList<JPanel> ();
		typePanelContainer = new JPanel();
		typePanelContainer.setLayout(new GridLayout(typePanels.size(),1));

		add(typePanelContainer, BorderLayout.SOUTH);
		
	}
	
	public void addTypePanel(JPanel typePanel){
		this.typePanels.add(typePanel);
		typePanelContainer.add(typePanel);
	}
	
	public void updatePanel(TreeMap<String, ArrayList<LayerDescriptor> > types){
		for( ArrayList<LayerDescriptor> type : types.values()){
			TypePanel typePanel = new TypePanel(type);
			this.addTypePanel(typePanel);			
		}
	}

	@Override
	public void typeInserted(int idx) {
		TypePanel typePanel = new TypePanel(this.model.getType(idx));
		this.typePanels.add(idx, typePanel);		
	}

	@Override
	public void typeRemoved(int idx) {
		
	}	
}


@@ -1746,234 +1746,8 @@
 %0A%09%7D%0A
-%09%0A%09public void updatePanel(TreeMap%3CString, ArrayList%3CLayerDescriptor%3E %3E types)%7B%0A%09%09for( ArrayList%3CLayerDescriptor%3E type : types.values())%7B%0A%09%09%09TypePanel typePanel = new TypePanel(type);%0A%09%09%09this.addTypePanel(typePanel);%09%09%09%0A%09%09%7D%0A%09%7D
 %0A%0A%09@

Remove unused method.