package com.jxml.quick.qmap;
import com.jxml.quick.tf.*;
import com.jxml.quick.*;
import com.jxml.quick.access.*;
import java.beans.*;
import java.lang.reflect.*;

public class QMapFieldTF extends QMapPropertyTF
{
    public Object create(QContext context)
	throws QPE
    {
	return new QMapFieldAccess();
    }

    public boolean isInstance(Object object, QContext context)
    {
	return object instanceof QMapFieldAccess;
    }

    public String getText(Object object, 
			  QContext context)
	throws QPE
    {
	return ((QMapFieldAccess)object).field;
    }

    public void add(Object object, 
		    String name, 
		    String text,
		    QAccess access,
		    Object parent,
		    QTargetFactory parentFactory,
		    QContext context)
	throws QPE
    {
	if (!isInstance(object,context))
	    context.throwPE("Class mismatch: "+text);
	QMapFieldAccess pa=(QMapFieldAccess)object;
	pa.field=text;
	if (parent==null)
	    context.doc.setRoot(object);
	else
	    access.add(parent,parentFactory,object,context);
    }
}
