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 QCChildSelection extends OCMtemplate
{
	String newVar;
	String var=null;
	String contentName;

	public void cvt(Object param)
		throws SAXException, IOException
	{
		QIML2JAVA.SubQIML2JAVA qiml=(QIML2JAVA.SubQIML2JAVA)context;
		ChildSelection dm=(ChildSelection)dataModel;
		if (var!=null)
		{
			newVar=(String)param;
			expand("beenHere");
			return;
		}
		var=(String)param;

		expand("template");
		boolean optional=dm.getOptional_28();
		if(optional)
		{
			expand("optional");
		}
		boolean repeating=dm.getRepeating_29();
		if(repeating)
		{
			expand("repeating");
		}
		Access access=dm.getAccess_30();
		doCvt(access,var);
		ArrayList contents=dm.getContentModel_31();
		int i,s;
		s=contents.size();
		for (i=0;i<s;++i)
		{
			contentName=qiml.makeName();
			Object content=contents.get(i);
			doCvt(content,contentName);
			expand("content");
		}
	}

	public String process(String templateName, String arg)
		throws SAXException, IOException
	{
		if("newVar".equals(arg))
			return newVar;
		if("var".equals(arg))
			return var;
		if("id".equals(arg))
		{
			QIML2JAVA.SubQIML2JAVA qiml=(QIML2JAVA.SubQIML2JAVA)context;
			ChildSelection dm=(ChildSelection)dataModel;
			return Quick.getId(qiml.inputDoc,dm);
		}
		if("contentName".equals(arg))
		{
			return contentName;
		}
		return "";
	}
}
