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

package siprp.medicina.processo.estrutura;

import java.awt.Component;
import javax.swing.*;
import javax.swing.tree.*;

/**
 *
 * @author Frederico
 */
public class EstruturaProcessoRenderer extends DefaultTreeCellRenderer
{
	
	/** Creates a new instance of EstruturaProcessoRenderer */
	public EstruturaProcessoRenderer()
	{
	}
	
	public Component getTreeCellRendererComponent(
                        JTree tree,
                        Object value,
                        boolean sel,
                        boolean expanded,
                        boolean leaf,
                        int row,
                        boolean hasFocus) {

        super.getTreeCellRendererComponent(
                        tree, value, sel,
                        expanded, leaf, row,
                        hasFocus);
		EstruturaProcessoMutableTreeNode node = ( EstruturaProcessoMutableTreeNode ) value;
//System.out.println( node.getICon() );
		Icon icon = node.getIcon();
		if( icon != null )
		{
			setIcon( icon );
		}

        return this;
    }
}
