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

📄 brecasediagram.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 2006/8/31
 *
 * @Author: Xiaojun Chen
 * $Revision$ 1.0
 *
 */

package eti.bi.alphaminer.tools.ExportCase;
import java.awt.CardLayout;
import java.awt.Color;

import java.util.Vector;
import javax.swing.JPanel;
import eti.bi.alphaminer.core.observer.Observer;
import eti.bi.alphaminer.ui.ApplicationWindow;

public class BreCaseDiagram extends JPanel implements Observer{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 2711170898509316991L;

	//private static Hashtable<String, BreCaseDiagramPanel> CaseDiagramBuffer = new Hashtable<String, BreCaseDiagramPanel>();
	private static Vector<String> CaseDiagramPanels = new Vector<String>();
	private ApplicationWindow m_Container;
	private BreCaseDiagramPanel mainPanel;
	//private String caseID;
	private CardLayout cardLayout = new CardLayout();
	
	public BreCaseDiagram(ApplicationWindow m_Container) {
		setLayout(cardLayout);
		setBackground(Color.WHITE);
		setRequestFocusEnabled(true);
		this.m_Container = m_Container;
	}
	
	/**
	 * draw breviary case diagram
	 * @throws Exception 
	 */
	public void drawCase(String aCaseID) throws Exception {
		/*if(mainPanel!=null) {
			if(!CaseDiagramBuffer.containsKey(caseID)) {
				CaseDiagramBuffer.put(caseID, mainPanel);
			}
		}
		*/
		
		if(CaseDiagramPanels.contains(aCaseID)) {
			mainPanel = (BreCaseDiagramPanel) getComponent(CaseDiagramPanels.indexOf(aCaseID));
			cardLayout.show(this, aCaseID);
		}
		else {
			mainPanel = new BreCaseDiagramPanel(aCaseID);
			m_Container.registerInterest(mainPanel);
			add(mainPanel, aCaseID);
			CaseDiagramPanels.add(aCaseID);
			cardLayout.show(this, aCaseID);
		}
		/*
		removeAll();
		caseID = aCaseID;
		mainPanel = new BreCaseDiagramPanel(aCaseID);
		add(mainPanel);
		*/
	}
	
	public BreCaseDiagramPanel getCaseDiagramPanel() {
		return mainPanel;
	}
	
	public void clear() {
		if(mainPanel!=null) {
			remove(mainPanel);
			m_Container.removeInterest(mainPanel);
			mainPanel = null;
		}
		
		/*
		if(mainPanel!=null) {
			mainPanel.removeAll();
		}
		mainPanel = null;
		removeAll();
		setBackground(Color.WHITE);
		*/
	}

	public void sendNotify(String a_Message) {
		if(a_Message==null) {
			return;
		}
		if(a_Message.startsWith(ApplicationWindow.NOTIFY_DELETE_CASE)) {
			try{
				int index = a_Message.indexOf('|');
				String caseID = a_Message.substring(index+1);
				index = CaseDiagramPanels.indexOf(caseID);
				if(index>=0) {
					CaseDiagramPanels.remove(index);
					remove(index);
				}
				//BreCaseDiagramPanel aPanel = CaseDiagramPanels.
			}
			catch(Exception e) {
				e.printStackTrace();
			}
		}
	}

	public void sendNotify(int a_Message) {
		// TODO Auto-generated method stub
		
	}

	public void sendNotify(int a_Message, Object a_Object) {
		// TODO Auto-generated method stub
		
	}
}

⌨️ 快捷键说明

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