/*
 *  Internal frame for simulator inspection
 *
 *  2004 - 2011 Frantisek Zboril jr.
 *  Faculty of Information Technology
 *  zborilf@fit.vutbr.cz
 *  http://www.fit.vutbr.cz/~zborilf
 *
 * (C) Brno University of Technology
 * Freeware licence VUT v Brně
 * https://wis.fit.vutbr.cz/FIT/db/dir.php/dr/VZ2007/externiInformace/softwareNaWebu/Priloha2_rozh23.pdf

 */

package jTGUI;

import jTMass.TMass;
import jTMass.core.jTMassSimulator.TSimulator;


public class TSimulatorInternalFrame extends javax.swing.JInternalFrame {

    public TSimulator PSimulator;
    public TMass PTMass;
    TConnectionsPanel PConnectionsPanel;

    public void updateConnections(){
        PConnectionsPanel.setConnections();
    }

    // ===== CONSTRUCTOR =====

    public TSimulatorInternalFrame(TSimulator simulator, TMass tmass) {
        initComponents();
        TCalendarPanel PCalendarPanel=new TCalendarPanel(simulator.getCalendar().getEventList());
        TCalendarPanel PHistoryPanel=new TCalendarPanel(simulator.getCalendar().getHistoryList());
        PSimulatorTabbedPane.add(PCalendarPanel,0);
        PSimulatorTabbedPane.setTitleAt(0, "Calendar");
        PConnectionsPanel=new TConnectionsPanel(simulator,tmass);
        this.setTitle(simulator.getElementName());
        PSimulatorTabbedPane.add(PConnectionsPanel,1);
        PSimulatorTabbedPane.setTitleAt(1, "Connections");
        PSimulatorTabbedPane.add(PHistoryPanel,2);
        PSimulatorTabbedPane.setTitleAt(2, "History");
        PSimulator=simulator;
        PTMass=tmass;
        TMass.getSimulator().getCalendar().setPanels(PCalendarPanel, PHistoryPanel);
    }

    public TSimulatorInternalFrame() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        PSimulatorTabbedPane = new javax.swing.JTabbedPane();

        setClosable(true);
        setIconifiable(true);
        setMaximizable(true);
        setResizable(true);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(PSimulatorTabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(PSimulatorTabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 345, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTabbedPane PSimulatorTabbedPane;
    // End of variables declaration//GEN-END:variables

}
