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

📄 dataoperatorresult.java

📁 一个数据挖掘软件ALPHAMINERR的整个过程的JAVA版源代码
💻 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 Sep 1, 2004
 *
 * $Author$
 * $Date$
 * $Revision$
 * 
 */
package eti.bi.alphaminer.patch.standard.operation.result;


import java.awt.Component;
import java.awt.event.ActionListener;
import java.io.File;

import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.event.InternalFrameEvent;


import com.prudsys.pdm.Core.MiningException;
import com.prudsys.pdm.Input.MiningStoredData;

import eti.bi.alphaminer.core.handler.ICaseHandler;
import eti.bi.alphaminer.operation.operator.INodeInfo;
import eti.bi.alphaminer.operation.result.OperatorResult;
import eti.bi.alphaminer.operation.result.export.ExcelExporter;
import eti.bi.alphaminer.operation.result.view.DataView;
import eti.bi.alphaminer.vo.IBIData;
import eti.bi.alphaminer.vo.IBIObject;
import eti.bi.exception.AppException;
import eti.bi.exception.SysException;
import eti.bi.common.Locale.Resource;
/**
 * @author achiu
 *
 */
public class DataOperatorResult extends OperatorResult
implements ActionListener
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private DataView m_DataView;
	
	public DataOperatorResult (
		String a_CaseID,
		String a_NodeID,
		String a_Name,INodeInfo a_NodeInfo, ICaseHandler a_CaseHandler)
		throws Exception {
		// Set single mode to true, as only one single data result would be shown
		super(a_Name+ Resource.srcStr("Result"), a_CaseID, a_NodeID,a_NodeInfo, a_CaseHandler);
	}

	/**
	 * @see javax.swing.event.InternalFrameListener#internalFrameOpened(InternalFrameEvent)
	 */
	public void internalFrameOpened(InternalFrameEvent e) {
/*		TableColumnModel tcm = jTable1.getColumnModel();
		if (tcm.getColumn(0).getWidth()<60)
		{
			for (int i=0; i<tcm.getColumnCount(); i++)
				tcm.getColumn(i).setMinWidth(60);
			jTable1.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
		}

		tcm = jTable2.getColumnModel();
		if (tcm.getColumn(0).getWidth()<60)
		{
			for (int i=0; i<tcm.getColumnCount(); i++)
				tcm.getColumn(i).setMinWidth(60);
			jTable2.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
		}*/
	}

	private IBIData getOutputBIData()
	{
		IBIObject aOutputBIObject = m_Operator.getOutputBIObject();
		IBIData aOutputBIData = null;

		if (aOutputBIObject!=null)
		{
			aOutputBIData = aOutputBIObject.getBIData();
		}		
		return aOutputBIData;
	}

	protected void createResult() throws MiningException {
		// Create data view in single mode
		m_DataView = new DataView(getOutputBIData(),this);
		
		addView(m_DataView);
		this.setSize(450, 300);
		
		m_DataView.showData();
		selectView(m_DataView);
	}

	/* (non-Javadoc)
	 * @see eti.bi.alphaminer.ui.operatorresult.FileExportPanel#exportExcel()
	 */
	public void export() throws SysException, AppException{
		// Use user home directory 
		File directory = new File(System.getProperty("user.dir"));
		
		// Create and initialize file chooser for excel
		JFileChooser chooser = new JFileChooser(directory);
		chooser.setDialogTitle(DataView.TILTLE_EXPORT);
		chooser.setFileFilter(ExcelExporter.FILTER);
		chooser.setSelectedFile(ExcelExporter.DEFAULT_FILE);

		// pop up the file chooser dialog and return the file value
		int returnVal = chooser.showSaveDialog(this);	  
		if (returnVal == JFileChooser.APPROVE_OPTION) 
		{
			File exportFile = chooser.getSelectedFile();
			//<<tyleung 20/4/2005
			if (exportFile.exists()) {
				int option = JOptionPane
						.showConfirmDialog(
								(Component) this,
								Resource.srcStr("FileMessage")
								+ exportFile.getName()
								+ "\""
								+ Resource.srcStr("ExistsMessage"),//						
						Resource.srcStr("AlphaMiner"), JOptionPane.YES_NO_OPTION,
								JOptionPane.QUESTION_MESSAGE);
				if (option != JOptionPane.CANCEL_OPTION) {
					if (option == JOptionPane.YES_OPTION) {
						//						 Create the excel exporter with the excel file
						// extension enforced to be .xls
						IBIData aBIData = getOutputBIData();
						if (aBIData != null) {
							MiningStoredData aMiningStoredData = aBIData
									.getMiningStoredData();
							ExcelExporter aExporter = new ExcelExporter(
									aMiningStoredData, exportFile, true);
							aExporter.export();
						}
					}else{
						returnVal = chooser.showSaveDialog(this);
					}
				}
			}else {
			    IBIData aBIData = getOutputBIData();
				if (aBIData != null) {
					MiningStoredData aMiningStoredData = aBIData
							.getMiningStoredData();
					ExcelExporter aExporter = new ExcelExporter(
							aMiningStoredData, exportFile, true);
					aExporter.export();
				}
			}
			//tyleung 20/4/2005>>

		}
	}

	@Override
	protected void init() throws Exception {
		
	}
	
	@Override
	protected void getContent() throws Exception {
		
	}
}

⌨️ 快捷键说明

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