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

📄 nodeeditor.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 2005/7/29
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package eti.bi.alphaminer.ui.stencil;

import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.JButton;
import javax.swing.AbstractCellEditor;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeCellEditor;

import eti.bi.alphaminer.core.observer.HelpObserveSubject;
import eti.bi.alphaminer.core.help.AlphaminerHelpHandler;
import eti.bi.alphaminer.ui.ISystemMessageHandler;

/**
 * @author kclai
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */

public class NodeEditor extends AbstractCellEditor implements 
	ActionListener,
	TreeCellEditor {

    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private DragTreeNode m_dragTreeNode;
    private JButton m_TransparentHelpButton;
    private JPanel m_Panel;
	protected ISystemMessageHandler m_SystemMessageHandler;
    
	public NodeEditor() {
	}
	
    public void actionPerformed(ActionEvent e) {
		HelpObserveSubject.sendNotify(false);
    }
	
    public Object getCellEditorValue() {
        return m_dragTreeNode;
    }
    
    public Component getTreeCellEditorComponent(
        JTree tree,
        Object value,
        boolean sel,
		boolean expanded,
		boolean leaf,
		int row) {
        
        if (value instanceof DragTreeNode) {
            
        	m_TransparentHelpButton = new JButton(
        	        ((DragTreeNode)value).getNodeDisplayName(),
        	        ((DragTreeNode)value).getIcon());
    	    m_TransparentHelpButton.setBorder(null);
    		m_TransparentHelpButton.setOpaque(false);
    		m_TransparentHelpButton.setContentAreaFilled(false);
    		m_TransparentHelpButton.setFocusPainted(false);
    		m_TransparentHelpButton.addActionListener(this);

            try
    		{
            // <<17/08/2005: Kenneth Lai: Modified for helpHandler singleton
                AlphaminerHelpHandler HelpHandler = AlphaminerHelpHandler.getInstance();
//              new AlphaminerHelpHandler();
            // 17/08/2005: Kenneth Lai: Modified for helpHandler singleton>>
    		HelpHandler.setHelpButton(m_TransparentHelpButton, 
    		        ((DragTreeNode)value).getNodeID());
    		}catch (Exception helpE)
    		{
    		    System.err.println("Cannot initiate on-help files.");
    		    System.err.println(((DragTreeNode)value).getNodeID());
    		    System.err.println(helpE.toString());
    		}
            
	        m_dragTreeNode = (DragTreeNode)value;
	        //System.out.println(m_dragTreeNode.getNodeID());
	        
	        return m_TransparentHelpButton;
	        
		} else {
		    m_Panel = new JPanel();
		    m_Panel.setLayout(new BoxLayout(m_Panel, BoxLayout.PAGE_AXIS));
		    m_Panel.setBackground(Color.WHITE);
		    JLabel text = new JLabel((String)((DefaultMutableTreeNode)value).
		            getUserObject());
		    m_Panel.add(Box.createRigidArea(new Dimension(16,7)));
		    text.setForeground(new Color(208,69,69));
		    m_Panel.add(text);
		    
		    return m_Panel;
		}
    }
}

⌨️ 快捷键说明

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