//----------------------------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 org.huihoo.god4j.editor.panels.JavaPanel;
import org.huihoo.workflow.WorkflowComplexComponent;
import org.huihoo.workflow.xpdl.WorkflowTransition;
import org.jgraph.graph.DefaultPort;
public class JGraphTransition extends XPDLDefaultEdge
{
	public JGraphTransition(WorkflowTransition transition)
	{
		super(transition);
	}
	public WorkflowTransition getWorkflowTransition()
	{
		return (WorkflowTransition) getUserObject();
	}
	/**
	* Returns source activity.
	*/
	public JGraphActivity getSourceActivity()
	{
		return (JGraphActivity) ((DefaultPort) source).getParent();
	}
	/**
	* Returns target activity.
	*/
	public JGraphActivity getTargetActivity()
	{
		return (JGraphActivity) ((DefaultPort) target).getParent();
	}
	
	public JavaPanel getPanel()
	{
		return null;
	}
	
	public String toString()
	{
		if (userObject == null)
		{
			return null;
		}
		else
		{
			return ((WorkflowComplexComponent) userObject).getName();
		}
	}
}