⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cobwebclusteringoperatorproperty.java

📁 一个数据挖掘软件ALPHAMINERR的整个过程的JAVA版源代码
💻 JAVA
字号:
//@ XiaoguangXu
package eti.bi.alphaminer.patch.standard.operation.property;

import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import eti.bi.alphaminer.core.handler.ICaseHandler;
import eti.bi.alphaminer.operation.operator.INodeInfo;
import eti.bi.alphaminer.operation.property.OperatorProperty;
import eti.bi.alphaminer.patch.standard.operation.operator.CobwebClusteringOperator;
import eti.bi.common.Locale.Resource;
import eti.bi.exception.SysException;
/**
 * @author XiaoguangXu
 *
 */
public class CobwebClusteringOperatorProperty extends OperatorProperty{

	

	private static final long serialVersionUID = 5846848435496489L;
	
	private JButton m_ButtonReset = new JButton();
	private JButton m_ButtonSave = new JButton();
	private JButton m_ButtonCancel = new JButton();
	
	////
	private JTextField m_acuity = new JTextField();
	private JTextField m_cutoff = new JTextField();
	
	/**
	 * 
	 */
	public CobwebClusteringOperatorProperty(String a_CaseID, String a_NodeID, String a_Name, INodeInfo a_NodeInfo, ICaseHandler a_CaseHandler) throws SysException {
		super(a_CaseID, a_NodeID, "Cobweb [" + a_NodeID + "]", a_NodeInfo, a_CaseHandler);
		createCobwebOperatorProperty();
		this.setTitle(Resource.srcStr("Cobweb") + " [" + a_NodeID + "]");
		// TODO 自动生成构造函数存根
		
	}

	public void actionPerformed(ActionEvent e) {
		if (e.getSource() == m_ButtonSave) {
			if (applyContent()) {
				m_ParameterChanged = true;
			}
		} else if (e.getSource() == m_ButtonReset) {
			getContent();
		} else if (e.getSource() == m_ButtonCancel)
			close();
	}
	private boolean applyContent() {
		if (validateProperty()) {
			return setContent();
		} else {
			return false;
		}
	}
	private void createCobwebOperatorProperty() {
		JPanel propertyPanel = new JPanel();
		JPanel buttonPanel = new JPanel();
		/* propertyPanel */
		propertyPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Resource
				.srcStr("Cobweb")), BorderFactory.createEmptyBorder(2, 4, 0, 6)));
		JLabel acuity = new JLabel(Resource.srcStr("acuity"));
		JLabel cutoff = new JLabel(Resource.srcStr("cutoff"));
		JLabel saveinstancedata=new JLabel(Resource.srcStr("saveInstanceData"));
		
		int leftMargin = 4;
		acuity.setBorder(BorderFactory.createEmptyBorder(0, leftMargin, 0, 0));
		cutoff.setBorder(BorderFactory.createEmptyBorder(0, leftMargin, 0, 0));
		saveinstancedata.setBorder(BorderFactory.createEmptyBorder(0, leftMargin, 0, 0));
		
		propertyPanel.setLayout(new GridLayout(2, 2, 0, 5));
		
		propertyPanel.add(acuity);
		propertyPanel.add(m_acuity);
		propertyPanel.add(cutoff);
		propertyPanel.add(m_cutoff);
	
		/* button panel */
		m_ButtonReset.setText(Resource.srcStr("m_ButtonReset"));
		m_ButtonSave.setText(Resource.srcStr("m_ButtonApply"));
		m_ButtonCancel.setSelected(false);
		m_ButtonCancel.setText(Resource.srcStr("m_ButtonClose"));
		buttonPanel.add(m_ButtonSave);
		buttonPanel.add(m_ButtonReset);
		buttonPanel.add(m_ButtonCancel);
		m_ButtonReset.addActionListener(this);
		m_ButtonSave.addActionListener(this);
		m_ButtonCancel.addActionListener(this);
		this.getContentPane().add(propertyPanel, BorderLayout.CENTER);
		this.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
		this.setSize(300,200);
		getContent();
	}
	
	/**
	 * Set values input in this CobwebOperatorProperty to the Operator Node.
	 */
	public boolean setContent() {
		if (m_Node == null) {
			return false;
		}
		
		
		m_Node.setParameterValue(CobwebClusteringOperator.ACUITY, String.valueOf(m_acuity.getText().trim()));
		m_Node.setParameterValue(CobwebClusteringOperator.CUT_OFF, String.valueOf(m_cutoff.getText()));
		
		clearOperatorTempResult();
		setPropertiesModified();
		return true;
	}
	private void getContent() {
		if (m_Node == null)
			return;
		
		String acuityParameter = (String) m_Node.getParameterValue(CobwebClusteringOperator.ACUITY);
		if (acuityParameter == null) {
			acuityParameter = CobwebClusteringOperator.DEFAULT_ACUITY;
		}
		m_acuity.setText(acuityParameter);
		String co = (String) m_Node.getParameterValue(CobwebClusteringOperator.CUT_OFF);
		if (co == null) {
			co = CobwebClusteringOperator.DEFAULT_CUT_OFF;
		}
		m_cutoff.setText(co);
		
	}
	/**
	 * Validate input values.
	 * 
	 * @return true if all values are valid; false otherwise.
	 */
	private boolean validateProperty() {
		return true;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -