/*******************************************************************************
* Copyright (c)                                                                *
*           2005   Tristan Allwood,                                            *
*           2005   Daniel Burke,                                               *
*           2005   Marc Hull,                                                  *
*           2005   Ekaterina Itskova,                                          *
*           2005   Steve Zymler                                                *
*                                                                              *
* Permission is hereby granted, free of charge, to any person obtaining a      *
* copy of this software and associated documentation files (the                *
* "Software"), to deal in the Software without restriction, including          *
* without limitation the rights to use, copy, modify, merge, publish,          *
* distribute, sublicense, and/or sell copies of the Software, and to           *
* permit persons to whom the Software is furnished to do so, subject to        *
* the following conditions:                                                    *
*                                                                              *
* The above copyright notice and this permission notice shall be included      *
* in all copies or substantial portions of the Software.                       *
*                                                                              *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS      *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF                   *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.       *
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY         *
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,         *
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE            *
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                       *
*******************************************************************************/
/*
 * Created on 05-Nov-2004
 *
 */
package uk.ac.ic.doc.kevlar.hial;

import java.util.Collection;

import org.w3c.dom.Element;

import uk.ac.ic.doc.kevlar.core.framework.IProgramIDDescription;
import uk.ac.ic.doc.kevlar.publicInterfaces.INodeID;
import uk.ac.ic.doc.kevlar.publicUtil.collections.Tuple;

/**
 * @author Daniel Burke
 *
 */
public interface IGUIContextLoader {
	public void loadGUIContext(Element guiContext);

	/**
	 * Implementations must add the program to the desired context as though
	 * they were the user had added it manually.
	 * @param guiProgram a DOM element containing GUI specific program data
	 * @param description the description of the program to add
	 * @return the ref object for the program that the implementation creates and the hial program it gets
	 */
	public Tuple<IRefObject, IHialProgram> loadGUIProgram(Element guiProgram, IProgramIDDescription description);
	
	/**
	 * Implementations must add these arguments as though the user added them manually
	 * @param progam the ref object for the program to add the arguments to
	 * @param values the collection of pairs of argument names to argument values
	 */
	public void loadGUIArguments(IRefObject progam, Collection<IArgumentValuePair> values);
	



	/**
	 * Implementations must connect up a pipe as though the user had added it manually 
	 * @param guiPipe a DOM element containing GUI specific pipe information
	 * @param fromProgram the Ref for the from program
	 * @param toProgram the Ref for the to program
	 * @param fromNodeID the NodeID for the from node from the from program
	 * @param toNodeID the NodeID for the to node from the to program
	 * @return the ref object for the pipe that the implementation creates
	 */
	public IRefObject loadGUIPipe(Element guiPipe, IRefObject fromProgram, IRefObject toProgram, INodeID fromNodeID, INodeID toNodeID);

	/**
	 * Thrown when a program refferred to in the save file cannot be found
	 * @param programCanonicalName
	 */
	public void programNotFound(String programCanonicalName);

	/*
	/**
	 * Called when the program args couldn't be loaded properly
	 * @param programID the reference of the program with the args that couldn't load
	 * /
	public void argumentLoadFailed(IRefObject programID);
	
	/**
	 * Called when a program is corrupted and cannot load properly
	 * Should not be called unless a file is corrupted
	 * /
	public void generalProgramCorruption();
	
	/**
	 * Called when a pipe is corrupted and cannot load
	 * Should not be called unless a file is corrupted
	 * /
	public void generalPipeCorruption();
	*/

}