package jas2.cuts;
import jas2.jds.interfaces.CutProperties;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import jas2.swingstudio.*;
import jas2.util.*;
import javax.swing.*;
public final class DoubleCutPanel extends CutPropertiesPanel
{
public DoubleCutPanel()
{
setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.anchor = GridBagConstraints.WEST;
c.gridwidth = 2;
c.gridx = 0;
c.gridy = 0;
add(m_partition, c);
c.gridy = 1;
add(m_equal, c);
c.gridy = 2;
add(m_less, c);
c.gridy = 3;
add(m_greater, c);
c.gridy = 4;
c.gridwidth = 1;
add(new JLabel("Set the cutoff value: "), c);
c.gridx = 1;
c.fill = GridBagConstraints.HORIZONTAL;
add(m_cutoffField, c);
m_partition.addChangeListener(this);
m_equal.addChangeListener(this);
m_less.addChangeListener(this);
m_greater.addChangeListener(this);
m_cutoffField.addKeyListener(this);
m_cutoffField.addActionListener(this);
}
DoubleCutPanel(DoubleCutProperties prop)
{
this();
setProperties(prop);
}
void setProperties(DoubleCutProperties prop)
{
/*
m_cutoffField.setText(String.valueOf(prop.m_cutoff));
m_partition.setSelected(prop.m_hasPartition);
m_equal.setSelected( (prop.m_flags & DoubleCut.PASS_IF_EQUAL) != 0 );
m_less.setSelected( (prop.m_flags & DoubleCut.PASS_IF_LESS) != 0 );
m_greater.setSelected( (prop.m_flags & DoubleCut.PASS_IF_GREATER) != 0 );
*/
}
/*
public DoubleCutProperties getProperties()
{
/*
double cutoff;
final String text = m_cutoffField.getText();
if (text.length() == 0)
{
JOptionPane.showMessageDialog(this,
"You must enter a cutoff value.",
"Error", JOptionPane.ERROR_MESSAGE);
return null;
}
try
{
cutoff = Double.valueOf(text).doubleValue();
}
catch (NumberFormatException e)
{
JOptionPane.showMessageDialog(this,
text.concat(" is not a number."),
"Error", JOptionPane.ERROR_MESSAGE);
return null;
}
CutProperties prop = new CutProperties();
prop.m_cutoff = cutoff;
prop.m_hasPartition = m_partition.isSelected();
int flags = 0;
if (m_equal.isSelected()) flags |= DoubleCut.PASS_IF_EQUAL;
if (m_less.isSelected()) flags |= DoubleCut.PASS_IF_LESS;
if (m_greater.isSelected()) flags |= DoubleCut.PASS_IF_GREATER;
prop.m_flags = flags;
DoubleCutProperties prop = new DoubleCutProperties();
return prop;
}
*/
public String getConstructor(String name)
{
return "0"; // hep.analysis.DoubleCut.getConstructor(getProperties(), name);
}
public String getDescription(String name)
{
return "0"; // hep.analysis.DoubleCut.getDescription(getProperties(), name);
}
JTextField getCutoffField()
{
return m_cutoffField; // can be returned only within this package
}
private final JTextField m_cutoffField = new JTextField();
private final JCheckBox m_partition = new JCheckBox("Keep a partition of values applied to the cut");
private final JCheckBox m_equal = new JCheckBox("Pass values equal to the cutoff");
private final JCheckBox m_less = new JCheckBox("Pass values less than the cutoff");
private final JCheckBox m_greater = new JCheckBox("Pass values greater than the cutoff");
@Override
public CutProperties getProperties() {
// TODO Auto-generated method stub
return null;
}
}
Ads help maintain this website.