/*
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 javax.swing.border.BevelBorder;
import org.apache.log4j.Logger;
import com.jstatcom.model.ModelPanel;
/**
* A GUI that combines the TSCalculatorPanel with a
* TSSelector that builds a self contained panel for creating new
* time series by combining existing ones with arithmetic operations and
* functions. The TSCalculator needs a to be put in a container
* subclassing ModelPanel or ModelFrame.
*
* @see com.jstatcom.ts.TSCalculatorPanel
* @see com.jstatcom.parser.CalcEngine
*
* @author Markus Kraetzig
*/
public final class TSCalculator extends ModelPanel {
private static final Logger log = Logger.getLogger(TSCalculator.class);
// The ListModel for the variable list.
private TSSel ivjSelectPanel = null;
private TSCalculatorPanel ivjTSCalculatorPanel = null;
IvjEventHandler ivjEventHandler = new IvjEventHandler();
class IvjEventHandler implements java.beans.PropertyChangeListener {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
if (evt.getSource() == TSCalculator.this.getSelectPanel()
&& (evt.getPropertyName().equals("selectionChanged")))
connEtoM1();
};
};
/**
* TSCalculator default constructor.
*/
public TSCalculator() {
super();
initialize();
}
/**
* connEtoM1: (SelectPanel.selectionChanged -->
* TSCalculatorPanel.selectionChanged()V)
*
* @param arg1
* java.beans.PropertyChangeEvent
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void connEtoM1() {
try {
// user code begin {1}
// user code end
getTSCalculatorPanel().selectionChanged();
// user code begin {2}
// user code end
} catch (Throwable ivjExc) {
// user code begin {3}
// user code end
handleException(ivjExc);
}
}
/**
* Return the SelectPanel property value.
*
* @return program.tools.TSSelector
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private TSSel getSelectPanel() {
if (ivjSelectPanel == null) {
try {
ivjSelectPanel = new TSSel();
ivjSelectPanel.setName("SelectPanel");
ivjSelectPanel.setDatesEditable(false);
ivjSelectPanel
.setAllStringsName(TSCalculatorPanel.ALL_STRINGS_DEF.name);
ivjSelectPanel.setCheckNaN(false);
// user code begin {1}
// user code end
} catch (Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjSelectPanel;
}
/**
* Return the TSCalculatorPanel property value.
*
* @return com.jstatcom.timeseries.TSCalculatorPanel
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private TSCalculatorPanel getTSCalculatorPanel() {
if (ivjTSCalculatorPanel == null) {
try {
ivjTSCalculatorPanel = new com.jstatcom.ts.TSCalculatorPanel();
ivjTSCalculatorPanel.setName("TSCalculatorPanel");
ivjTSCalculatorPanel.setMinimumSize(new java.awt.Dimension(400,
483));
// user code begin {1}
// user code end
} catch (Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjTSCalculatorPanel;
}
/**
* Called whenever the part throws an exception.
*
* @param exception
* Exception
*/
private void handleException(Throwable exception) {
log.error("Unhandled Exception", exception);
}
/**
* Initializes connections
*
* @exception Exception
* The exception description.
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void initConnections() throws Exception {
// user code begin {1}
// user code end
getSelectPanel().addPropertyChangeListener(ivjEventHandler);
}
/**
* Initialize the class.
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void initialize() {
try {
// user code begin {1}
// user code end
setName("TSCalculator");
setBorder(new BevelBorder(BevelBorder.LOWERED));
setLayout(new java.awt.GridBagLayout());
setSize(734, 526);
java.awt.GridBagConstraints constraintsSelectPanel = new java.awt.GridBagConstraints();
constraintsSelectPanel.gridx = 1;
constraintsSelectPanel.gridy = 0;
constraintsSelectPanel.gridheight = 3;
constraintsSelectPanel.fill = java.awt.GridBagConstraints.VERTICAL;
add(getSelectPanel(), constraintsSelectPanel);
java.awt.GridBagConstraints constraintsTSCalculatorPanel = new java.awt.GridBagConstraints();
constraintsTSCalculatorPanel.gridx = 0;
constraintsTSCalculatorPanel.gridy = 0;
constraintsTSCalculatorPanel.fill = java.awt.GridBagConstraints.BOTH;
constraintsTSCalculatorPanel.weightx = 1.0;
constraintsTSCalculatorPanel.weighty = 1.0;
add(getTSCalculatorPanel(), constraintsTSCalculatorPanel);
initConnections();
} catch (Throwable ivjExc) {
handleException(ivjExc);
}
// user code begin {2}
// user code end
}
}
Ads help maintain this website.