/*
 * Copyright 2006 Maskat Project.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.maskat.framework.screendef;

import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.beans.SimpleBeanInfo;

public class TreeNodeDefBeanInfo extends SimpleBeanInfo {
	public PropertyDescriptor[] getPropertyDescriptors() {
		PropertyDescriptor[] descs = null;
		PropertyDescriptor[] TreeNodeDefPropDesc = null;
		// GrameDefの親クラスのBeanInfo
		try {
			BeanInfo info = Introspector.getBeanInfo(ComponentDef.class);
			descs = info.getPropertyDescriptors();
			TreeNodeDefPropDesc = new PropertyDescriptor[] {
					new PropertyDescriptor("name", TreeNodeDef.class),
					new PropertyDescriptor("sText", TreeNodeDef.class),
					new PropertyDescriptor("sIcon", TreeNodeDef.class),
					new PropertyDescriptor("sIcon2", TreeNodeDef.class),
					new PropertyDescriptor("open", TreeNodeDef.class),
					new PropertyDescriptor("reload", TreeNodeDef.class),
					new PropertyDescriptor("url", TreeNodeDef.class),
					new PropertyDescriptor("typeInfo", TreeNodeDef.class),
					new PropertyDescriptor("onclick", TreeNodeDef.class) };
		} catch (IntrospectionException e) {
			return null;
		}

		// TreeNodeDef自身のPropertyDescriptor[]を追加
		PropertyDescriptor[] result = new PropertyDescriptor[descs.length
				+ TreeNodeDefPropDesc.length];
		System.arraycopy(descs, 0, result, 0, descs.length);
		System.arraycopy(TreeNodeDefPropDesc, 0, result, descs.length,
				TreeNodeDefPropDesc.length);
		return result;
	}

}
