package com.jxml.quick.util.qiml2java;
import com.jxml.quick.model.qiml.*;
import com.jxml.quick.ocm.*;
import com.jxml.quick.*;
import org.xml.sax.*;
import java.io.*;
import java.util.*;

public class QCNVT extends OCMtemplate
{
	String var;
	String name=null;

	public void cvt(Object param)
		throws SAXException, IOException
	{
		var=(String)param;
		QIML2JAVA.SubQIML2JAVA qiml=(QIML2JAVA.SubQIML2JAVA)context;
		expand("template");
	}

	public String process(String templateName, String arg)
		throws SAXException, IOException
	{
		if("var".equals(arg))
			return var;
		if("name".equals(arg))
		{
			if (name==null)
			{
				QIML2JAVA.SubQIML2JAVA qiml=(QIML2JAVA.SubQIML2JAVA)context;
				name=qiml.makeName();
			}
			return name;
		}
		if ("text".equals(arg))
			return dataModel.toString();
		throw new RuntimeException("unknown arg: "+arg+"in template "+templateName);
	}
}
