//----------------------------BEGIN LICENSE----------------------------
/* 
 * Willow : the Open Source WorkFlow Project
 * Distributable under GNU LGPL license by gun.org
 *
 * Copyright (C) 2004-2010 huihoo.org 
 * Copyright (C) 2004-2010  ZosaTapo <dertyang@hotmail.com> 
 * 
 * ====================================================================
 * Project Homepage : http://www.huihoo.org/god4j
 * Source Forge     : http://sourceforge.net/projects/huihoo
 * Mailing list     : god4j@lists.sourceforge.net 
 */
//----------------------------END  LICENSE-----------------------------
package org.huihoo.god4j.jgraph;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;

import javax.swing.ImageIcon;

import org.huihoo.god4j.util.ImageLoader;
import org.jgraph.graph.PortRenderer;

/**
 * @author reic
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public class XPDLPortRenderer extends PortRenderer
{
	protected static ImageIcon portIcon = ImageLoader.getImageIcon("port.gif");
	
	public void paint(Graphics g)
	{
		g.setColor(graph.getBackground());
		//g.setXORMode(graph.getBackground());
		if (preview)
		{
			Dimension d = getSize();
			g.setColor(Color.orange);
			g.drawRect(1, 1, d.width - 3, d.height - 3);
			g.drawRect(2, 2, d.width - 5, d.height - 5);
		}
		else
		{
			portIcon.paintIcon(graph, g, 0, 0);
		}
	}
}