package scriptbuilder.gui.panels;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.util.List;
import javax.swing.JPanel;
import scriptbuilder.structures.SimulationScript;

/**
 * Represents the underlying panel for the main GUI timeline. Contains all the
 * timeline panels which sit on top of each other. May be unused in current
 * implementation.
 *
 * @author Greg Eddington <geddingt@calpoly.edu>
 * @author Bryan McGuffin
 */
public class IncidentsPanel extends JPanel
{

    private SimulationScript script;
    private TimelineTickPanel timelineTickPanel;
    private List<IncidentTimelinePanel> incidentPanels;
    private List<IncidentNumberPanel> numberPanels;

    /**
     * Install the script model into this object.
     *
     * @param script
     */
    public void setScript(SimulationScript script)
    {
        this.script = script;

        timelineTickPanel.update(script);
    }

    /**
     * Constructor. Set up new timeline tick panel.
     */
    public IncidentsPanel()
    {
        super();

        timelineTickPanel = new TimelineTickPanel();
        this.add(timelineTickPanel);
    }

    /**
     * Refresh the timelineTickPanel.
     *
     * @param g Graphics component
     */
    @Override
    public void paint(Graphics g)
    {
        super.paint(g);

        Graphics2D g2d = (Graphics2D) g;
        timelineTickPanel.paint(g);
    }
}
