/*
 * EstruturaProcessoMutableTreeNode.java
 *
 * Created on 29 de Abril de 2007, 18:57
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package siprp.medicina.processo.estrutura;

import java.awt.Color;

import javax.swing.Icon;
import javax.swing.tree.DefaultMutableTreeNode;

import com.evolute.utils.images.ImageIconLoader;

/**
 *
 * @author Frederico
 */
abstract public class EstruturaProcessoMutableTreeNode extends DefaultMutableTreeNode
{
	protected Icon icon = null;
	protected Color color = null;

	
	/** Creates a new instance of EstruturaProcessoMutableTreeNode */
	public EstruturaProcessoMutableTreeNode( Object userObject )
	{
		super( userObject );
	}
	
	abstract protected String getIconPath();
	
	public Icon getIcon()
	{
		loadIcon();
		return icon;
	}
	
	public Color getColor()
	{
		return color;
	}
	
	protected void loadIcon()
	{
		if( icon == null && getIconPath() != null )
		{
			try
			{
				icon = ImageIconLoader.loadImageIcon( getClass(), getIconPath() );
			}
			catch( Exception ex )
			{
				ex.printStackTrace();
			}
		}
	}
}
