当前位置: 首页>>代码示例>>Java>>正文


Java PropertyDescriptor.setPreferred方法代码示例

本文整理汇总了Java中java.beans.PropertyDescriptor.setPreferred方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyDescriptor.setPreferred方法的具体用法?Java PropertyDescriptor.setPreferred怎么用?Java PropertyDescriptor.setPreferred使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.beans.PropertyDescriptor的用法示例。


在下文中一共展示了PropertyDescriptor.setPreferred方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPropertyDescriptor

import java.beans.PropertyDescriptor; //导入方法依赖的package包/类
protected PropertyDescriptor getPropertyDescriptor(String name) throws IntrospectionException {
	checkAdditionalProperties();
	for (int i = 0 ; i < properties.length ; i++) {
		PropertyDescriptor property = properties[i];
		if (name.equals(property.getName())) {
			PropertyDescriptor clone = new PropertyDescriptor(name, property.getReadMethod(), property.getWriteMethod());
			clone.setDisplayName(property.getDisplayName());
			clone.setShortDescription(property.getShortDescription());
			clone.setPropertyEditorClass(property.getPropertyEditorClass());
			clone.setBound(property.isBound());
			clone.setConstrained(property.isConstrained());
			clone.setExpert(property.isExpert());
			clone.setHidden(property.isHidden());
			clone.setPreferred(property.isPreferred());
			for (String attributeName : Collections.list(property.attributeNames())) {
				clone.setValue(attributeName, property.getValue(attributeName));
			}
			return properties[i] = clone;
		}
	}
	return null;
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:23,代码来源:MySimpleBeanInfo.java

示例2: copyNonMethodProperties

import java.beans.PropertyDescriptor; //导入方法依赖的package包/类
public static void copyNonMethodProperties(PropertyDescriptor source, PropertyDescriptor target)
		throws IntrospectionException {

	target.setExpert(source.isExpert());
	target.setHidden(source.isHidden());
	target.setPreferred(source.isPreferred());
	target.setName(source.getName());
	target.setShortDescription(source.getShortDescription());
	target.setDisplayName(source.getDisplayName());

	// Copy all attributes (emulating behavior of private FeatureDescriptor#addTable)
	Enumeration<String> keys = source.attributeNames();
	while (keys.hasMoreElements()) {
		String key = keys.nextElement();
		target.setValue(key, source.getValue(key));
	}

	// See java.beans.PropertyDescriptor#PropertyDescriptor(PropertyDescriptor)
	target.setPropertyEditorClass(source.getPropertyEditorClass());
	target.setBound(source.isBound());
	target.setConstrained(source.isConstrained());
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:ExtendedBeanInfo.java

示例3: setDocInfoProps

import java.beans.PropertyDescriptor; //导入方法依赖的package包/类
/**
 * Sets properties from the BeanInfo supplement on the
 * introspected PropertyDescriptor
 */
private void setDocInfoProps(DocBeanInfo dbi, PropertyDescriptor pds) {
    int beanflags = dbi.beanflags;

    if ((beanflags & DocBeanInfo.BOUND) != 0)
        pds.setBound(true);
    if ((beanflags & DocBeanInfo.EXPERT) != 0)
        pds.setExpert(true);
    if ((beanflags & DocBeanInfo.CONSTRAINED) != 0)
        pds.setConstrained(true);
    if ((beanflags & DocBeanInfo.HIDDEN) !=0)
        pds.setHidden(true);
    if ((beanflags & DocBeanInfo.PREFERRED) !=0)
        pds.setPreferred(true);

    if (!(dbi.desc.equals("null"))){
        pds.setShortDescription(dbi.desc);
    }
    if (!(dbi.displayname.equals("null"))){
        pds.setDisplayName(dbi.displayname);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:26,代码来源:GenSwingBeanInfo.java

示例4: getPropertyDescriptors

import java.beans.PropertyDescriptor; //导入方法依赖的package包/类
@Override
public PropertyDescriptor[] getPropertyDescriptors() {

    PropertyDescriptor[] p = new PropertyDescriptor[2];

    try {

        // value
        PropertyDescriptor pdValue = new PropertyDescriptor(
            "value", TestClass.class, "getValue", "setValue");
        pdValue.setBound(true);
        pdValue.setConstrained(true);
        pdValue.setExpert(true);
        pdValue.setHidden(true);
        pdValue.setPreferred(true);
        pdValue.setValue("required", true);
        pdValue.setValue("visualUpdate", true);
        pdValue.setShortDescription("user-defined-value");
        pdValue.setValue("enumerationValues", new Object[]{
                "EAST", 3, "javax.swing.SwingConstants.EAST",
                "WEST", 7, "javax.swing.SwingConstants.WEST"});
        p[iValue] = pdValue;

        // other
        PropertyDescriptor pdOther = new PropertyDescriptor(
                "other", TestClass.class, "getOther", "setOther");
        pdOther.setBound(false);
        pdOther.setConstrained(false);
        pdOther.setExpert(false);
        pdOther.setHidden(false);
        pdOther.setPreferred(false);
        pdOther.setValue("required", false);
        pdOther.setValue("visualUpdate", false);
        pdOther.setShortDescription("user-defined-other");
        pdOther.setValue("enumerationValues", new Object[]{
                "TOP", 1, "javax.swing.SwingConstants.TOP"});
        p[iOther] = pdOther;

    } catch(IntrospectionException e) {
        e.printStackTrace();
    }

    return p;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:45,代码来源:TestBeanInfoPriority.java


注:本文中的java.beans.PropertyDescriptor.setPreferred方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。