//copyright=> http://www.jxml.com/mdsax/License.txt

package com.jxml.quick;
import java.net.*;
import java.io.*;
import java.beans.*;

/**
 * Support logic for bean property editors.
 * <p>Quick 1.1
 */
public class PropertyEditors
{
	/**
	 * Add a new property editor package.
	 */
		public static void
	addPackage(String editorPackage)
	{
		if (havePackage(editorPackage))
			return;
		String p[]=PropertyEditorManager.getEditorSearchPath();
		String q[]=new String[p.length+1];
		int i;
		for (i=0;i<p.length;++i)
			q[i]=p[i];
		q[p.length]=editorPackage;
		PropertyEditorManager.setEditorSearchPath(q);
	}

	/**
	 * Returns true if the property editor package is already included.
	 */
		public static boolean
	havePackage(String editorPackage)
	{
		String p[]=PropertyEditorManager.getEditorSearchPath();
		int i=0;
		for (i=0;i<p.length;++i)
			if (editorPackage.equals(p[i]))			
				return true;
		return false;
	}

	/**
	 * Add the jxml property editor package.
	 */
		public static void
	addJXMLPackage()
	{
		addPackage("com.jxml.quick.editors");
	}
}
