📄 associationoperatorproperty.java
字号:
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* Created on 2005/1/12
*
* $Author$
* $Date$
* $Revision$
*
*/
package eti.bi.alphaminer.patch.standard.operation.property;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSlider;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.border.CompoundBorder;
import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableModel;
import com.prudsys.pdm.Core.CategoricalAttribute;
import com.prudsys.pdm.Core.MiningAttribute;
import com.prudsys.pdm.Core.MiningDataSpecification;
import eti.bi.alphaminer.core.handler.ICaseHandler;
import eti.bi.alphaminer.operation.operator.DimensionConstants;
import eti.bi.alphaminer.operation.operator.INodeInfo;
import eti.bi.alphaminer.operation.operator.Operator;
import eti.bi.alphaminer.operation.property.OperatorProperty;
import eti.bi.alphaminer.patch.standard.operation.operator.AssociationOperator;
import eti.bi.exception.SysException;
import eti.bi.util.ValueValidator;
import eti.bi.common.Locale.Resource;
/**
* AssociationOperatorProperty is a kind of OperatorProperty
*/
public class AssociationOperatorProperty extends OperatorProperty {
/**
*
*/
private static final long serialVersionUID = -6653465059447145830L;
/* Metadata and Operator node */
private MiningDataSpecification m_MetaData;
/* UI controls */
private JButton m_ButtonReset = new JButton();
private JButton m_ButtonSave = new JButton();
private JButton m_ButtonCancel = new JButton();
private JTabbedPane m_PropertyPane = new JTabbedPane();
/* Controls in "General" tab */
//<< Franky Chan 10/5/2005
// Commented sine AprioridTID has been replaced by AprioriSimple
//private JTextField m_StepsToAprioriTID = new JTextField();
//<< Franky Chan 10/5/2005
private JTextField m_MinItemSize = new JTextField();
private JTextField m_MaxItemSize = new JTextField();
private JCheckBox m_CheckBoxNoLimit = new JCheckBox(Resource.srcStr("m_CheckBoxNoLimit"));
private JTextField m_TextFieldMinSupport = new JTextField();
//private JSlider m_SliderMinSupport = new JSlider(1,100,1);
private JSlider m_SliderMinConfidence = new JSlider(0,100,0);
private JLabel m_MinSupportLabel = new JLabel();
private JLabel m_MinConfidenceLabel = new JLabel();
private JCheckBox m_CheckBoxGenerateRules = new JCheckBox(Resource.srcStr("m_CheckBoxGenerateRules"));
private JPanel attributesPanel = new JPanel(new BorderLayout());
private JLabel minItemSize = new JLabel(Resource.srcStr("minItemSize"));
private JLabel maxItemSize = new JLabel(Resource.srcStr("maxItemSize"));
/* Controls in "Attributes" tab */
private JTable m_TableAttributes = new JTable();
private AttributesTableModel m_AttributesTableModel = null;
private String[] m_ColumnName = {Resource.srcStr("m_AttributeColumnName"),Resource.srcStr("m_ItemIdColumnName"), Resource.srcStr("m_TransactionIdColunmName")};
private Object[][] m_ColumnData = {};
/**
* Constructs an AssociationOperatorProperty object.
* @param a_CaseID ID of the Case containing the Operator Node to be set by this
* AssociationOperatorProperty.
* @param a_NodeID ID of the Operator node to be set by this AssociationOperatorProperty.
* @throws SysException
*/
public AssociationOperatorProperty(String a_CaseID, String a_NodeID, String a_Name, INodeInfo a_NodeInfo, ICaseHandler a_CaseHandler) throws SysException
{
super(a_CaseID, a_NodeID, Resource.srcStr("AssociationTitle")+"["+a_NodeID+"]", a_NodeInfo, a_CaseHandler);
createAssociationOperatorProperty();
}
/**
* Create the UI for this AssociationOperatorProperty
*/
private void createAssociationOperatorProperty()
{
JPanel generalPanel = new JPanel();
m_PropertyPane.setBorder(BorderFactory.createEmptyBorder(0,0,3,0));
m_PropertyPane.addTab(Resource.srcStr("m_GeneralTab"), generalPanel);
m_PropertyPane.addTab(Resource.srcStr("m_AttributesTab"), attributesPanel);
JPanel buttonPanel = new JPanel();
/* "General" tab */
generalPanel.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createCompoundBorder(
BorderFactory.createEmptyBorder(3,5,5,5),
BorderFactory.createTitledBorder(Resource.srcStr("AssociationTitledBorder"))),
BorderFactory.createEmptyBorder(2,4,0,6)));
//<< Franky Chan 10/5/2005
// Commented sine AprioridTID has been replaced by AprioriSimple
//JLabel stepsToAprioriTID = new JLabel("Steps to AprioriTID");
//<< Franky Chan 10/5/2005
//<< Franky Chan 10/5/2005
// Commented sine AprioridTID has been replaced by AprioriSimple
//m_StepsToAprioriTID.setColumns(6);
//m_StepsToAprioriTID.setPreferredSize(DimensionConstants.TEXT_FIELD_DIM);
//m_StepsToAprioriTID.setMaximumSize(DimensionConstants.TEXT_FIELD_DIM);
//m_StepsToAprioriTID.setMinimumSize(DimensionConstants.TEXT_FIELD_DIM);
//<< Franky Chan 10/5/2005
m_MinItemSize.setColumns(6);
m_MinItemSize.setPreferredSize(DimensionConstants.TEXT_FIELD_DIM);
m_MinItemSize.setMinimumSize(DimensionConstants.TEXT_FIELD_DIM);
m_MinItemSize.setMaximumSize(DimensionConstants.TEXT_FIELD_DIM);
m_MaxItemSize.setColumns(6);
m_MaxItemSize.setPreferredSize(DimensionConstants.TEXT_FIELD_DIM);
m_MaxItemSize.setMinimumSize(DimensionConstants.TEXT_FIELD_DIM);
m_MaxItemSize.setMaximumSize(DimensionConstants.TEXT_FIELD_DIM);
m_CheckBoxNoLimit.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e){
m_MaxItemSize.setEnabled(!m_CheckBoxNoLimit.isSelected());
}
});
JPanel minSupportPanel = new JPanel();
minSupportPanel.setLayout
(new BoxLayout(minSupportPanel, BoxLayout.LINE_AXIS));
// minSupportPanel.add(new JLabel("1"));
/* m_SliderMinSupport.setMajorTickSpacing(50);
m_SliderMinSupport.setMinorTickSpacing(10);
m_SliderMinSupport.setPaintTicks(true);
m_SliderMinSupport.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e){
int value = m_SliderMinSupport.getValue();
m_MinSupportLabel.setText("Min. support %");// ("+value+"%)");
}
});*/
// minSupportPanel.add(m_SliderMinSupport);
m_MinSupportLabel.setText(Resource.srcStr("m_MinSupportLabel"));
m_TextFieldMinSupport.setColumns(6);
m_TextFieldMinSupport.setPreferredSize(DimensionConstants.TEXT_FIELD_DIM);
m_TextFieldMinSupport.setMinimumSize(DimensionConstants.TEXT_FIELD_DIM);
m_TextFieldMinSupport.setMaximumSize(DimensionConstants.TEXT_FIELD_DIM);
m_TextFieldMinSupport.setText("0.1");
minSupportPanel.add(m_TextFieldMinSupport);
// minSupportPanel.add(new JLabel("100"));
JPanel minConfidencePanel = new JPanel();
minConfidencePanel.setLayout
(new BoxLayout(minConfidencePanel, BoxLayout.LINE_AXIS));
minConfidencePanel.add(new JLabel("0"));
m_SliderMinConfidence.setMajorTickSpacing(50);
m_SliderMinConfidence.setMinorTickSpacing(10);
m_SliderMinConfidence.setPaintTicks(true);
m_SliderMinConfidence.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e){
int value = m_SliderMinConfidence.getValue();
m_MinConfidenceLabel.setText(Resource.srcStr("m_MinConfidenceLabel")+value+"%)");
}
});
m_MinConfidenceLabel.setPreferredSize(new Dimension(115,20));
m_MinConfidenceLabel.setMinimumSize(new Dimension(115,20));
m_MinConfidenceLabel.setMaximumSize(new Dimension(115,20));
minConfidencePanel.add(m_SliderMinConfidence);
minConfidencePanel.add(new JLabel("100"));
int leftMargin = 4;
int topBotomMargin = 3;
generalPanel.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.anchor = GridBagConstraints.LINE_START;
c.weightx = 0.0;
c.weighty = 0.0;
c.gridwidth = 1;
//<< Franky Chan 10/5/2005
// Commented sine AprioridTID has been replaced by AprioriSimple
//c.gridx = 0;
//c.gridy = 0;
//c.fill = GridBagConstraints.NONE;
//c.insets = new Insets(0, leftMargin, 0, 0);
//generalPanel.add(stepsToAprioriTID, c);
//c.gridx = 1;
//c.gridy = 0;
//c.fill = GridBagConstraints.NONE;
//c.insets = new Insets(topBotomMargin, 0, topBotomMargin, 0);
//generalPanel.add(m_StepsToAprioriTID, c);
//<< Franky Chan 10/5/2005
c.gridx = 0;
c.gridy = 1;
c.insets = new Insets(0, leftMargin, 0, 0);
c.fill = GridBagConstraints.NONE;
generalPanel.add(minItemSize, c);
c.gridx = 1;
c.gridy = 1;
c.insets = new Insets(topBotomMargin, 0, topBotomMargin, 0);
c.fill = GridBagConstraints.NONE;
generalPanel.add(m_MinItemSize, c);
c.gridx = 0;
c.gridy = 2;
c.insets = new Insets(0, leftMargin, 0, 0);
c.fill = GridBagConstraints.NONE;
generalPanel.add(maxItemSize, c);
c.gridx = 1;
c.gridy = 2;
c.insets = new Insets(topBotomMargin, 0, topBotomMargin, 0);
c.fill = GridBagConstraints.NONE;
generalPanel.add(m_MaxItemSize, c);
c.gridx = 2;
c.gridy = 2;
c.insets = new Insets(0, leftMargin, 0, 0);
c.fill = GridBagConstraints.NONE;
generalPanel.add(m_CheckBoxNoLimit, c);
c.gridx = 0;
c.gridy = 3;
c.insets = new Insets(0, leftMargin, 0, 0);
int value = 0;
//value = m_SliderMinSupport.getValue();
//m_MinSupportLabel.setText("Min. support ("+value+"%)");
//m_MinSupportLabel.setPreferredSize(new Dimension(110, 20));
c.fill = GridBagConstraints.NONE;
generalPanel.add(m_MinSupportLabel, c);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -