/*
 This file is part of the software framework JStatCom, 
 a library for building applications for data based analysis.

 Copyright (C) 2000-2005  Markus Kraetzig

 This library is free software; you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as
 published by the Free Software Foundation; either version 2.1 of the
 License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful, but
 WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public
 License along with this library; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 USA
 */

package com.jstatcom.ts;

import java.net.URL;

import javax.swing.ImageIcon;
import javax.swing.JPanel;

import org.apache.log4j.Logger;

import com.jstatcom.model.ModelFrame;

/**
 * Frame containing the TSCalculator. This component can be used
 * as a stand-alone container that provides time series calculation features
 * with TSCalc.
 * 
 * @see com.jstatcom.parser.CalcEngine
 * @author Markus Kraetzig
 */
public final class TSCalcFrame extends ModelFrame {
    private static final Logger log = Logger.getLogger(TSCalcFrame.class);

    private JPanel contentPane = null;

    private TSCalculator ivjTSCalculator = null;

    /**
     * TSCalcFrame default constructor.
     */
    public TSCalcFrame() {
        super();
        initialize();
    }

    /**
     * Return the InternalFrameContentPane property value.
     * 
     * @return javax.swing.JPanel
     */
    /* WARNING: THIS METHOD WILL BE REGENERATED. */
    private javax.swing.JPanel getInternalFrameContentPane() {
        if (contentPane == null) {
            try {
                contentPane = new javax.swing.JPanel();
                contentPane.setName("InternalFrameContentPane");
                contentPane.setLayout(new javax.swing.BoxLayout(
                        getInternalFrameContentPane(),
                        javax.swing.BoxLayout.X_AXIS));
                getInternalFrameContentPane().add(getTSCalculator(),
                        getTSCalculator().getName());
                // user code begin {1}
                // user code end
            } catch (Throwable ivjExc) {
                // user code begin {2}
                // user code end
                handleException(ivjExc);
            }
        }
        return contentPane;
    }

    /**
     * Return the TSCalculator property value.
     * 
     * @return com.jstatcom.timeseries.TSCalculator
     */
    /* WARNING: THIS METHOD WILL BE REGENERATED. */
    private TSCalculator getTSCalculator() {
        if (ivjTSCalculator == null) {
            try {
                ivjTSCalculator = new TSCalculator();
                ivjTSCalculator.setName("TSCalculator");
                // user code begin {1}
                // user code end
            } catch (Throwable ivjExc) {
                // user code begin {2}
                // user code end
                handleException(ivjExc);
            }
        }
        return ivjTSCalculator;
    }

    /**
     * Called whenever the part throws an exception.
     * 
     * @param exception
     *            Exception
     */
    private void handleException(Throwable exception) {

        log.error("Unhandled Exception", exception);
    }

    /**
     * Initialize the class.
     */
    /* WARNING: THIS METHOD WILL BE REGENERATED. */
    private void initialize() {
        try {
            // user code begin {1}
            // user code end
            setName("TSCalcFrame");
            setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
            setSize(700, 500);
            setMinimumSize(new java.awt.Dimension(700, 500));
            setTitle("TS Calculator");
            setContentPane(getInternalFrameContentPane());
        } catch (Throwable ivjExc) {
            handleException(ivjExc);
        }
        // user code begin {2}
        URL url = getClass().getResource("/images/tscalc.gif");
        if (url != null)
            setFrameIcon(new ImageIcon(url));

        // user code end
    }
}
 

Ads help maintain this website.