GVKun编程网logo

java.beans.PropertyDescriptor的实例源码(java bean技术)

14

对于想了解java.beans.PropertyDescriptor的实例源码的读者,本文将提供新的信息,我们将详细介绍javabean技术,并且为您提供关于hudson.model.JobPrope

对于想了解java.beans.PropertyDescriptor的实例源码的读者,本文将提供新的信息,我们将详细介绍java bean技术,并且为您提供关于hudson.model.JobPropertyDescriptor的实例源码、java.beans.BeanDescriptor的实例源码、java.beans.EventSetDescriptor的实例源码、java.beans.FeatureDescriptor的实例源码的有价值信息。

本文目录一览:

java.beans.PropertyDescriptor的实例源码(java bean技术)

java.beans.PropertyDescriptor的实例源码(java bean技术)

项目:lams    文件:AbstractAutowireCapablebeanfactory.java   
/**
 * Extract a filtered set of PropertyDescriptors from the given BeanWrapper,* excluding ignored dependency types or properties defined on ignored dependency interfaces.
 * @param bw the BeanWrapper the bean was created with
 * @param cache whether to cache filtered PropertyDescriptors for the given bean Class
 * @return the filtered PropertyDescriptors
 * @see #isExcludedFromDependencyCheck
 * @see #filterPropertyDescriptorsForDependencyCheck(org.springframework.beans.BeanWrapper)
 */
protected PropertyDescriptor[] filterPropertyDescriptorsForDependencyCheck(BeanWrapper bw,boolean cache) {
    PropertyDescriptor[] filtered = this.filteredPropertyDescriptorsCache.get(bw.getWrappedClass());
    if (filtered == null) {
        if (cache) {
            synchronized (this.filteredPropertyDescriptorsCache) {
                filtered = this.filteredPropertyDescriptorsCache.get(bw.getWrappedClass());
                if (filtered == null) {
                    filtered = filterPropertyDescriptorsForDependencyCheck(bw);
                    this.filteredPropertyDescriptorsCache.put(bw.getWrappedClass(),filtered);
                }
            }
        }
        else {
            filtered = filterPropertyDescriptorsForDependencyCheck(bw);
        }
    }
    return filtered;
}
项目:reflection-util    文件:PropertyUtils.java   
public static void writeDirectly(Object destination,PropertyDescriptor propertyDescriptor,Object value) {
    try {
        Field field = findField(destination,propertyDescriptor);
        boolean accessible = field.isAccessible();
        try {
            if (!accessible) {
                field.setAccessible(true);
            }
            field.set(destination,value);
        } finally {
            if (!accessible) {
                field.setAccessible(false);
            }
        }
    } catch (NoSuchFieldException | illegalaccessexception e) {
        throw new ReflectionRuntimeException("Failed to write " + getQualifiedPropertyName(destination,propertyDescriptor),e);
    }
}
项目:convertigo-engine    文件:ClientInstructionSetCheckedBeanInfo.java   
public ClientInstructionSetCheckedBeanInfo() {
    try {
        beanClass = ClientInstructionSetChecked.class;
        additionalBeanClass = com.twinsoft.convertigo.beans.extractionrules.siteclipper.AbstractClientInstructionWithPath.class;

        iconNameC16 = "/com/twinsoft/convertigo/beans/extractionrules/siteclipper/images/rule_clientinstructionsetchecked_color_16x16.png";
        iconNameC32 = "/com/twinsoft/convertigo/beans/extractionrules/siteclipper/images/rule_clientinstructionsetchecked_color_32x32.png";

        resourceBundle = getResourceBundle("res/ClientInstructionSetChecked");

        displayName = getExternalizedString("display_name");
        shortDescription = getExternalizedString("short_description");

        properties = new PropertyDescriptor[1];

        properties[0] = new PropertyDescriptor("targetValue",beanClass,"getTargetValue","setTargetValue");
        properties[0].setdisplayName(getExternalizedString("property.targetvalue.display_name"));
        properties[0].setShortDescription(getExternalizedString("property.targetvalue.short_description"));
        properties[0].setValue("scriptable",Boolean.TRUE);
    }
    catch(Exception e) {
        com.twinsoft.convertigo.engine.Engine.logBeans.error("Exception with bean info; beanpanel-heading">
            项目:zooadmin   
            文件:BeanMapUtil.java    
          
public static Object convertMap2Bean(Class type,Map map)
        throws IntrospectionException,illegalaccessexception,InstantiationException,InvocationTargetException {
    BeanInfo beanInfo = Introspector.getBeanInfo(type);
    Object obj = type.newInstance();
    PropertyDescriptor[] propertyDescriptors = beanInfo
            .getPropertyDescriptors();
    for (PropertyDescriptor pro : propertyDescriptors) {
        String propertyName = pro.getName();
        if (pro.getPropertyType().getName().equals("java.lang.class")) {
            continue;
        }
        if (map.containsKey(propertyName)) {
            Object value = map.get(propertyName);
            Method setter = pro.getWriteMethod();
            setter.invoke(obj,value);
        }
    }
    return obj;
}
项目:xmanager    文件:BeanUtils.java   
/**
 * 获取Bean的属性
 * @param bean bean
 * @param propertyName 属性名
 * @return 属性值
 */
public static Object getProperty(Object bean,String propertyName) {
    PropertyDescriptor pd = getPropertyDescriptor(bean.getClass(),propertyName);
    if (pd == null) {
        throw new RuntimeException("Could not read property '" + propertyName + "' from bean PropertyDescriptor is null");
    }
    Method readMethod = pd.getReadMethod();
    if (readMethod == null) {
        throw new RuntimeException("Could not read property '" + propertyName + "' from bean readMethod is null");
    }
    if (!readMethod.isAccessible()) {
        readMethod.setAccessible(true);
    }
    try {
        return readMethod.invoke(bean);
    } catch (Throwable ex) {
        throw new RuntimeException("Could not read property '" + propertyName + "' from bean",ex);
    }
}
项目:convertigo-engine    文件:UIStyleBeanInfo.java   
public UIStyleBeanInfo() {
    try {
        beanClass = UIStyle.class;
        additionalBeanClass = com.twinsoft.convertigo.beans.mobile.components.UIComponent.class;

        iconNameC16 = "/com/twinsoft/convertigo/beans/mobile/components/images/uistyle_color_16x16.png";
        iconNameC32 = "/com/twinsoft/convertigo/beans/mobile/components/images/uistyle_color_32x32.png";

        resourceBundle = getResourceBundle("res/UIStyle");

        displayName = resourceBundle.getString("display_name");
        shortDescription = resourceBundle.getString("short_description");

        properties = new PropertyDescriptor[1];

        properties[0] = new PropertyDescriptor("styleContent","getStyleContent","setStyleContent");
        properties[0].setdisplayName(getExternalizedString("property.styleContent.display_name"));
        properties[0].setShortDescription(getExternalizedString("property.styleContent.short_description"));
        properties[0].setHidden(true);
    }
    catch(Exception e) {
        com.twinsoft.convertigo.engine.Engine.logBeans.error("Exception with bean info; beanpanel-heading">
            项目:ureport   
            文件:DatasourceServletAction.java    
          
public void buildClass(HttpServletRequest req,HttpServletResponse resp) throws servletexception,IOException {
    String clazz=req.getParameter("clazz");
    List<Field> result=new ArrayList<Field>();
    try{
        Class<?> targetClass=Class.forName(clazz);
        PropertyDescriptor[] propertyDescriptors=PropertyUtils.getPropertyDescriptors(targetClass);
        for(PropertyDescriptor pd:propertyDescriptors){
            String name=pd.getName();
            if("class".equals(name)){
                continue;
            }
            result.add(new Field(name));
        }
        writeObjectToJson(resp,result);
    }catch(Exception ex){
        throw new ReportDesignException(ex);
    }
}
项目:convertigo-engine    文件:SerialStepBeanInfo.java   
public SerialStepBeanInfo() {
    try {
        beanClass = SerialStep.class;
        additionalBeanClass = com.twinsoft.convertigo.beans.steps.BranchStep.class;

        iconNameC16 = "/com/twinsoft/convertigo/beans/steps/images/serial_16x16.png";
        iconNameC32 = "/com/twinsoft/convertigo/beans/steps/images/serial_32x32.png";

        resourceBundle = getResourceBundle("res/SerialStep");

        displayName = resourceBundle.getString("display_name");
        shortDescription = resourceBundle.getString("short_description");

        PropertyDescriptor property = getPropertyDescriptor("maxnumberOfThreads");
           property.setHidden(true) ;

    }
    catch(Exception e) {
        com.twinsoft.convertigo.engine.Engine.logBeans.error("Exception with bean info; beanpanel-heading">
            项目:incubator-netbeans   
            文件:DefaultPropertyModelTest.java    
          
public void testUsageOfExplicitPropertyDescriptor() throws Exception {
    PropertyDescriptor pd = new PropertyDescriptor(
            "myProp",this.getClass(),"getterUsageOfExplicitPropertyDescriptor","setterUsageOfExplicitPropertyDescriptor"
            );

    DefaultPropertyModel model = new DefaultPropertyModel(this,pd);

    assertEquals("Getter returns this",model.getValue(),this);

    String msgToThrow = "msgToThrow";
    try {
        model.setValue(msgToThrow);
        fail("Setter should throw an exception");
    } catch (InvocationTargetException ex) {
        // when an exception occurs it should throw InvocationTargetException
        assertEquals("The right message",msgToThrow,ex.getTargetException().getMessage());
    }
}
项目:convertigo-engine    文件:XMLHttpHeadersBeanInfo.java   
public XMLHttpHeadersBeanInfo() {
    try {
        beanClass = XMLHttpHeaders.class;
        additionalBeanClass = com.twinsoft.convertigo.beans.extractionrules.HtmlExtractionRule.class;

        iconNameC16 = "/com/twinsoft/convertigo/beans/common/images/xmlhttpheaders_color_16x16.png";
        iconNameC32 = "/com/twinsoft/convertigo/beans/common/images/xmlhttpheaders_color_32x32.png";

        resourceBundle = getResourceBundle("res/XMLHttpHeaders");

        displayName = getExternalizedString("display_name");
        shortDescription = getExternalizedString("short_description");

        PropertyDescriptor property = getPropertyDescriptor("xpath");
        property.setHidden(true);
    }
    catch(Exception e) {
        com.twinsoft.convertigo.engine.Engine.logBeans.error("Exception with bean info; beanpanel-heading">
            项目:FCat   
            文件:ObjectUtil.java    
          
/**
 * 对象到map
 * @param obj
 * @return
 */
public static Map<String,Object> objectToMap(Object obj) { 
    Map<String,Object> map = new HashMap<String,Object>();
    if(obj == null) {
        return map;      
    }
    try{
     BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());    
     PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();    
     for (PropertyDescriptor property : propertyDescriptors) {    
         String key = property.getName();    
         if (key.comparetoIgnoreCase("class") == 0) {   
             continue;  
         }  
         Method getter = property.getReadMethod();  
         Object value = getter!=null ? getter.invoke(obj) : null;  
         map.put(key,value);  
     }    
    }catch(Exception e) {
        logger.error(e.getMessage());
    }
    return map;
}
项目:Dude    文件:Enums.java   
/**
 * 获取枚举中指定属性的值
 *
 * @param enumCls 枚举类型
 * @param prop    Bean属性名
 * @return (枚举值,指定属性的值)
 */
public static Map<Enum<?>,Object> getEnumAndValue(Class<?> enumCls,String prop) {

    Object[] enumValues = enumCls.getEnumConstants();
    if (isEmpty(enumValues)) {
        return newLinkedHashMap();
    }
    Map<Enum<?>,Object> result = newLinkedHashMapWithExpectedSize(enumValues.length * 2);
    try {
        for (Object enumValue : enumValues) {
            PropertyDescriptor pd = getPropertyDescriptor(enumValue,prop);
            if (pd == null || pd.getReadMethod() == null) {
                continue;
            }
            result.put((Enum<?>) enumValue,pd.getReadMethod().invoke(enumValue));
        }
    } catch (Exception e) {
        // ignore
    }
    return result;
}
项目:lams    文件:MetadataMBeanInfoAssembler.java   
/**
 * Retrieves the description for the supplied {@code Method} from the
 * Metadata. Uses the method name is no description is present in the Metadata.
 */
@Override
protected String getoperationDescription(Method method,String beanKey) {
    PropertyDescriptor pd = BeanUtils.findPropertyForMethod(method);
    if (pd != null) {
        ManagedAttribute ma = this.attributeSource.getManagedAttribute(method);
        if (ma != null && StringUtils.hasText(ma.getDescription())) {
            return ma.getDescription();
        }
        ManagedMetric metric = this.attributeSource.getManagedMetric(method);
        if (metric != null && StringUtils.hasText(metric.getDescription())) {
            return metric.getDescription();
        }
        return method.getName();
    }
    else {
        ManagedOperation mo = this.attributeSource.getManagedOperation(method);
        if (mo != null && StringUtils.hasText(mo.getDescription())) {
            return mo.getDescription();
        }
        return method.getName();
    }
}
项目:spring-rest-commons-options    文件:ReflectionUtils.java   
private static void collectParameters(Collection<Parameters> parameters,Parameter parameter,Annotation a,boolean isPathVariable) {
    if (a != null) {
        String typestr = parameter.getType().getSimpleName();
        Type type = parameter.getParameterizedType();
        if (type instanceof ParameterizedType) {
            typestr = ((Class<?>) ((ParameterizedType) type).getActualTypeArguments()[0]).getSimpleName();
        }
        parameters.add(new Parameters((boolean) AnnotationUtils.getValue(a,"required"),(String) (AnnotationUtils.getValue(a).equals("") ? parameter.getName()
                        : AnnotationUtils.getValue(a)),typestr));
    } else if (Pageable.class.isAssignableFrom(parameter.getType()) && !isPathVariable) {
        try {
            for (PropertyDescriptor propertyDescriptor : Introspector.getBeanInfo(parameter.getType())
                    .getPropertyDescriptors()) {
                parameters.add(new Parameters(false,propertyDescriptor.getName(),propertyDescriptor.getPropertyType().getSimpleName()));
            }
        } catch (IntrospectionException e) {
            LOGGER.error("Problemas al obtener el Pageable: {}",parameter,e);
        }
    }
}
项目:convertigo-engine    文件:InjectorBeanInfo.java   
public InjectorBeanInfo() {
    try {
        beanClass = Injector.class;
        additionalBeanClass = com.twinsoft.convertigo.beans.extractionrules.siteclipper.BaseRule.class;

        resourceBundle = getResourceBundle("res/Injector");

        properties = new PropertyDescriptor[2];

        properties[0] = new PropertyDescriptor("location","getLocation","setLocation");
        properties[0].setdisplayName(getExternalizedString("property.location.display_name"));
        properties[0].setShortDescription(getExternalizedString("property.location.short_description"));
        properties[0].setpropertyeditorClass(HtmlLocation.class);

        properties[1] = new PropertyDescriptor("customregexp","getCustomregexp","setCustomregexp");
        properties[1].setdisplayName(getExternalizedString("property.customregexp.display_name"));
        properties[1].setShortDescription(getExternalizedString("property.customregexp.short_description"));
        properties[1].setExpert(true);
    }
    catch(Exception e) {
        com.twinsoft.convertigo.engine.Engine.logBeans.error("Exception with bean info; beanpanel-heading">
            项目:spring-rest-commons-options   
            文件:ModelStrategy.java    
          
private List<DetailField> createDetail(Class<?> c,boolean isRequest) {
    List<DetailField> detailFields = new ArrayList<>();
    ReflectionUtils.getGenericclass(c).ifPresent(clazz -> {
        try {
            for (PropertyDescriptor propertyDescriptor : Introspector.getBeanInfo(clazz,Object.class)
                    .getPropertyDescriptors()) {
                if (!propertyDescriptor.getReadMethod().getDeclaringClass().equals(Object.class)) {
                    Optional<Field> field = getField(clazz,propertyDescriptor);
                    if (checkIfAddField(field,propertyDescriptor,isRequest)) {
                        Optional<DetailField> detail = super.createDetail(propertyDescriptor,field,isRequest);
                        detail.ifPresent(detailFields::add);
                    }
                }
            }
        } catch (Exception e) {
            LOGGER.error("Error al inspeccionar la clase {}",clazz,e);
        }
    });
    return detailFields;
}
项目:convertigo-engine    文件:CriteriaWithRegexBeanInfo.java   
public CriteriaWithRegexBeanInfo() {
    try {
        beanClass = CriteriaWithRegex.class;
        additionalBeanClass = com.twinsoft.convertigo.beans.criteria.siteclipper.BaseCriteria.class;

        resourceBundle = getResourceBundle("res/CriteriaWithRegex");

        properties = new PropertyDescriptor[1];

        properties[0] = new PropertyDescriptor("regexp","getRegexp","setRegexp");
        properties[0].setdisplayName(getExternalizedString("property.regexp.display_name"));
        properties[0].setShortDescription(getExternalizedString("property.regexp.short_description"));  

    }
    catch(Exception e) {
        com.twinsoft.convertigo.engine.Engine.logBeans.error("Exception with bean info; beanpanel-heading">
            项目:lams   
            文件:ExtendedBeanInfo.java    
          
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());
}
项目:convertigo-engine    文件:UIPageEventBeanInfo.java   
public UIPageEventBeanInfo() {
    try {
        beanClass = UIPageEvent.class;
        additionalBeanClass = com.twinsoft.convertigo.beans.mobile.components.UIComponent.class;

        iconNameC16 = "/com/twinsoft/convertigo/beans/mobile/components/images/uipageevent_color_16x16.png";
        iconNameC32 = "/com/twinsoft/convertigo/beans/mobile/components/images/uipageevent_color_32x32.png";

        resourceBundle = getResourceBundle("res/UIPageEvent");

        displayName = resourceBundle.getString("display_name");
        shortDescription = resourceBundle.getString("short_description");

        properties = new PropertyDescriptor[1];

        properties[0] = new PropertyDescriptor("viewEvent","getViewEvent","setViewEvent");
        properties[0].setdisplayName(getExternalizedString("property.viewEvent.display_name"));
        properties[0].setShortDescription(getExternalizedString("property.viewEvent.short_description"));
        properties[0].setpropertyeditorClass(getEditorClass("StringComboBoxPropertyDescriptor"));
    }
    catch(Exception e) {
        com.twinsoft.convertigo.engine.Engine.logBeans.error("Exception with bean info; beanpanel-heading">
            项目:convertigo-engine   
            文件:InputHtmlSetFileStatementBeanInfo.java    
          
public InputHtmlSetFileStatementBeanInfo() {
    try {
        beanClass = InputHtmlSetFileStatement.class;
        additionalBeanClass = com.twinsoft.convertigo.beans.statements.AbstractEventStatement.class;

        iconNameC16 = "/com/twinsoft/convertigo/beans/statements/images/inputhtmlsetfile_16x16.png";
        iconNameC32 = "/com/twinsoft/convertigo/beans/statements/images/inputhtmlsetfile_32x32.png";

        resourceBundle = getResourceBundle("res/InputHtmlSetFileStatement");

        displayName = resourceBundle.getString("display_name");
        shortDescription = resourceBundle.getString("short_description");

        properties = new PropertyDescriptor[1];

        properties[0] = new PropertyDescriptor("filename","getFilename","setFilename");
        properties[0].setdisplayName(getExternalizedString("property.filename.display_name"));
        properties[0].setShortDescription(getExternalizedString("property.filename.short_description"));
           properties[0].setValue("scriptable",e);
    }
}
项目:aws-sdk-java-v2    文件:DefaultClientBuilderTest.java   
@Test
public void clientBuilderFieldsHaveBeanEquivalents() throws Exception {
    ClientBuilder<TestClientBuilder,TestClient> builder = testClientBuilder();

    BeanInfo beanInfo = Introspector.getBeanInfo(builder.getClass());
    Method[] clientBuilderMethods = ClientBuilder.class.getDeclaredMethods();

    Arrays.stream(clientBuilderMethods).filter(m -> !m.isSynthetic()).forEach(builderMethod -> {
        String propertyName = builderMethod.getName();

        Optional<PropertyDescriptor> propertyForMethod =
                Arrays.stream(beanInfo.getPropertyDescriptors())
                      .filter(property -> property.getName().equals(propertyName))
                      .findFirst();

        assertthat(propertyForMethod).as(propertyName + " property").hasValueSatisfying(property -> {
            assertthat(property.getReadMethod()).as(propertyName + " getter").isNull();
            assertthat(property.getWriteMethod()).as(propertyName + " setter").isNotNull();
        });
    });

}
项目:convertigo-engine    文件:AbstractComplexeEventStatementBeanInfo.java   
public AbstractComplexeEventStatementBeanInfo() {
    try {
        beanClass = AbstractComplexeEventStatement.class;
        additionalBeanClass = com.twinsoft.convertigo.beans.statements.AbstractEventStatement.class;

        resourceBundle = getResourceBundle("res/AbstractComplexeEventStatement");

        properties = new PropertyDescriptor[1];

           properties[0] = new PropertyDescriptor("uiEvent","getUiEvent","setUiEvent");
           properties[0].setdisplayName(getExternalizedString("property.uievent.display_name"));
           properties[0].setShortDescription(getExternalizedString("property.uievent.short_description"));    
    }
    catch(Exception e) {
        com.twinsoft.convertigo.engine.Engine.logBeans.error("Exception with bean info; beanpanel-heading">
            项目:iBase4J-Common   
            文件:InstanceUtil.java    
          
public static <T> T transMap2Bean(Map<String,Object> map,Class<T> clazz) {
    T bean = null;
    try {
        bean = clazz.newInstance();
        BeanInfo beanInfo = Introspector.getBeanInfo(clazz);
        PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
        for (PropertyDescriptor property : propertyDescriptors) {
            String key = property.getName();
            if (map.containsKey(key)) {
                Object value = map.get(key);
                // 得到property对应的setter方法
                Method setter = property.getWriteMethod();
                setter.invoke(bean,TypeParseUtil.convert(value,property.getPropertyType(),null));
            }
        }
    } catch (Exception e) {
        logger.error("transMap2Bean Error ",e);
    }
    return bean;
}
项目:neoscada    文件:AbstractObjectExporter.java   
/**
 * create data items from the properties
 */
protected void createDataItems ( final Class<?> targetClazz )
{
    try
    {
        final BeanInfo bi = Introspector.getBeanInfo ( targetClazz );
        for ( final PropertyDescriptor pd : bi.getPropertyDescriptors () )
        {
            final DataItem item = createItem ( pd,targetClazz );
            this.items.put ( pd.getName (),item );

            final Map<String,Variant> itemAttributes = new HashMap<String,Variant> ();
            fillAttributes ( pd,itemAttributes );
            this.attributes.put ( pd.getName (),itemAttributes );

            initAttribute ( pd );
        }
    }
    catch ( final IntrospectionException e )
    {
        logger.info ( "Failed to read initial item",e );
    }
}
项目:jaffa-framework    文件:BeanMoulder.java   
private static void setProperty (PropertyDescriptor pd,Object value,Object source)
throws illegalaccessexception,InvocationTargetException,MouldException {
    if(pd!=null && pd.getWriteMethod()!=null) {
        Method m = pd.getWriteMethod();
        if(!m.isAccessible()) m.setAccessible(true);
        Class tClass = m.getParameterTypes()[0];
        if(value==null || tClass.isAssignableFrom(value.getClass())) {
            m.invoke(source,new Object[] {value});
            log.debug("Set property '" + pd.getName() + "=" + value + "' on object '" + source.getClass().getName() + "'");
        } else if(DataTypeMapper.instance().isMappable(value.getClass(),tClass)) {
            // See if there is a datatype mapper for these classes
            value = DataTypeMapper.instance().map(value,tClass);
            m.invoke(source,new Object[] {value});
            log.debug("Translate+Set property '" + pd.getName() + "=" + value + "' on object '" + source.getClass().getName() + "'");
        } else {
            // Data type mismatch
            throw new MouldException(MouldException.DATATYPE_MISMATCH,source.getClass().getName() + "." + m.getName(),tClass.getName(),value.getClass().getName());
        }
    } else {
        MouldException me = new MouldException(MouldException.NO_SETTER,null,pd==null?"???":pd.getName(),source.getClass().getName());
        log.error(me.getLocalizedMessage());
        throw me;
    }
}
项目:convertigo-engine    文件:JavaScriptBeanInfo.java   
public JavaScriptBeanInfo() {
    try {
        beanClass = JavaScript.class;
        additionalBeanClass = BaseRule.class;

        resourceBundle = getResourceBundle("res/JavaScript");

        properties = new PropertyDescriptor[1];

        properties[0] = new PropertyDescriptor("expression","getExpression","setExpression" );
        properties[0].setdisplayName(getExternalizedString("property.expression.display_name") );
        properties[0].setShortDescription(getExternalizedString("property.expression.short_description") );
           properties[0].setpropertyeditorClass(getEditorClass("JavascriptTextEditor"));
           properties[0].setValue("scriptable",e);
    }
}
项目:lams    文件:MetadataMBeanInfoAssembler.java   
/**
 * Creates a description for the attribute corresponding to this property
 * descriptor. Attempts to create the description using Metadata from either
 * the getter or setter attributes,otherwise uses the property name.
 */
@Override
protected String getAttributeDescription(PropertyDescriptor propertyDescriptor,String beanKey) {
    Method readMethod = propertyDescriptor.getReadMethod();
    Method writeMethod = propertyDescriptor.getWriteMethod();

    ManagedAttribute getter =
            (readMethod != null ? this.attributeSource.getManagedAttribute(readMethod) : null);
    ManagedAttribute setter =
            (writeMethod != null ? this.attributeSource.getManagedAttribute(writeMethod) : null);

    if (getter != null && StringUtils.hasText(getter.getDescription())) {
        return getter.getDescription();
    }
    else if (setter != null && StringUtils.hasText(setter.getDescription())) {
        return setter.getDescription();
    }

    ManagedMetric metric = (readMethod != null ? this.attributeSource.getManagedMetric(readMethod) : null);
    if (metric != null && StringUtils.hasText(metric.getDescription())) {
        return metric.getDescription();
    }

    return propertyDescriptor.getdisplayName();
}
项目:lams    文件:requiredAnnotationBeanPostProcessor.java   
@Override
public PropertyValues postProcesspropertyValues(
        PropertyValues pvs,PropertyDescriptor[] pds,Object bean,String beanName)
        throws BeansException {

    if (!this.validatedBeanNames.contains(beanName)) {
        if (!shouldSkip(this.beanfactory,beanName)) {
            List<String> invalidProperties = new ArrayList<String>();
            for (PropertyDescriptor pd : pds) {
                if (isrequiredProperty(pd) && !pvs.contains(pd.getName())) {
                    invalidProperties.add(pd.getName());
                }
            }
            if (!invalidProperties.isEmpty()) {
                throw new BeanInitializationException(buildExceptionMessage(invalidProperties,beanName));
            }
        }
        this.validatedBeanNames.add(beanName);
    }
    return pvs;
}
项目:mycat-src-1.6.1-RELEASE    文件:ParameterMapping.java   
/**
 * 用于导出clazz这个JavaBean的所有属性的PropertyDescriptor
 * @param clazz
 * @return
 */
private static PropertyDescriptor[] getDescriptors(Class<?> clazz) {
    //PropertyDescriptor类表示JavaBean类通过存储器导出一个属性
    PropertyDescriptor[] pds;
    List<PropertyDescriptor> list;
    PropertyDescriptor[] pds2 = descriptors.get(clazz);
    //该clazz是否第一次加载
    if (null == pds2) {
        try {
            BeanInfo beanInfo = Introspector.getBeanInfo(clazz);
            pds = beanInfo.getPropertyDescriptors();
            list = new ArrayList<PropertyDescriptor>();
            //加载每一个类型不为空的property
            for (int i = 0; i < pds.length; i++) {
                if (null != pds[i].getPropertyType()) {
                    list.add(pds[i]);
                }
            }
            pds2 = new PropertyDescriptor[list.size()];
            list.toArray(pds2);
        } catch (IntrospectionException ie) {
            LOGGER.error("ParameterMappingError",ie);
            pds2 = new PropertyDescriptor[0];
        }
    }
    descriptors.put(clazz,pds2);
    return (pds2);
}
项目:convertigo-engine    文件:UrlMappingResponseBeanInfo.java   
public UrlMappingResponseBeanInfo() {
    try {
        beanClass = UrlMappingResponse.class;
        additionalBeanClass = com.twinsoft.convertigo.beans.core.DatabaSEObject.class;

        iconNameC16 = "/com/twinsoft/convertigo/beans/core/images/urlmappingresponse_color_16x16.png";
        iconNameC32 = "/com/twinsoft/convertigo/beans/core/images/urlmappingresponse_color_32x32.png";

        resourceBundle = getResourceBundle("res/UrlMappingResponse");

        displayName = resourceBundle.getString("display_name");
        shortDescription = resourceBundle.getString("short_description");

        properties = new PropertyDescriptor[0];
    }
    catch(Exception e) {
        com.twinsoft.convertigo.engine.Engine.logBeans.error("Exception with bean info; beanpanel-heading">
            项目:tk-mybatis   
            文件:FieldHelper.java    
          
/**
 * 通过方法获取属性
 *
 * @param entityClass
 * @return
 */
public List<EntityField> getProperties(Class<?> entityClass) {
    Map<String,Class<?>> genericMap = _getGenericTypeMap(entityClass);
    List<EntityField> entityFields = new ArrayList<EntityField>();
    BeanInfo beanInfo;
    try {
        beanInfo = Introspector.getBeanInfo(entityClass);
    } catch (IntrospectionException e) {
        throw new MapperException(e);
    }
    PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
    for (PropertyDescriptor desc : descriptors) {
        if (desc != null && !"class".equals(desc.getName())) {
            EntityField entityField = new EntityField(null,desc);
            if (desc.getReadMethod() != null
                    && desc.getReadMethod().getGenericReturnType() != null
                    && desc.getReadMethod().getGenericReturnType() instanceof TypeVariable) {
                entityField.setJavaType(genericMap.get(((TypeVariable) desc.getReadMethod().getGenericReturnType()).getName()));
            } else if (desc.getWriteMethod() != null
                    && desc.getWriteMethod().getGenericParameterTypes() != null
                    && desc.getWriteMethod().getGenericParameterTypes().length == 1
                    && desc.getWriteMethod().getGenericParameterTypes()[0] instanceof TypeVariable) {
                entityField.setJavaType(genericMap.get(((TypeVariable) desc.getWriteMethod().getGenericParameterTypes()[0]).getName()));
            }
            entityFields.add(entityField);
        }
    }
    return entityFields;
}
项目:convertigo-engine    文件:DeleteDocumentAttachmentTransactionBeanInfo.java   
public DeleteDocumentAttachmentTransactionBeanInfo() {
    try {
        beanClass = DeleteDocumentAttachmentTransaction.class;
        additionalBeanClass = AbstractDocumentTransaction.class;

        resourceBundle = getResourceBundle("res/DeleteDocumentAttachmentTransaction");

        displayName = getExternalizedString("display_name");
        shortDescription = getExternalizedString("short_description");

        iconNameC16 = "/com/twinsoft/convertigo/beans/transactions/couchdb/images/deletedocumentattachment_color_16x16.png";
        iconNameC32 = "/com/twinsoft/convertigo/beans/transactions/couchdb/images/deletedocumentattachment_color_32x32.png";

        properties = new PropertyDescriptor[3];

        properties[0] = new PropertyDescriptor("q_rev","getQ_rev","setQ_rev");
        properties[0].setdisplayName(getExternalizedString("property.q_rev.display_name"));
        properties[0].setShortDescription(getExternalizedString("property.q_rev.short_description"));

        properties[1] = new PropertyDescriptor("q_batch","getQ_batch","setQ_batch");
        properties[1].setdisplayName(getExternalizedString("property.q_batch.display_name"));
        properties[1].setShortDescription(getExternalizedString("property.q_batch.short_description"));

        properties[2] = new PropertyDescriptor("p_attname","getP_attname","setP_attname");
        properties[2].setdisplayName(getExternalizedString("property.p_attname.display_name"));
        properties[2].setShortDescription(getExternalizedString("property.p_attname.short_description"));

    }
    catch(Exception e) {
        com.twinsoft.convertigo.engine.Engine.logBeans.error("Exception with bean info; beanpanel-heading">
            项目:convertigo-engine   
            文件:MouseStatementBeanInfo.java    
          
public MouseStatementBeanInfo() {
    try {
        beanClass = MouseStatement.class;
        additionalBeanClass = com.twinsoft.convertigo.beans.statements.SimpleEventStatement.class;

        iconNameC16 = "/com/twinsoft/convertigo/beans/statements/images/mouse_16x16.png";
        iconNameC32 = "/com/twinsoft/convertigo/beans/statements/images/mouse_32x32.png";

        resourceBundle = getResourceBundle("res/MouseStatement");

        displayName = resourceBundle.getString("display_name");
        shortDescription = resourceBundle.getString("short_description");

        properties = new PropertyDescriptor[0];
    }
    catch(Exception e) {
        com.twinsoft.convertigo.engine.Engine.logBeans.error("Exception with bean info; beanpanel-heading">
            项目:convertigo-engine   
            文件:WriteXMLStepBeanInfo.java    
          
public WriteXMLStepBeanInfo() {
    try {
        beanClass = WriteXMLStep.class;
        additionalBeanClass = com.twinsoft.convertigo.beans.steps.WriteFileStep.class;

        iconNameC16 = "/com/twinsoft/convertigo/beans/steps/images/xmlW_16x16.png";
        iconNameC32 = "/com/twinsoft/convertigo/beans/steps/images/xmlW_32x32.png";

        resourceBundle = getResourceBundle("res/WriteXMLStep");

        displayName = resourceBundle.getString("display_name");
        shortDescription = resourceBundle.getString("short_description");             

        properties = new PropertyDescriptor[1];

        properties[0] = new PropertyDescriptor("defaultRoottagname","getDefaultRoottagname","setDefaultRoottagname");
        properties[0].setdisplayName(getExternalizedString("property.defaultroottagname.display_name"));
        properties[0].setShortDescription(getExternalizedString("property.defaultroottagname.short_description"));
        properties[0].setValue(DatabaSEObject.PROPERTY_XMLNAME,e);
    }
}
项目:openjdk-jdk10    文件:TestMethodorderDependence.java   
public static void main(final String[] args) throws Exception {
    final BeanInfo beanInfo = Introspector.getBeanInfo(Sub.class);
    final PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors();
    for (final PropertyDescriptor pd : pds) {
        System.err.println("pd = " + pd);
        final Class<?> type = pd.getPropertyType();
        if (type != Class.class && type != Long[].class
                && type != Integer.class && type != Enum.class) {
            throw new RuntimeException(Arrays.toString(pds));
        }
    }
}
项目:convertigo-engine    文件:ContextGetStatementBeanInfo.java   
public ContextGetStatementBeanInfo() {
    try {
        beanClass = ContextGetStatement.class;
        additionalBeanClass = com.twinsoft.convertigo.beans.core.Statement.class;

        iconNameC16 = "/com/twinsoft/convertigo/beans/statements/images/contextget_16x16.png";
        iconNameC32 = "/com/twinsoft/convertigo/beans/statements/images/contextget_32x32.png";

        resourceBundle = getResourceBundle("res/ContextGetStatement");

        displayName = resourceBundle.getString("display_name");
        shortDescription = resourceBundle.getString("short_description");

        properties = new PropertyDescriptor[2];

           properties[0] = new PropertyDescriptor("key","getKey","setKey");
           properties[0].setdisplayName(getExternalizedString("property.key.display_name"));
           properties[0].setShortDescription(getExternalizedString("property.key.short_description"));

           properties[1] = new PropertyDescriptor("variable","getvariable","setvariable");
           properties[1].setdisplayName(getExternalizedString("property.variable.display_name"));
           properties[1].setShortDescription(getExternalizedString("property.variable.short_description"));
    }
    catch(Exception e) {
        com.twinsoft.convertigo.engine.Engine.logBeans.error("Exception with bean info; beanpanel-heading">
            项目:reflection-util   
            文件:PropertyUtilsTest.java    
          
@Test
public void testReadDirectly_PropertyWithoutField() throws Exception {
    TestEntity testEntity = new TestEntity();
    PropertyDescriptor property = PropertyUtils.getPropertyDescriptor(TestEntity.class,TestEntity::getPropertyWithoutField);
    try {
        PropertyUtils.readDirectly(testEntity,property);
        fail("ReflectionRuntimeException expected");
    } catch (ReflectionRuntimeException e) {
        assertEquals("Failed to read TestEntity.propertyWithoutField",e.getMessage());
    }
}
项目:convertigo-engine    文件:CreateDirectoryStepBeanInfo.java   
public CreateDirectoryStepBeanInfo() {
    try {
        beanClass = CreateDirectoryStep.class;
        additionalBeanClass = com.twinsoft.convertigo.beans.core.Step.class;

        iconNameC16 = "/com/twinsoft/convertigo/beans/steps/images/createDirectory_16x16.png";
        iconNameC32 = "/com/twinsoft/convertigo/beans/steps/images/createDirectory_32x32.png";

        resourceBundle = getResourceBundle("res/CreateDirectoryStep");

        displayName = resourceBundle.getString("display_name");
        shortDescription = resourceBundle.getString("short_description");             

        properties = new PropertyDescriptor[2];

        properties[0] = new PropertyDescriptor("destinationPath","getDestinationPath","setDestinationPath");
        properties[0].setExpert(true);
        properties[0].setdisplayName(getExternalizedString("property.destinationPath.display_name"));
        properties[0].setShortDescription(getExternalizedString("property.destinationPath.short_description"));    
        properties[0].setValue("scriptable",Boolean.TRUE);

        properties[1] = new PropertyDescriptor("createNonExistentParentDirectories","isCreateNonExistentParentDirectories","setCreateNonExistentParentDirectories");
        properties[1].setdisplayName(getExternalizedString("property.createNonExistentParentDirectories.display_name"));
        properties[1].setShortDescription(getExternalizedString("property.createNonExistentParentDirectories.short_description"));
        properties[1].setExpert(true);

    }
    catch(Exception e) {
        com.twinsoft.convertigo.engine.Engine.logBeans.error("Exception with bean info; beanpanel-heading">
            项目:convertigo-engine   
            文件:GetServerUuidsTransactionBeanInfo.java    
          
public GetServerUuidsTransactionBeanInfo() {
    try {
        beanClass = GetServerUuidsTransaction.class;
        additionalBeanClass = AbstractCouchDbTransaction.class;

        resourceBundle = getResourceBundle("res/GetServerUuidsTransaction");

        displayName = getExternalizedString("display_name");
        shortDescription = getExternalizedString("short_description");

        iconNameC16 = "/com/twinsoft/convertigo/beans/transactions/couchdb/images/getserveruuids_color_16x16.png";
        iconNameC32 = "/com/twinsoft/convertigo/beans/transactions/couchdb/images/getserveruuids_color_32x32.png";

        properties = new PropertyDescriptor[1];

        properties[0] = new PropertyDescriptor("q_count","getQ_count","setQ_count");
        properties[0].setdisplayName(getExternalizedString("property.q_count.display_name"));
        properties[0].setShortDescription(getExternalizedString("property.q_count.short_description"));
    }
    catch(Exception e) {
        com.twinsoft.convertigo.engine.Engine.logBeans.error("Exception with bean info; beanpanel-heading">
            项目:GitHub   
            文件:IncludeJSR303AnnotationsIT.java    
          
private static Object createInstanceWithPropertyValue(Class type,String propertyName,Object propertyValue) {
    try {
        Object instance = type.newInstance();
        PropertyDescriptor propertyDescriptor = new PropertyDescriptor(propertyName,type);
        propertyDescriptor.getWriteMethod().invoke(instance,propertyValue);

        return instance;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

hudson.model.JobPropertyDescriptor的实例源码

hudson.model.JobPropertyDescriptor的实例源码

项目:jenkins-inheritance-plugin    文件:InheritanceProject.java   
public Map<JobPropertyDescriptor,JobProperty<? super InheritanceProject>> getProperties(IMode mode) {
    List<JobProperty<? super InheritanceProject>> lst = this.getAllProperties(mode);
    if (lst == null || lst.isEmpty()) {
        return Collections.emptyMap();
    }

    HashMap<JobPropertyDescriptor,JobProperty<? super InheritanceProject>> map =
            new HashMap<JobPropertyDescriptor,JobProperty<? super InheritanceProject>>();

    for (JobProperty<? super InheritanceProject> prop : lst) {
        map.put(prop.getDescriptor(),prop);
    }

    return map;
}
项目:uno-choice-plugin    文件:TestPersistingParameters.java   
/**
 * Test persisting jobs with parameters.
 *
 * @throws Exception in Jenkins rule
 */
@Test
public void testSaveParameters() throws Exception {
    FreeStyleProject project = j.createFreeStyleProject();
    GroovyScript scriptParam001 = new GroovyScript(new SecureGroovyScript(SCRIPT_ParaM001,false,null),new SecureGroovyScript(SCRIPT_FALLBACK_ParaM001,null));
    ChoiceParameter param001 = new ChoiceParameter("param001","param001 description","random-name",scriptParam001,AbstractUnoChoiceParameter.ParaMETER_TYPE_SINGLE_SELECT,true,1);
    GroovyScript scriptParam002 = new GroovyScript(new SecureGroovyScript(SCRIPT_ParaM002,new SecureGroovyScript(SCRIPT_FALLBACK_ParaM002,null));
    CascadeChoiceParameter param002 = new CascadeChoiceParameter("param002","param002 description",scriptParam002,"param001",1);
    ParametersDeFinitionProperty param001Def = new ParametersDeFinitionProperty(
            Arrays.<ParameterDeFinition>asList(param001,param002));
    project.addProperty(param001Def);
    QueueTaskFuture<FreeStyleBuild> future = project.scheduleBuild2(0);
    FreeStyleBuild build = future.get();
    // even though the cascaded parameter will fail to evaluate,we should
    // still get a success here.
    assertEquals(Result.SUCCESS,build.getResult());
    XmlFile configXml = project.getConfigFile();
    FreeStyleProject reReadProject = (FreeStyleProject) configXml.read();
    int found = 0;
    for (Entry<JobPropertyDescriptor,JobProperty<? super FreeStyleProject>> entry : reReadProject.getProperties()
            .entrySet()) {
        JobProperty<? super FreeStyleProject> jobProperty = entry.getValue();
        if (jobProperty instanceof ParametersDeFinitionProperty) {
            ParametersDeFinitionProperty paramDef = (ParametersDeFinitionProperty) jobProperty;
            List<ParameterDeFinition> parameters = paramDef.getParameterDeFinitions();
            for (ParameterDeFinition parameter : parameters) {
                if (parameter instanceof AbstractScriptableParameter) {
                    found++;
                    AbstractScriptableParameter choiceParam = (AbstractScriptableParameter) parameter;
                    String scriptText = ((GroovyScript) choiceParam.getScript()).getScript().getScript();
                    String fallbackScriptText = ((GroovyScript) choiceParam.getScript()).getFallbackScript()
                            .getScript();
                    assertTrue("Found an empty script!",StringUtils.isNotBlank(scriptText));
                    assertTrue("Found an empty fallback script!",StringUtils.isNotBlank(fallbackScriptText));
                    if (parameter.getName().equals("param001")) {
                        assertEquals(SCRIPT_ParaM001,scriptText);
                        assertEquals(SCRIPT_FALLBACK_ParaM001,fallbackScriptText);
                    } else {
                        assertEquals(SCRIPT_ParaM002,scriptText);
                        assertEquals(SCRIPT_FALLBACK_ParaM002,fallbackScriptText);
                    }
                }
            }
        }
    }
    // We have two parameters before saving. We must have two Now.
    assertEquals("Didn't find all parameters after persisting xml",2,found);
}
项目:jenkins-inheritance-plugin    文件:InheritanceProject.java   
@Override
public Map<JobPropertyDescriptor,JobProperty<? super InheritanceProject>> getProperties() {
    return this.getProperties(IMode.AUTO);
}
项目:jenkins-inheritance-plugin    文件:InheritanceProject.java   
public static List<JobPropertyDescriptor> getJobPropertyDescriptors(
        Class<? extends Job> clazz,boolean filterIsExcluding,String... filters) {
    List<JobPropertyDescriptor> out = new ArrayList<JobPropertyDescriptor>();

    //JobPropertyDescriptor.getPropertyDescriptors(clazz);
    List<JobPropertyDescriptor> allDesc = Functions.getJobPropertyDescriptors(clazz);

    for (JobPropertyDescriptor desc : allDesc) {
        String dName = desc.getClass().getName();
        if (filters.length > 0) {
            boolean matched = false;
            if (filters != null) {
                for (String filter : filters) {
                    if (dName.contains(filter)) {
                        matched = true;
                        break;
                    }
                }
            }
            if (filterIsExcluding && matched) {
                continue;
            } else if (!filterIsExcluding && !matched) {
                continue;
            }
        }
        //The class has survived the filter
        out.add(desc);
    }

    //At last,we make sure to sort the fields by full name; to ensure
    //that properties from the same package/plugin are next to each other
    Collections.sort(out,new Comparator<JobPropertyDescriptor>() {
        @Override
        public int compare(JobPropertyDescriptor o1,JobPropertyDescriptor o2) {
            String c1 = o1.getClass().getName();
            String c2 = o2.getClass().getName();
            return c1.compareto(c2);
        }
    });

    return out;
}
项目:youtrack-jenkins    文件:YouTrackProjectProperty.java   
@Override
public JobPropertyDescriptor getDescriptor() {
    return DESCRIPTOR;
}
项目:jenkins-inheritance-plugin    文件:InheritanceParametersDeFinitionProperty.java   
/**
 * We need to override this method do prevent Jenkins from trying to
 * register this class as a "real" property worthy of inclusion in the
 * configuration view.
 * <p>
 * This is necessary,because this class is only a pure wrapper around
 * {@link ParametersDeFinitionProperty} and does not own any properties
 * that need to be stored separately.
 * <p>
 * Unfortunately; not defining a Descriptor at all would lead to this
 * class not being able to completely wrap the
 * {@link ParametersDeFinitionProperty} class.
 */
@Override
public JobPropertyDescriptor getDescriptor() {
    //return super.getDescriptor();
    return (JobPropertyDescriptor) Jenkins.getInstance().getDescriptorOrDie(
            ParametersDeFinitionProperty.class
    );
}

java.beans.BeanDescriptor的实例源码

java.beans.BeanDescriptor的实例源码

项目:incubator-netbeans    文件:HelpCtx.java   
/** Finds help context for a generic object. Right Now checks
 * for HelpCtx.Provider and handles java.awt.Component in a
 * special way compatible with JavaHelp.
 * Also {@link BeanDescriptor}'s are checked for a string-valued attribute
 * <code>helpID</code>,as per the JavaHelp specification (but no help sets
 * will be loaded).
 *
 * @param instance to search help for
 * @return the help for the object or <code>HelpCtx.DEFAULT_HELP</code> if HelpCtx cannot be found
 *
 * @since 4.3
 */
public static HelpCtx findHelp(Object instance) {
    if (instance instanceof java.awt.Component) {
        return findHelp((java.awt.Component) instance);
    }

    if (instance instanceof HelpCtx.Provider) {
        return ((HelpCtx.Provider) instance).getHelpCtx();
    }

    try {
        BeanDescriptor d = Introspector.getBeanInfo(instance.getClass()).getBeanDescriptor();
        String v = (String) d.getValue("helpID"); // NOI18N

        if (v != null) {
            return new HelpCtx(v);
        }
    } catch (IntrospectionException e) {
        err.log(Level.FINE,"findHelp on {0}: {1}",new Object[]{instance,e});
    }

    return HelpCtx.DEFAULT_HELP;
}
项目:incubator-netbeans    文件:ModelProperty.java   
private static String finddisplayNameFor(Object o) {
    try {
        if (o == null) {
            return null;
        }

        if (o instanceof Node.Property) {
            return ((Node.Property) o).getdisplayName();
        }

        BeanInfo bi = Introspector.getBeanInfo(o.getClass());

        if (bi != null) {
            BeanDescriptor bd = bi.getBeanDescriptor();

            if (bd != null) {
                return bd.getdisplayName();
            }
        }
    } catch (Exception e) {
        //okay,we did our best
    }

    return null;
}
项目:incubator-netbeans    文件:BeanNode.java   
/**
* Returns name of the bean.
*/
private String getNameForBean() {
    if (nameGetter != null) {
        try {
            String name = (String) nameGetter.invoke(bean);

            return (name != null) ? name : ""; // NOI18N
        } catch (Exception ex) {
            NodeOp.warning(ex);
        }
    }

    BeanDescriptor descriptor = beanInfo.getBeanDescriptor();

    return descriptor.getdisplayName();
}
项目:incubator-netbeans    文件:BindingDesignSupportImpl.java   
@Override
public List<BindingDescriptor>[] getBindingDescriptors(RADComponent component) {
    BeanDescriptor beanDescriptor = component.getBeanInfo().getBeanDescriptor();
    List<BindingDescriptor>[] descs = getBindingDescriptors(null,beanDescriptor,false);
    Class<?> beanClass = component.getBeanClass();
    if (JTextComponent.class.isAssignableFrom(beanClass)) {
        // get rid of text_... descriptors
        descs[0] = filterDescriptors(descs[0],"text_"); // NOI18N
    } else if (JTable.class.isAssignableFrom(beanClass)
            || JList.class.isAssignableFrom(beanClass)
            || JComboBox.class.isAssignableFrom(beanClass)) {
        // get rid of selectedElement(s)_... descriptors
        descs[0] = filterDescriptors(descs[0],"selectedElement_"); // NOI18N
        descs[0] = filterDescriptors(descs[0],"selectedElements_"); // NOI18N
        // add elements descriptor
        BindingDescriptor desc = new BindingDescriptor("elements",List.class); // NOI18N
        descs[0].add(0,desc);
    } else if (JSlider.class.isAssignableFrom(beanClass)) {
        // get rid of value_... descriptor
        descs[0] = filterDescriptors(descs[0],"value_"); // NOI18N
    }
    return descs;
}
项目:incubator-netbeans    文件:SerialDatanode.java   
/** Gets the short description of this feature. */
public String getShortDescription() {
    if (noBeanInfo) return super.getShortDescription();

    try {
        InstanceCookie ic = ic();
        if (ic == null) {
            // it must be unrecognized instance
            return getDataObject().getPrimaryFile().toString();
        }

        Class clazz = ic.instanceClass();
        BeanDescriptor bd = Utilities.getBeanInfo(clazz).getBeanDescriptor();
        String desc = bd.getShortDescription();
        return (desc.equals(bd.getdisplayName()))? getdisplayName(): desc;
    } catch (Exception ex) {
        return super.getShortDescription();
    }
}
项目:myfaces-trinidad    文件:JavaIntrospector.java   
BeanDescriptor __getTargetBeanDescriptor()
  throws IntrospectionException
{
  // Use explicit info,if available,if (_informant != null)
  {
    BeanDescriptor bd = _informant.getBeanDescriptor();

    if (bd != null)
    {
      return bd;
    }
  }

  // OK,fabricate a default BeanDescriptor.
  return (new BeanDescriptor(_beanClass));
}
项目:myfaces-trinidad    文件:JavaIntrospector.java   
@Override
public BeanDescriptor getBeanDescriptor()
{
  if (_beanDescriptor == null)
  {
    if (_introspector != null)
    {
      try
      {
        _beanDescriptor = _introspector.__getTargetBeanDescriptor();
      }
      catch (IntrospectionException e)
      {
        // do nothing
        ;
      }
    }
    else
    {
      _beanDescriptor =
                     _cloneBeanDescriptor(_oldBeanInfo.getBeanDescriptor());
    }
  }

  return _beanDescriptor;
}
项目:myfaces-trinidad    文件:JavaIntrospector.java   
private static BeanDescriptor _cloneBeanDescriptor(
  BeanDescriptor oldDescriptor
  )
{
  try
  {
    BeanDescriptor newDescriptor = new BeanDescriptor(
                                        oldDescriptor.getBeanClass(),oldDescriptor.getCustomizerClass());

    // copy the rest of the attributes
    _copyFeatureDescriptor(oldDescriptor,newDescriptor);

    return newDescriptor;
  }
  catch (Exception e)
  {
    _LOG.severe(e);
    return null;
  }
}
项目:convertigo-engine    文件:DboBeanData.java   
public String getHtmlDescription() {
    if (htmlDescription == null) {
        BeanDescriptor beanDescriptor = beanInfo.getBeanDescriptor();
        String beanDescription = beanDescriptor.getShortDescription();

        String[] beanDescriptions = beanDescription.split("\\|");

        String beanShortDescription = beanDescriptions.length >= 1 ? beanDescriptions[0] : "n/a";
        String beanLongDescription = beanDescriptions.length >= 2 ? beanDescriptions[1] : "n/a";
        beanShortDescription = BeansUtils.cleanDescription(beanShortDescription,true);
        beanLongDescription = BeansUtils.cleanDescription(beanLongDescription,true);

        htmlDescription = "<p>" +
                "<font size=\"4.5\"><u><b>" + getdisplayName() + "</b></u></font>" + "<br><br>" +
                "<i>" + beanShortDescription + "</i>" + "<br><br>" + beanLongDescription +
           "</p>";
    }

    return htmlDescription;
}
项目:convertigo-engine    文件:DatabaSEObject.java   
public DatabaSEObject() {
    try {
        BeanInfo bi = CachedIntrospector.getBeanInfo(getClass());
        BeanDescriptor bd = bi.getBeanDescriptor();
        setBeanName(StringUtils.normalize(bd.getdisplayName())); // normalize
                                                                    // bean
                                                                    // name
                                                                    // #283
        identity = getNewOrderValue();
        compilablePropertySourceValuesMap = new HashMap<String,Object>(5);
    } catch (Exception e) {
        name = getClass().getName();
        Engine.logBeans.error("Unable to set the default name; using the class name instead (\"" + name
                + "\").",e);
    }
}
项目:convertigo-engine    文件:MySimpleBeanInfo.java   
@Override
public BeanDescriptor getBeanDescriptor() {
    BeanDescriptor beanDescriptor = new BeanDescriptor(beanClass,null);
    beanDescriptor.setdisplayName(displayName);
    beanDescriptor.setShortDescription(shortDescription);
    if (iconNameC16 != null) {
        beanDescriptor.setValue("icon" + BeanInfo.ICON_COLOR_16x16,iconNameC16);
    }
    if (iconNameC32 != null) {
        beanDescriptor.setValue("icon" + BeanInfo.ICON_COLOR_32x32,iconNameC32);
    }
    if (iconNameM16 != null) {
        beanDescriptor.setValue("icon" + BeanInfo.ICON_MONO_16x16,iconNameM16);
    }
    if (iconNameM32 != null) {
        beanDescriptor.setValue("icon" + BeanInfo.ICON_MONO_32x32,iconNameM32);
    }
    return beanDescriptor;
}
项目:javify    文件:ExplicitBeanInfo.java   
public ExplicitBeanInfo(BeanDescriptor beanDescriptor,BeanInfo[] additionalBeanInfo,PropertyDescriptor[] propertyDescriptors,int defaultPropertyIndex,EventSetDescriptor[] eventSetDescriptors,int defaultEventIndex,MethodDescriptor[] methodDescriptors,Image[] icons) {
        this.beanDescriptor = beanDescriptor;
        this.additionalBeanInfo = additionalBeanInfo;
        this.propertyDescriptors = propertyDescriptors;
        this.defaultPropertyIndex = defaultPropertyIndex;
        this.eventSetDescriptors = eventSetDescriptors;
        this.defaultEventIndex = defaultEventIndex;
        this.methodDescriptors = methodDescriptors;
        this.icons = icons;
}
项目:incubator-netbeans    文件:JPDABreakpointBeanInfo.java   
@Override
public BeanDescriptor getBeanDescriptor() {
    try {
        return new BeanDescriptor(
                JPDABreakpoint.class,Class.forName("org.netbeans.modules.debugger.jpda.ui.breakpoints.JPDABreakpointCustomizer",true,Lookup.getDefault().lookup(ClassLoader.class))); // NOI18N
    } catch (ClassNotFoundException ex) {
        Exceptions.printstacktrace(ex);
        return null;
    }
}
项目:incubator-netbeans    文件:MicrosoftEdgebrowserBeanInfo.java   
@Override
   public BeanDescriptor getBeanDescriptor() {
       BeanDescriptor descr = new BeanDescriptor(MicrosoftEdgebrowser.class);
       descr.setdisplayName(NbBundle.getMessage(MicrosoftEdgebrowserBeanInfo.class,"CTL_MicrosoftEdgebrowserName")); // NOI18N
       descr.setShortDescription(NbBundle.getMessage(MicrosoftEdgebrowserBeanInfo.class,"HINT_MicrosoftEdgebrowserName")); // NOI18N
       descr.setValue ("helpID","org.netbeans.modules.extbrowser.ExtWebbrowser");  // NOI18N
return descr;
   }
项目:incubator-netbeans    文件:BeanNode.java   
/** Prepare node properties based on the bean,storing them into the current property sheet.
* Called when the bean info is ready.
* This implementation always creates a set for standard properties
* and may create a set for expert ones if there are any.
* @see #computeProperties
* @param bean bean to compute properties for
* @param info information about the bean
*/
protected void createProperties(T bean,BeanInfo info) {
    Descriptor d = computeProperties(bean,info);

    Sheet sets = getSheet();
    Sheet.Set pset = Sheet.createPropertiesSet();
    pset.put(d.property);

    BeanDescriptor bd = info.getBeanDescriptor();

    if ((bd != null) && (bd.getValue("propertiesHelpID") != null)) { // NOI18N      
        pset.setValue("helpID",bd.getValue("propertiesHelpID")); // NOI18N
    }

    sets.put(pset);

    if (d.expert.length != 0) {
        Sheet.Set eset = Sheet.createExpertSet();
        eset.put(d.expert);

        if ((bd != null) && (bd.getValue("expertHelpID") != null)) { // NOI18N      
            eset.setValue("helpID",bd.getValue("expertHelpID")); // NOI18N
        }

        sets.put(eset);
    }
}
项目:incubator-netbeans    文件:SerialDatanode.java   
private Sheet.Set createExpertSet(BeanNode.Descriptor descr,BeanDescriptor bd) {
    Sheet.Set p = Sheet.createExpertSet();
    convertProps (p,descr.expert,this);
    if (bd != null) {
        Object helpID = bd.getValue("expertHelpID"); // NOI18N
        if (helpID != null && helpID instanceof String) {
            p.setValue("helpID",helpID); // NOI18N
        }
    }
    return p;
}
项目:incubator-netbeans    文件:SerialDatanode.java   
private Sheet.Set createPropertiesSet(BeanNode.Descriptor descr,BeanDescriptor bd) {
    Sheet.Set props;
    props = Sheet.createPropertiesSet();
    if (descr.property != null) {
        convertProps (props,descr.property,this);
    }
    if (bd != null) {
        // #29550: help from the beaninfo on property tabs
        Object helpID = bd.getValue("propertiesHelpID"); // NOI18N
        if (helpID != null && helpID instanceof String) {
            props.setValue("helpID",helpID); // NOI18N
        }
    }
    return props;
}
项目:incubator-netbeans    文件:BreakpointCustomizeAction.java   
private Class getCustomizerClass(Breakpoint b) {
    BeanInfo bi = findBeanInfo(b.getClass());
    if (bi == null) {
        try {
            bi = Introspector.getBeanInfo(b.getClass());
        } catch (Exception ex) {
            Exceptions.printstacktrace(ex);
            return null;
        }
    }
    BeanDescriptor bd = bi.getBeanDescriptor();
    if (bd == null) return null;
    Class cc = bd.getCustomizerClass();
    return cc;
}
项目:incubator-netbeans    文件:JSLineBreakpointBeanInfo.java   
@Override
public BeanDescriptor getBeanDescriptor() {
    Class customizer = null;
    try {
        customizer = Class.forName("org.netbeans.modules.javascript2.debug.ui.breakpoints.JSLineBreakpointCustomizer",Lookup.getDefault().lookup(ClassLoader.class));
    } catch (ClassNotFoundException cnfex) {
        LOG.log(Level.WARNING,"No BP customizer",cnfex);
    }
    return new BeanDescriptor(
            JSLineBreakpoint.class,customizer);
}
项目:convertigo-eclipse    文件:ObjectsExplorerComposite.java   
private void updateHelpText(BeanInfo bi) {
    BeanDescriptor beanDescriptor = bi.getBeanDescriptor();
    boolean isDocumented = documentedDboList.contains(beanDescriptor.getBeanClass().getName());
    String beanDescription = isDocumented ? beanDescriptor.getShortDescription():"Not yet documented. |";
    String[] beanDescriptions = beanDescription.split("\\|");
    String beandisplayName = beanDescriptor.getdisplayName();
    String beanShortDescription = beanDescriptions.length >= 1 ? beanDescriptions[0] : "n/a";
    String beanLongDescription = beanDescriptions.length >= 2 ? beanDescriptions[1] : "n/a";

    beanShortDescription = BeansUtils.cleanDescription(beanShortDescription,true);
    beanLongDescription = BeansUtils.cleanDescription(beanLongDescription,true);

    helpbrowser.setText("<html>" +
                            "<head>" +
                            "<script type=\"text/javascript\">"+
                                "document.oncontextmenu = new Function(\"return false\");"+
                            "</script>"+
                                    "<style type=\"text/css\">"+
                                          "body {"+
                                            "font-family: Courrier new,sans-serif;"+
                                            "font-size: 14px;"+
                                            "padding-left: 0.3em;"+
                                            "background-color: #ECEBEB }"+
                                    "</style>"+
                            "</head><p>" 
                        + "<font size=\"4.5\"><u><b>"+beandisplayName+"</b></u></font>" + "<br><br>" 
                        + "<i>"+beanShortDescription+"</i>" + "<br><br>" 
                        + beanLongDescription + "</p></html>");
}
项目:jdk8u-jdk    文件:BeanUtils.java   
/**
 * Returns a bean descriptor for specified class.
 *
 * @param type  the class to introspect
 * @return a bean descriptor
 */
public static BeanDescriptor getBeanDescriptor(Class type) {
    try {
        return Introspector.getBeanInfo(type).getBeanDescriptor();
    } catch (IntrospectionException exception) {
        throw new Error("unexpected exception",exception);
    }
}
项目:openjdk-jdk10    文件:TestBeanInfoPriority.java   
@Override
public BeanDescriptor getBeanDescriptor() {

    BeanDescriptor bd = new BeanDescriptor(TestClass.class,null);
    bd.setShortDescription("user-defined-description");
    bd.setValue("isContainer",true);
    bd.setValue("containerDelegate","user-defined-delegate");

    return bd;
}
项目:openjdk-jdk10    文件:TestSwingContainer.java   
private static void test(Class<?> type,Object iC,Object cD) throws Exception {
    System.out.println(type);
    BeanInfo info = Introspector.getBeanInfo(type);
    BeanDescriptor bd = info.getBeanDescriptor();
    test(bd,"isContainer",iC);
    test(bd,"containerDelegate",cD);
}
项目:openjdk-jdk10    文件:TestSwingContainer.java   
private static void test(BeanDescriptor bd,String name,Object expected) {
    Object value = bd.getValue(name);
    System.out.println("\t" + name + " = " + value);
    if (!Objects.equals(value,expected)) {
        throw new Error(name + ": expected = " + expected + "; actual = " + value);
    }
}
项目:openjdk-jdk10    文件:TestJavaBean.java   
private static void test(Class<?> type,String descr,String prop,String event) throws Exception {
    BeanInfo info = Introspector.getBeanInfo(type);
    BeanDescriptor bd = info.getBeanDescriptor();

    if (!bd.getName().equals(name)) {
        throw new Error("unexpected name of the bean");
    }

    if (!bd.getShortDescription().equals(descr)) {
        throw new Error("unexpected description of the bean");
    }

    int dp = info.getDefaultPropertyIndex();
    if (dp < 0 && prop != null) {
        throw new Error("unexpected index of the default property");
    }
    if (dp >= 0) {
        if (!info.getPropertyDescriptors()[dp].getName().equals(prop)) {
            throw new Error("unexpected default property");
        }
    }
    int des = info.getDefaultEventIndex();
    if (des < 0 && event != null) {
        throw new Error("unexpected index of the default event set");
    }
    if (des >= 0) {
        if (!info.getEventSetDescriptors()[des].getName().equals(event)) {
            throw new Error("unexpected default event set");
        }
    }
}
项目:openjdk-jdk10    文件:BeanUtils.java   
/**
 * Returns a bean descriptor for specified class.
 *
 * @param type  the class to introspect
 * @return a bean descriptor
 */
public static BeanDescriptor getBeanDescriptor(Class type) {
    try {
        return Introspector.getBeanInfo(type).getBeanDescriptor();
    } catch (IntrospectionException exception) {
        throw new Error("unexpected exception",exception);
    }
}
项目:openjdk9    文件:TestBeanInfoPriority.java   
@Override
public BeanDescriptor getBeanDescriptor() {

    BeanDescriptor bd = new BeanDescriptor(TestClass.class,"user-defined-delegate");

    return bd;
}
项目:openjdk9    文件:TestSwingContainer.java   
private static void test(Class<?> type,cD);
}
项目:openjdk9    文件:TestSwingContainer.java   
private static void test(BeanDescriptor bd,expected)) {
        throw new Error(name + ": expected = " + expected + "; actual = " + value);
    }
}
项目:openjdk9    文件:TestJavaBean.java   
private static void test(Class<?> type,String event) throws Exception {
    BeanInfo info = Introspector.getBeanInfo(type);
    BeanDescriptor bd = info.getBeanDescriptor();

    if (!bd.getName().equals(name)) {
        throw new Error("unexpected name of the bean");
    }

    if (!bd.getShortDescription().equals(descr)) {
        throw new Error("unexpected description of the bean");
    }

    int dp = info.getDefaultPropertyIndex();
    if (dp < 0 && prop != null) {
        throw new Error("unexpected index of the default property");
    }
    if (dp >= 0) {
        if (!info.getPropertyDescriptors()[dp].getName().equals(prop)) {
            throw new Error("unexpected default property");
        }
    }
    int des = info.getDefaultEventIndex();
    if (des < 0 && event != null) {
        throw new Error("unexpected index of the default event set");
    }
    if (des >= 0) {
        if (!info.getEventSetDescriptors()[des].getName().equals(event)) {
            throw new Error("unexpected default event set");
        }
    }
}
项目:openjdk9    文件:BeanUtils.java   
/**
 * Returns a bean descriptor for specified class.
 *
 * @param type  the class to introspect
 * @return a bean descriptor
 */
public static BeanDescriptor getBeanDescriptor(Class type) {
    try {
        return Introspector.getBeanInfo(type).getBeanDescriptor();
    } catch (IntrospectionException exception) {
        throw new Error("unexpected exception",exception);
    }
}
项目:jdk8u_jdk    文件:BeanUtils.java   
/**
 * Returns a bean descriptor for specified class.
 *
 * @param type  the class to introspect
 * @return a bean descriptor
 */
public static BeanDescriptor getBeanDescriptor(Class type) {
    try {
        return Introspector.getBeanInfo(type).getBeanDescriptor();
    } catch (IntrospectionException exception) {
        throw new Error("unexpected exception",exception);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:BeanUtils.java   
/**
 * Returns a bean descriptor for specified class.
 *
 * @param type  the class to introspect
 * @return a bean descriptor
 */
public static BeanDescriptor getBeanDescriptor(Class type) {
    try {
        return Introspector.getBeanInfo(type).getBeanDescriptor();
    } catch (IntrospectionException exception) {
        throw new Error("unexpected exception",exception);
    }
}
项目:repo.kmeanspp.silhouette_score    文件:WekaClassifierEvaluationHadoopJobBeanInfo.java   
/**
 * Get the bean descriptor for this bean
 * 
 * @return a <code>BeanDescriptor</code> value
 */
@Override
public BeanDescriptor getBeanDescriptor() {
  return new BeanDescriptor(
    weka.gui.beans.WekaClassifierEvaluationHadoopJob.class,HadoopJobCustomizer.class);
}
项目:repo.kmeanspp.silhouette_score    文件:ClassifierPerformanceEvaluatorBeanInfo.java   
/**
 * Get the bean descriptor for this bean
 * 
 * @return a <code>BeanDescriptor</code> value
 */
@Override
public BeanDescriptor getBeanDescriptor() {
  return new BeanDescriptor(
      weka.gui.beans.ClassifierPerformanceEvaluator.class,ClassifierPerformanceEvaluatorCustomizer.class);
}
项目:repo.kmeanspp.silhouette_score    文件:AddUserFieldsBeanInfo.java   
/**
 * Get the bean descriptor for this bean
 * 
 * @return a <code>BeanDescriptor</code> value
 */
@Override
public BeanDescriptor getBeanDescriptor() {
  return new BeanDescriptor(
      weka.filters.unsupervised.attribute.AddUserFields.class,weka.gui.filters.AddUserFieldsCustomizer.class);
}
项目:incubator-netbeans    文件:DerbyOptionsBeanInfo.java   
public BeanDescriptor getBeanDescriptor() {
    BeanDescriptor descriptor = new BeanDescriptor(DerbyOptions.class);
    descriptor.setName(NbBundle.getMessage(DerbyOptionsBeanInfo.class,"LBL_DerbyOptions"));
    return descriptor;
}
项目:incubator-netbeans    文件:OverlayLayoutBeanInfo.java   
@Override
public BeanDescriptor getBeanDescriptor() {
    return new BeanDescriptor(javax.swing.OverlayLayout.class);
}
项目:incubator-netbeans    文件:ComponentBreakpointBeanInfo.java   
@Override
public BeanDescriptor getBeanDescriptor() {
    return new BeanDescriptor(
            ComponentBreakpoint.class,ComponentBreakpointCustomizer.class);
}
项目:lams    文件:ExtendedBeanInfo.java   
@Override
public BeanDescriptor getBeanDescriptor() {
    return this.delegate.getBeanDescriptor();
}

java.beans.EventSetDescriptor的实例源码

java.beans.EventSetDescriptor的实例源码

项目:incubator-netbeans    文件:SerialDatanode.java   
/** try to register Propertychangelistener to instance to fire its changes.
 * @param bean     */
private void initPList (Object bean,BeanInfo bInfo,BeanNode.Descriptor descr) {
    EventSetDescriptor[] descs  = bInfo.getEventSetDescriptors();
    try {
        Method setter = null;
        for (int i = 0; descs != null && i < descs.length; i++) {
            setter = descs[i].getAddListenerMethod();
            if (setter != null && setter.getName().equals("addPropertychangelistener")) { // NOI18N                    
                propertychangelistener = new PropL(createSupportedPropertyNames(descr));
                setter.invoke(bean,new Object[] {WeakListeners.propertyChange(propertychangelistener,bean)});
                setSettingsInstance(bean);
            }
        }
    } catch (Exception ex) {
        // ignore
    }
}
项目:myfaces-trinidad    文件:JavaIntrospector.java   
private void _addEvent(
  Hashtable<String,EventSetDescriptor> events,EventSetDescriptor descriptor
  )
{
  String key = descriptor.getName() + descriptor.getListenerType();

  if (descriptor.getName().equals("propertyChange"))
  {
    _propertyChangeSource = true;
  }

  EventSetDescriptor oldDescriptor = events.get(key);

  if (oldDescriptor == null)
  {
    events.put(key,descriptor);
    return;
  }

  EventSetDescriptor composite = _createMergedEventSetDescriptor(
                                                             oldDescriptor,descriptor);
  events.put(key,composite);
}
项目:myfaces-trinidad    文件:JavaIntrospector.java   
static EventSetDescriptor __createMergedEventSetStub(
  EventSetDescriptor oldDescriptor,MethodDescriptor[] listenerDescriptors
  )
{
  try
  {
    EventSetDescriptor stubDescriptor = new EventSetDescriptor(
                                  oldDescriptor.getName(),oldDescriptor.getListenerType(),listenerDescriptors,oldDescriptor.getAddListenerMethod(),oldDescriptor.getRemoveListenerMethod());

    // set the unicast attribute
    stubDescriptor.setUnicast(oldDescriptor.isUnicast());

    return stubDescriptor;
  }
  catch (Exception e)
  {
    //    _LOG.severe(e);
    return null;
  }
}
项目:jdk8u-jdk    文件:Test6311051.java   
public static void main(String[] args) throws IntrospectionException,NoSuchMethodException {
    EventSetDescriptor esd = new EventSetDescriptor(
            "foo",FooListener.class,new Method[] {
                    FooListener.class.getmethod("fooHappened",EventObject.class),FooListener.class.getmethod("moreFooHappened",EventObject.class,Object.class),FooListener.class.getmethod("lessFooHappened"),},Bean.class.getmethod("addFooListener",FooListener.class),Bean.class.getmethod("removeFooListener",FooListener.class)
    );
    System.gc();
    for (Method method : esd.getListenerMethods()) {
        System.out.println(method);
    }
}
项目:jdk8u-jdk    文件:Test6976577.java   
public static void main(String[] args) throws Exception {
    Class<?> bt = Accessor.getBeanType();
    Class<?> lt = Accessor.getListenerType();

    // test PropertyDescriptor
    PropertyDescriptor pd = new PropertyDescriptor("boolean",bt);
    test(pd.getReadMethod());
    test(pd.getWriteMethod());

    // test IndexedPropertyDescriptor
    IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor("indexed",bt);
    test(ipd.getReadMethod());
    test(ipd.getWriteMethod());
    test(ipd.getIndexedReadMethod());
    test(ipd.getIndexedWriteMethod());

    // test EventSetDescriptor
    EventSetDescriptor esd = new EventSetDescriptor(bt,"test",lt,"process");
    test(esd.getAddListenerMethod());
    test(esd.getRemoveListenerMethod());
    test(esd.getGetListenerMethod());
    test(esd.getListenerMethods());
}
项目:openjdk-jdk10    文件:TestBeanInfoPriority.java   
@Override
public EventSetDescriptor[] getEventSetDescriptors() {
    EventSetDescriptor[] es = new EventSetDescriptor[2];
    try {
        es[iAction] = new EventSetDescriptor(
                TestClass.class,"actionListener",java.awt.event.ActionListener.class,new String[] {"actionPerformed"},"addActionListener","removeActionListener");
        es[iMouse] = new EventSetDescriptor(
                TestClass.class,"mouseListener",java.awt.event.MouseListener.class,new String[] {"mouseClicked","mousepressed","mouseReleased","mouseEntered","mouseExited"},"addMouseListener","removeMouseListener");
    } catch(IntrospectionException e) {
        e.printstacktrace();
    }
    return es;
}
项目:openjdk-jdk10    文件:Test6311051.java   
public static void main(String[] args) throws IntrospectionException,FooListener.class)
    );
    System.gc();
    for (Method method : esd.getListenerMethods()) {
        System.out.println(method);
    }
}
项目:openjdk-jdk10    文件:Test6976577.java   
public static void main(String[] args) throws Exception {
    Class<?> bt = Accessor.getBeanType();
    Class<?> lt = Accessor.getListenerType();

    // test PropertyDescriptor
    PropertyDescriptor pd = new PropertyDescriptor("boolean","process");
    test(esd.getAddListenerMethod());
    test(esd.getRemoveListenerMethod());
    test(esd.getGetListenerMethod());
    test(esd.getListenerMethods());
}
项目:openjdk9    文件:TestBeanInfoPriority.java   
@Override
public EventSetDescriptor[] getEventSetDescriptors() {
    EventSetDescriptor[] es = new EventSetDescriptor[2];
    try {
        es[iAction] = new EventSetDescriptor(
                TestClass.class,"removeMouseListener");
    } catch(IntrospectionException e) {
        e.printstacktrace();
    }
    return es;
}
项目:openjdk9    文件:Test6311051.java   
public static void main(String[] args) throws IntrospectionException,FooListener.class)
    );
    System.gc();
    for (Method method : esd.getListenerMethods()) {
        System.out.println(method);
    }
}
项目:openjdk9    文件:Test6976577.java   
public static void main(String[] args) throws Exception {
    Class<?> bt = Accessor.getBeanType();
    Class<?> lt = Accessor.getListenerType();

    // test PropertyDescriptor
    PropertyDescriptor pd = new PropertyDescriptor("boolean","process");
    test(esd.getAddListenerMethod());
    test(esd.getRemoveListenerMethod());
    test(esd.getGetListenerMethod());
    test(esd.getListenerMethods());
}
项目:talent-aio    文件:MyTextAreaBeanInfo.java   
private static EventSetDescriptor[] getEdescriptor(){
EventSetDescriptor[] eventSets = new EventSetDescriptor[14];

try {
    eventSets[EVENT_ancestorListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class,"ancestorListener",javax.swing.event.AncestorListener.class,new String[] {"ancestorAdded","ancestorRemoved","ancestorMoved"},"addAncestorListener","removeAncestorListener" ); // NOI18N
    eventSets[EVENT_caretListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class,"caretListener",javax.swing.event.CaretListener.class,new String[] {"caretUpdate"},"addCaretListener","removeCaretListener" ); // NOI18N
    eventSets[EVENT_componentListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class,"componentListener",java.awt.event.ComponentListener.class,new String[] {"componentResized","componentMoved","componentShown","componentHidden"},"addComponentListener","removeComponentListener" ); // NOI18N
    eventSets[EVENT_containerListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class,"containerListener",java.awt.event.ContainerListener.class,new String[] {"componentAdded","componentRemoved"},"addContainerListener","removeContainerListener" ); // NOI18N
    eventSets[EVENT_focusListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class,"focusListener",java.awt.event.FocusListener.class,new String[] {"focusGained","focusLost"},"addFocusListener","removeFocusListener" ); // NOI18N
    eventSets[EVENT_hierarchyBoundsListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class,"hierarchyBoundsListener",java.awt.event.HierarchyBoundsListener.class,new String[] {"ancestorMoved","ancestorResized"},"addHierarchyBoundsListener","removeHierarchyBoundsListener" ); // NOI18N
    eventSets[EVENT_hierarchyListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class,"hierarchyListener",java.awt.event.HierarchyListener.class,new String[] {"hierarchyChanged"},"addHierarchyListener","removeHierarchyListener" ); // NOI18N
    eventSets[EVENT_inputMethodListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class,"inputMethodListener",java.awt.event.InputMethodListener.class,new String[] {"inputMethodTextChanged","caretPositionChanged"},"addInputMethodListener","removeInputMethodListener" ); // NOI18N
    eventSets[EVENT_keyListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class,"keyListener",java.awt.event.KeyListener.class,new String[] {"keyTyped","keypressed","keyreleased"},"addKeyListener","removeKeyListener" ); // NOI18N
    eventSets[EVENT_mouseListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class,"removeMouseListener" ); // NOI18N
    eventSets[EVENT_mouseMotionListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class,"mouseMotionListener",java.awt.event.MouseMotionListener.class,new String[] {"mouseDragged","mouseMoved"},"addMouseMotionListener","removeMouseMotionListener" ); // NOI18N
    eventSets[EVENT_mouseWheelListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class,"mouseWheelListener",java.awt.event.MouseWheelListener.class,new String[] {"mouseWheelMoved"},"addMouseWheelListener","removeMouseWheelListener" ); // NOI18N
    eventSets[EVENT_propertychangelistener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class,"propertychangelistener",java.beans.Propertychangelistener.class,new String[] {"propertyChange"},"addPropertychangelistener","removePropertychangelistener" ); // NOI18N
    eventSets[EVENT_vetoablechangelistener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class,"vetoablechangelistener",java.beans.Vetoablechangelistener.class,new String[] {"vetoableChange"},"addVetoablechangelistener","removeVetoablechangelistener" ); // NOI18N
}
catch(IntrospectionException e) {
    e.printstacktrace();
}//GEN-HEADEREND:Events
// Here you can add code for customizing the event sets array.

return eventSets;     }
项目:talent-aio    文件:MsgTextAreajpopupmenuBeanInfo.java   
private static EventSetDescriptor[] getEdescriptor(){
EventSetDescriptor[] eventSets = new EventSetDescriptor[15];

try {
    eventSets[EVENT_ancestorListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreajpopupmenu.class,"removeAncestorListener" ); // NOI18N
    eventSets[EVENT_componentListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreajpopupmenu.class,"removeComponentListener" ); // NOI18N
    eventSets[EVENT_containerListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreajpopupmenu.class,"removeContainerListener" ); // NOI18N
    eventSets[EVENT_focusListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreajpopupmenu.class,"removeFocusListener" ); // NOI18N
    eventSets[EVENT_hierarchyBoundsListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreajpopupmenu.class,"removeHierarchyBoundsListener" ); // NOI18N
    eventSets[EVENT_hierarchyListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreajpopupmenu.class,"removeHierarchyListener" ); // NOI18N
    eventSets[EVENT_inputMethodListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreajpopupmenu.class,"removeInputMethodListener" ); // NOI18N
    eventSets[EVENT_keyListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreajpopupmenu.class,"removeKeyListener" ); // NOI18N
    eventSets[EVENT_menuKeyListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreajpopupmenu.class,"menuKeyListener",javax.swing.event.MenuKeyListener.class,new String[] {"menuKeyTyped","menuKeypressed","menukeyreleased"},"addMenuKeyListener","removeMenuKeyListener" ); // NOI18N
    eventSets[EVENT_mouseListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreajpopupmenu.class,"removeMouseListener" ); // NOI18N
    eventSets[EVENT_mouseMotionListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreajpopupmenu.class,"removeMouseMotionListener" ); // NOI18N
    eventSets[EVENT_mouseWheelListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreajpopupmenu.class,"removeMouseWheelListener" ); // NOI18N
    eventSets[EVENT_popupMenuListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreajpopupmenu.class,"popupMenuListener",javax.swing.event.PopupMenuListener.class,new String[] {"popupMenuWillBecomeVisible","popupMenuWillBecomeInvisible","popupMenuCanceled"},"addPopupMenuListener","removePopupMenuListener" ); // NOI18N
    eventSets[EVENT_propertychangelistener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreajpopupmenu.class,"removePropertychangelistener" ); // NOI18N
    eventSets[EVENT_vetoablechangelistener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreajpopupmenu.class,"removeVetoablechangelistener" ); // NOI18N
}
catch(IntrospectionException e) {
    e.printstacktrace();
}//GEN-HEADEREND:Events
// Here you can add code for customizing the event sets array.

return eventSets;     }
项目:jdk8u_jdk    文件:Test6311051.java   
public static void main(String[] args) throws IntrospectionException,FooListener.class)
    );
    System.gc();
    for (Method method : esd.getListenerMethods()) {
        System.out.println(method);
    }
}
项目:jdk8u_jdk    文件:Test6976577.java   
public static void main(String[] args) throws Exception {
    Class<?> bt = Accessor.getBeanType();
    Class<?> lt = Accessor.getListenerType();

    // test PropertyDescriptor
    PropertyDescriptor pd = new PropertyDescriptor("boolean","process");
    test(esd.getAddListenerMethod());
    test(esd.getRemoveListenerMethod());
    test(esd.getGetListenerMethod());
    test(esd.getListenerMethods());
}
项目:lookaside_java-1.8.0-openjdk    文件:Test6311051.java   
public static void main(String[] args) throws IntrospectionException,FooListener.class)
    );
    System.gc();
    for (Method method : esd.getListenerMethods()) {
        System.out.println(method);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:Test6976577.java   
public static void main(String[] args) throws Exception {
    Class<?> bt = Accessor.getBeanType();
    Class<?> lt = Accessor.getListenerType();

    // test PropertyDescriptor
    PropertyDescriptor pd = new PropertyDescriptor("boolean","process");
    test(esd.getAddListenerMethod());
    test(esd.getRemoveListenerMethod());
    test(esd.getGetListenerMethod());
    test(esd.getListenerMethods());
}
项目:javify    文件:ExplicitBeanInfo.java   
public ExplicitBeanInfo(BeanDescriptor beanDescriptor,BeanInfo[] additionalBeanInfo,PropertyDescriptor[] propertyDescriptors,int defaultPropertyIndex,EventSetDescriptor[] eventSetDescriptors,int defaultEventIndex,MethodDescriptor[] methodDescriptors,Image[] icons) {
        this.beanDescriptor = beanDescriptor;
        this.additionalBeanInfo = additionalBeanInfo;
        this.propertyDescriptors = propertyDescriptors;
        this.defaultPropertyIndex = defaultPropertyIndex;
        this.eventSetDescriptors = eventSetDescriptors;
        this.defaultEventIndex = defaultEventIndex;
        this.methodDescriptors = methodDescriptors;
        this.icons = icons;
}
项目:javify    文件:IntrospectionIncubator.java   
void findAddRemovePairs(BeanInfoEmbryo b) throws IntrospectionException {
        Enumeration listenerEnum = listenerMethods.keys();
        while(listenerEnum.hasMoreElements()) {
                DoubleKey k = (DoubleKey)listenerEnum.nextElement();
                Method[] m = (Method[])listenerMethods.get(k);
                if(m[ADD] != null && m[REMOVE] != null) {
                        EventSetDescriptor e = new EventSetDescriptor(Introspector.decapitalize(k.getName()),k.getType(),k.getType().getmethods(),m[ADD],m[REMOVE]);
                        e.setUnicast(ArrayHelper.contains(m[ADD].getExceptionTypes(),java.util.TooManyListenersException.class));
                        if(!b.hasEvent(e)) {
                                b.addEvent(e);
                        }
                }
        }
}
项目:repo.kmeanspp.silhouette_score    文件:CSVToARFFHadoopJobBeanInfo.java   
/**
 * Get the event set descriptors pertinent to data sources
 * 
 * @return an <code>EventSetDescriptor[]</code> value
 */
@Override
public EventSetDescriptor[] getEventSetDescriptors() {
  try {
    List<EventSetDescriptor> descriptors =
      new ArrayList<EventSetDescriptor>();
    for (EventSetDescriptor es : super.getEventSetDescriptors()) {
      descriptors.add(es);
    }
    descriptors.add(new EventSetDescriptor(CSVToARFFHadoopJob.class,"dataSet",DataSourceListener.class,"acceptDataSet"));

    descriptors.add(new EventSetDescriptor(CSVToARFFHadoopJob.class,"image",ImageListener.class,"acceptimage"));

    return descriptors.toArray(new EventSetDescriptor[descriptors.size()]);
  } catch (Exception ex) {
    ex.printstacktrace();
  }

  return null;
}
项目:repo.kmeanspp.silhouette_score    文件:RandomizedDataChunkHadoopJobBeanInfo.java   
/**
 * Get the event set descriptors pertinent to data sources
 * 
 * @return an <code>EventSetDescriptor[]</code> value
 */
@Override
public EventSetDescriptor[] getEventSetDescriptors() {

  try {
    List<EventSetDescriptor> descriptors =
      new ArrayList<EventSetDescriptor>();
    for (EventSetDescriptor es : super.getEventSetDescriptors()) {
      descriptors.add(es);
    }
  } catch (Exception ex) {
    ex.printstacktrace();
  }

  return null;
}
项目:repo.kmeanspp.silhouette_score    文件:WekaClassifierHadoopJobBeanInfo.java   
/**
 * Get the event set descriptors pertinent to data sources
 * 
 * @return an <code>EventSetDescriptor[]</code> value
 */
@Override
public EventSetDescriptor[] getEventSetDescriptors() {

  try {
    List<EventSetDescriptor> descriptors = new ArrayList<EventSetDescriptor>();
    for (EventSetDescriptor es : super.getEventSetDescriptors()) {
      descriptors.add(es);
    }

    descriptors.add(new EventSetDescriptor(WekaClassifierHadoopJob.class,"text",TextListener.class,"acceptText"));
    descriptors.add(new EventSetDescriptor(WekaClassifierHadoopJob.class,"batchClassifier",BatchClassifierListener.class,"acceptClassifier"));

    return descriptors.toArray(new EventSetDescriptor[descriptors.size()]);
  } catch (Exception ex) {
    ex.printstacktrace();
  }

  return null;
}
项目:repo.kmeanspp.silhouette_score    文件:WekaClassifierEvaluationHadoopJobBeanInfo.java   
/**
 * Get the event set descriptors pertinent to data sources
 * 
 * @return an <code>EventSetDescriptor[]</code> value
 */
@Override
public EventSetDescriptor[] getEventSetDescriptors() {
  try {
    List<EventSetDescriptor> descriptors = new ArrayList<EventSetDescriptor>();
    for (EventSetDescriptor es : super.getEventSetDescriptors()) {
      descriptors.add(es);
    }

    descriptors.add(new EventSetDescriptor(
      WekaClassifierEvaluationHadoopJob.class,"acceptText"));
    descriptors.add(new EventSetDescriptor(
      WekaClassifierEvaluationHadoopJob.class,"acceptDataSet"));

    return descriptors.toArray(new EventSetDescriptor[descriptors.size()]);
  } catch (Exception ex) {
    ex.printstacktrace();
  }

  return null;
}
项目:repo.kmeanspp.silhouette_score    文件:KMeansClustererHadoopJobBeanInfo.java   
/**
 * Get the event set descriptors pertinent to data sources
 * 
 * @return an <code>EventSetDescriptor[]</code> value
 */
@Override
public EventSetDescriptor[] getEventSetDescriptors() {

  try {
    List<EventSetDescriptor> descriptors =
      new ArrayList<EventSetDescriptor>();
    for (EventSetDescriptor es : super.getEventSetDescriptors()) {
      descriptors.add(es);
    }

    descriptors.add(new EventSetDescriptor(KMeansClustererHadoopJob.class,"acceptText"));
    descriptors.add(new EventSetDescriptor(KMeansClustererHadoopJob.class,"batchClusterer",BatchClustererListener.class,"acceptClusterer"));

    return descriptors.toArray(new EventSetDescriptor[descriptors.size()]);
  } catch (Exception ex) {
    ex.printstacktrace();
  }

  return null;
}
项目:repo.kmeanspp.silhouette_score    文件:IncrementalClassifierEvaluatorBeanInfo.java   
/**
  * Get the event set descriptors for this bean
  *
  * @return an <code>EventSetDescriptor[]</code> value
  */
 public EventSetDescriptor [] getEventSetDescriptors() {
   try {
     EventSetDescriptor [] esds = { 
new EventSetDescriptor(IncrementalClassifierEvaluator.class,"chart",ChartListener.class,"acceptDataPoint"),new EventSetDescriptor(IncrementalClassifierEvaluator.class,"acceptText")
     };
     return esds;
   } catch (Exception ex) {
     ex.printstacktrace();
   }
   return null;
 }
项目:repo.kmeanspp.silhouette_score    文件:AttributeSummarizerBeanInfo.java   
/**
 * Get the event set descriptors for this bean
 *
 * @return an <code>EventSetDescriptor[]</code> value
 */
public EventSetDescriptor [] getEventSetDescriptors() {
  // hide all gui events
  try {
    EventSetDescriptor [] esds = { 
        new EventSetDescriptor(DataVisualizer.class,"acceptimage")
    };
    return esds;
  } catch (Exception ex) {
    ex.printstacktrace();
  }

  return null;
}
项目:repo.kmeanspp.silhouette_score    文件:SorterBeanInfo.java   
/**
 * Returns the event set descriptors
 *
 * @return an <code>EventSetDescriptor[]</code> value
 */
public EventSetDescriptor [] getEventSetDescriptors() {
  try {
    EventSetDescriptor [] esds = 
    {       
        new EventSetDescriptor(DataSource.class,"instance",InstanceListener.class,"acceptInstance"),new EventSetDescriptor(DataSource.class,"acceptDataSet")
    };
    return esds;
  } catch (Exception ex) {
    ex.printstacktrace();
  }
  return null;
}
项目:intellij-ce-playground    文件:CreateListenerAction.java   
private DefaultActionGroup prepareActionGroup(final List<RadComponent> selection) {
  final DefaultActionGroup actionGroup = new DefaultActionGroup();
  final EventSetDescriptor[] eventSetDescriptors;
  try {
    BeanInfo beanInfo = Introspector.getBeanInfo(selection.get(0).getComponentClass());
    eventSetDescriptors = beanInfo.getEventSetDescriptors();
  }
  catch (IntrospectionException e) {
    LOG.error(e);
    return null;
  }
  EventSetDescriptor[] sortedDescriptors = new EventSetDescriptor[eventSetDescriptors.length];
  System.arraycopy(eventSetDescriptors,sortedDescriptors,eventSetDescriptors.length);
  Arrays.sort(sortedDescriptors,new Comparator<EventSetDescriptor>() {
    public int compare(final EventSetDescriptor o1,final EventSetDescriptor o2) {
      return o1.getListenerType().getName().compareto(o2.getListenerType().getName());
    }
  });
  for(EventSetDescriptor descriptor: sortedDescriptors) {
    actionGroup.add(new MyCreateListenerAction(selection,descriptor));
  }
  return actionGroup;
}
项目:repo.kmeanspp.silhouette_score    文件:JoinBeanInfo.java   
/**
 * Returns the event set descriptors
 * 
 * @return an <code>EventSetDescriptor[]</code> value
 */
@Override
public EventSetDescriptor[] getEventSetDescriptors() {
  try {
    EventSetDescriptor[] esds =
      {
        new EventSetDescriptor(DataSource.class,"acceptDataSet") };
    return esds;
  } catch (Exception ex) {
    ex.printstacktrace();
  }
  return null;
}
项目:repo.kmeanspp.silhouette_score    文件:AbstractTrainAndTestSetProducerBeanInfo.java   
public EventSetDescriptor [] getEventSetDescriptors() {
   try {
     EventSetDescriptor [] esds = { 
new EventSetDescriptor(TrainingSetProducer.class,"trainingSet",TrainingSetListener.class,"acceptTrainingSet"),new EventSetDescriptor(TestSetProducer.class,"testSet",TestSetListener.class,"acceptTestSet")  };
     return esds;
   } catch (Exception ex) {
     ex.printstacktrace();
   }
   return null;
 }
项目:repo.kmeanspp.silhouette_score    文件:SubstringReplacerBeanInfo.java   
/**
 * Returns the event set descriptors
 *
 * @return an <code>EventSetDescriptor[]</code> value
 */
public EventSetDescriptor [] getEventSetDescriptors() {
  try {
    EventSetDescriptor [] esds = 
    {       
        new EventSetDescriptor(DataSource.class,"acceptInstance")
    };
    return esds;
  } catch (Exception ex) {
    ex.printstacktrace();
  }
  return null;
}
项目:repo.kmeanspp.silhouette_score    文件:DataVisualizerBeanInfo.java   
/**
 * Get the event set descriptors for this bean
 *
 * @return an <code>EventSetDescriptor[]</code> value
 */
public EventSetDescriptor [] getEventSetDescriptors() {
  try {
    EventSetDescriptor [] esds = { 
      new EventSetDescriptor(DataVisualizer.class,"acceptDataSet"),new EventSetDescriptor(DataVisualizer.class,"acceptimage")
    };      
    return esds;
  } catch (Exception ex) {
    ex.printstacktrace();
  }
  return null;
}
项目:repo.kmeanspp.silhouette_score    文件:AbstractDataSourceBeanInfo.java   
/**
  * Get the event set descriptors pertinent to data sources
  *
  * @return an <code>EventSetDescriptor[]</code> value
  */
 public EventSetDescriptor [] getEventSetDescriptors() {
   try {
     EventSetDescriptor [] esds =  
     { new EventSetDescriptor(DataSource.class,"acceptInstance")
        };
     return esds;
   } catch (Exception ex) {
     ex.printstacktrace();
   }
   return null;
 }
项目:repo.kmeanspp.silhouette_score    文件:BeanConnection.java   
/**
 * Returns a vector of BeanInstances that can be considered as outputs (or the
 * right-hand side of a sub-flow)
 * 
 * @param subset the sub-flow to examine
 * @return a Vector of outputs of the sub-flow
 */
public static Vector<Object> outputs(Vector<Object> subset,Integer... tab) {
  Vector<Object> result = new Vector<Object>();
  for (int i = 0; i < subset.size(); i++) {
    BeanInstance temp = (BeanInstance) subset.elementAt(i);
    if (checkForTarget(temp,subset,tab)) {
      // Now check source constraint
      if (checkSourceConstraint(temp,tab)) {
        // Now check that this bean can actually produce some events
        try {
          BeanInfo bi = Introspector.getBeanInfo(temp.getBean().getClass());
          EventSetDescriptor[] esd = bi.getEventSetDescriptors();
          if (esd != null && esd.length > 0) {
            result.add(temp);
          }
        } catch (IntrospectionException ex) {
          // quietly ignore
        }
      }
    }
  }
  return result;
}
项目:repo.kmeanspp.silhouette_score    文件:SubstringLabelerBeanInfo.java   
/**
 * Returns the event set descriptors
 *
 * @return an <code>EventSetDescriptor[]</code> value
 */
public EventSetDescriptor [] getEventSetDescriptors() {
  try {
    EventSetDescriptor [] esds = 
    {       
        new EventSetDescriptor(DataSource.class,"acceptDataSet")
    };
    return esds;
  } catch (Exception ex) {
    ex.printstacktrace();
  }
  return null;
}
项目:repo.kmeanspp.silhouette_score    文件:ModelPerformanceChartBeanInfo.java   
/**
 * Get the event set descriptors for this bean
 *
 * @return an <code>EventSetDescriptor[]</code> value
 */
public EventSetDescriptor [] getEventSetDescriptors() {
  // hide all gui events
  try {
    EventSetDescriptor [] esds = { 
        new EventSetDescriptor(ModelPerformanceChart.class,"acceptimage")
    };
    return esds;
  } catch (Exception ex) {
    ex.printstacktrace();
    return null;
  }
}
项目:repo.kmeanspp.silhouette_score    文件:MetaBean.java   
/**
 * Returns true if,at this time,the object will accept a connection with
 * respect to the supplied EventSetDescriptor
 * 
 * @param esd the EventSetDescriptor
 * @return true if the object will accept a connection
 */
@Override
public boolean connectionAllowed(EventSetDescriptor esd) {
  Vector<BeanInstance> targets = getSuitableTargets(esd);
  for (int i = 0; i < targets.size(); i++) {
    BeanInstance input = targets.elementAt(i);
    if (input.getBean() instanceof BeanCommon) {
      // if (((BeanCommon)input.getBean()).connectionAllowed(esd.getName())) {
      if (((BeanCommon) input.getBean()).connectionAllowed(esd)) {
        return true;
      }
    } else {
      return true;
    }
  }
  return false;
}
项目:repo.kmeanspp.silhouette_score    文件:ClassAssignerBeanInfo.java   
/**
  * Returns the event set descriptors
  *
  * @return an <code>EventSetDescriptor[]</code> value
  */
 public EventSetDescriptor [] getEventSetDescriptors() {
   try {
     EventSetDescriptor [] esds = 
     { new EventSetDescriptor(DataSource.class,new EventSetDescriptor(TrainingSetProducer.class,"acceptTestSet")  };
     return esds;
   } catch (Exception ex) {
     ex.printstacktrace();
   }
   return null;
 }
项目:repo.kmeanspp.silhouette_score    文件:ClustererBeanInfo.java   
public EventSetDescriptor [] getEventSetDescriptors() {
   try {
     EventSetDescriptor [] esds = { 
new EventSetDescriptor(Clusterer.class,"acceptClusterer"),new EventSetDescriptor(Clusterer.class,"graph",GraphListener.class,"acceptGraph"),"acceptText"),"configuration",ConfigurationListener.class,"acceptConfiguration")
};
     return esds;
   } catch (Exception ex) {
     ex.printstacktrace();
   }
   return null;
 }
项目:incubator-netbeans    文件:Event.java   
Event(RADComponent component,EventSetDescriptor eventSetDescriptor,Method listenerMethod)
{
    this.component = component;
    this.eventSetDescriptor = eventSetDescriptor;
    this.listenerMethod = listenerMethod;
}

java.beans.FeatureDescriptor的实例源码

java.beans.FeatureDescriptor的实例源码

项目:incubator-netbeans    文件:SheetTable.java   
/** Internal implementation of getSelection() which returns the selected feature
 *  descriptor whether or not the component has focus. */
public final FeatureDescriptor _getSelection() {
    int i = getSelectedRow();
    FeatureDescriptor result;

    //Check bounds - a change can be fired after the model has been changed,but
    //before the table has received the event and updated itself,in which case
    //you get an AIOOBE
    if (i < getPropertySetModel().getCount()) {
        result = getSheetModel().getPropertySetModel().getFeatureDescriptor(getSelectedRow());
    } else {
        result = null;
    }

    return result;
}
项目:incubator-netbeans    文件:SheetTable.java   
/**
 * Select (and start editing) the given property.
 * @param fd
 * @param startEditing
 */
public void select( FeatureDescriptor fd,boolean startEditing ) {
    PropertySetModel psm = getPropertySetModel();
    final int index = psm.indexOf( fd );
    if( index < 0 ) {
        return; //not in our list
    }

    getSelectionModel().setSelectionInterval( index,index );
    if( startEditing && psm.isProperty( index ) ) {
        editCellAt( index,1,new MouseEvent( SheetTable.this,System.currentTimeMillis(),false) );
        SwingUtilities.invokelater( new Runnable() {
            @Override
            public void run() {
                SheetCellEditor cellEditor = getEditor();
                if( null != cellEditor ) {
                    InplaceEditor inplace = cellEditor.getInplaceEditor();
                    if( null != inplace && null != inplace.getComponent() ) {
                        inplace.getComponent().requestFocus();
                    }
                }
            }
        });
    }
}
项目:incubator-netbeans    文件:SheetTable.java   
@Override
public void actionPerformed(ActionEvent ae) {
    int i = getSelectedRow();

    if (i != -1) {
        FeatureDescriptor fd = getPropertySetModel().getFeatureDescriptor(i);

        if (fd instanceof Property) {
            java.beans.propertyeditor ped = PropUtils.getpropertyeditor((Property) fd);
            System.err.println(ped.getClass().getName());
        } else {
            System.err.println("PropertySets - no editor"); //NOI18N
        }
    } else {
        System.err.println("No selection"); //NOI18N
    }
}
项目:incubator-netbeans    文件:SheetTable.java   
@Override
protected Transferable createTransferable(JComponent c) {
    if (c instanceof SheetTable) {
        SheetTable table = (SheetTable) c;
        FeatureDescriptor fd = table.getSelection();

        if (fd == null) {
            return null;
        }

        String res = fd.getdisplayName();

        if (fd instanceof Node.Property) {
            Node.Property prop = (Node.Property) fd;
            res += ("\t" + PropUtils.getpropertyeditor(prop).getAsText());
        }

        return new SheetTableTransferable(res);
    }

    return null;
}
项目:incubator-netbeans    文件:propertysheet.java   
/**
 * Expand or collapse the PropertySet the given property belongs to.
 * @param fd 
 * @since 6.47
 */
protected final void toggleExpanded( FeatureDescriptor fd ) {
    int index = table.getPropertySetModel().indexOf( fd );
    if( index >= 0 ) {
        table.getPropertySetModel().toggleExpanded( index );
    }
}
项目:incubator-netbeans    文件:ModelProperty.java   
/** Creates a new instance of ModelProperty */
private ModelProperty(PropertyModel pm) {
    super(pm.getPropertyType());
    this.mdl = pm;

    if (mdl instanceof ExPropertyModel) {
        FeatureDescriptor fd = ((ExPropertyModel) mdl).getFeatureDescriptor();
        Boolean result = (Boolean) fd.getValue("canEditAsText"); // NOI18N

        if (result != null) {
            this.setValue("canEditAsText",result);
        }
    }

    //System.err.println(
    //"Created ModelProperty wrapper for mystery PropertyModel " + pm);
}
项目:incubator-netbeans    文件:PropertyEnv.java   
/**
 * Feature descritor that describes the property. It is feature
 * descriptor so one can plug in PropertyDescritor and also Node.Property
 * which both inherit from FeatureDescriptor
 */
void setFeatureDescriptor(FeatureDescriptor desc) {
    if (desc == null) {
        throw new IllegalArgumentException("Cannot set FeatureDescriptor to null."); //NOI18N
    }

    this.featureDescriptor = desc;

    if (featureDescriptor != null) {
        Object obj = featureDescriptor.getValue(PROP_CHANGE_IMMEDIATE);

        if (obj instanceof Boolean) {
            setChangeImmediate(((Boolean) obj).booleanValue());
        }
    }
}
项目:incubator-netbeans    文件:StringEditor.java   
void readEnv (FeatureDescriptor desc) {
    if (desc instanceof Node.Property){
        Node.Property prop = (Node.Property)desc;
        editable = prop.canWrite();
        //enh 29294 - support one-line editor & suppression of custom
        //editor
        instructions = (String) prop.getValue ("instructions"); //NOI18N
        oneline = Boolean.TRUE.equals (prop.getValue ("oneline")); //NOI18N
        customEd = !Boolean.TRUE.equals (prop.getValue
            ("suppressCustomEditor")); //NOI18N
    }
    Object obj = desc.getValue(ObjectEditor.PROP_NULL);
    if (Boolean.TRUE.equals(obj)) {
        nullValue = NbBundle.getMessage(StringEditor.class,"CTL_NullValue");
    } else {
        if (obj instanceof String) {
            nullValue = (String)obj;
        } else {
            nullValue = null;
        }
    }
}
项目:lazycat    文件:BeanELResolver.java   
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context,Object base) {
    if (base == null) {
        return null;
    }

    try {
        BeanInfo info = Introspector.getBeanInfo(base.getClass());
        PropertyDescriptor[] pds = info.getPropertyDescriptors();
        for (int i = 0; i < pds.length; i++) {
            pds[i].setValue(RESOLVABLE_AT_DESIGN_TIME,Boolean.TRUE);
            pds[i].setValue(TYPE,pds[i].getPropertyType());
        }
        return Arrays.asList((FeatureDescriptor[]) pds).iterator();
    } catch (IntrospectionException e) {
        //
    }

    return null;
}
项目:tomcat7    文件:BeanELResolver.java   
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context,pds[i].getPropertyType());
        }
        return Arrays.asList((FeatureDescriptor[]) pds).iterator();
    } catch (IntrospectionException e) {
        //
    }

    return null;
}
项目:tomcat7    文件:TestBeanELResolver.java   
/**
 * Tests that a valid FeatureDescriptors are returned.
 */
@Test
public void testGetFeatureDescriptors02() {
    BeanELResolver resolver = new BeanELResolver();
    ELContext context = new ELContextImpl();

    Iterator<FeatureDescriptor> result = resolver.getFeatureDescriptors(context,new Bean());

    while (result.hasNext()) {
        PropertyDescriptor featureDescriptor = (PropertyDescriptor) result.next();
        Assert.assertEquals(featureDescriptor.getPropertyType(),featureDescriptor.getValue(ELResolver.TYPE));
        Assert.assertEquals(Boolean.TRUE,featureDescriptor.getValue(ELResolver.RESOLVABLE_AT_DESIGN_TIME));
    }
}
项目:tomcat7    文件:TestMapELResolver.java   
/**
 * Tests that a valid FeatureDescriptors are returned.
 */
@Test
public void testGetFeatureDescriptors02() {
    MapELResolver mapELResolver = new MapELResolver();
    ELContext context = new ELContextImpl();

    Map<String,String> map = new HashMap<String,String>();
    map.put("key","value");
    Iterator<FeatureDescriptor> result = mapELResolver
            .getFeatureDescriptors(context,map);

    while (result.hasNext()) {
        FeatureDescriptor featureDescriptor = result.next();
        Assert.assertEquals("key",featureDescriptor.getdisplayName());
        Assert.assertEquals("key",featureDescriptor.getName());
        Assert.assertEquals("",featureDescriptor.getShortDescription());
        Assert.assertFalse(featureDescriptor.isExpert());
        Assert.assertFalse(featureDescriptor.isHidden());
        Assert.assertTrue(featureDescriptor.isPreferred());
        Assert.assertEquals("key".getClass(),featureDescriptor
                .getValue(ELResolver.RESOLVABLE_AT_DESIGN_TIME));
    }
}
项目:tomcat7    文件:TestResourceBundleELResolver.java   
/**
 * Tests that a valid FeatureDescriptors are returned.
 */
@Test
public void testGetFeatureDescriptors02() {
    ResourceBundleELResolver resolver = new ResourceBundleELResolver();
    ELContext context = new ELContextImpl();

    ResourceBundle resourceBundle = new TesterResourceBundle(
            new Object[][] { { "key","value" } });
    @SuppressWarnings("unchecked")
    Iterator<FeatureDescriptor> result = resolver.getFeatureDescriptors(
            context,resourceBundle);

    while (result.hasNext()) {
        FeatureDescriptor featureDescriptor = result.next();
        Assert.assertEquals("key",featureDescriptor.getShortDescription());
        Assert.assertFalse(featureDescriptor.isExpert());
        Assert.assertFalse(featureDescriptor.isHidden());
        Assert.assertTrue(featureDescriptor.isPreferred());
        Assert.assertEquals(String.class,featureDescriptor
                .getValue(ELResolver.RESOLVABLE_AT_DESIGN_TIME));
    }
}
项目:myfaces-trinidad    文件:JavaIntrospector.java   
/**
 * Add all of the attributes of one FeatureDescriptor to thos
 * of another,replacing any attributes that conflict.
 */
static void __addFeatureValues(
  FeatureDescriptor addingDescriptor,FeatureDescriptor destinationDescriptor
  )
{
  Enumeration<String> keys = addingDescriptor.attributeNames();

  if (keys != null)
  {
    while (keys.hasMoreElements())
    {
      String key = keys.nextElement();
      Object value = addingDescriptor.getValue(key);
      destinationDescriptor.setValue(key,value);
    }
  }
}
项目:apache-tomcat-7.0.73-with-comment    文件:BeanELResolver.java   
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context,pds[i].getPropertyType());
        }
        return Arrays.asList((FeatureDescriptor[]) pds).iterator();
    } catch (IntrospectionException e) {
        //
    }

    return null;
}
项目:apache-tomcat-7.0.73-with-comment    文件:TestBeanELResolver.java   
/**
 * Tests that a valid FeatureDescriptors are returned.
 */
@Test
public void testGetFeatureDescriptors02() {
    BeanELResolver resolver = new BeanELResolver();
    ELContext context = new ELContextImpl();

    Iterator<FeatureDescriptor> result = resolver.getFeatureDescriptors(context,featureDescriptor.getValue(ELResolver.RESOLVABLE_AT_DESIGN_TIME));
    }
}
项目:apache-tomcat-7.0.73-with-comment    文件:TestMapELResolver.java   
/**
 * Tests that a valid FeatureDescriptors are returned.
 */
@Test
public void testGetFeatureDescriptors02() {
    MapELResolver mapELResolver = new MapELResolver();
    ELContext context = new ELContextImpl();

    Map<String,featureDescriptor
                .getValue(ELResolver.RESOLVABLE_AT_DESIGN_TIME));
    }
}
项目:apache-tomcat-7.0.73-with-comment    文件:TestResourceBundleELResolver.java   
/**
 * Tests that a valid FeatureDescriptors are returned.
 */
@Test
public void testGetFeatureDescriptors02() {
    ResourceBundleELResolver resolver = new ResourceBundleELResolver();
    ELContext context = new ELContextImpl();

    ResourceBundle resourceBundle = new TesterResourceBundle(
            new Object[][] { { "key",featureDescriptor
                .getValue(ELResolver.RESOLVABLE_AT_DESIGN_TIME));
    }
}
项目:incubator-netbeans    文件:StringEditor.java   
@Override
public void attachEnv(PropertyEnv env) {        
    FeatureDescriptor desc = env.getFeatureDescriptor();
    if (desc instanceof Node.Property){
        Node.Property prop = (Node.Property)desc;
        editable = prop.canWrite();
        if (textComp != null)
            textComp.setEditable(editable);
    }
}
项目:incubator-netbeans    文件:Valuepropertyeditor.java   
@Override
public void attachEnv(PropertyEnv env) {
    //System.out.println("Valuepropertyeditor.attachEnv("+env+"),feature descriptor = "+env.getFeatureDescriptor());
    env.setState(PropertyEnv.STATE_NEEDS_VALIDATION);
    env.addVetoablechangelistener(validate);
    if (delegatepropertyeditor instanceof Expropertyeditor) {
        //System.out.println("  attaches to "+delegatepropertyeditor);
        if (delegateValue instanceof String) {
            ShortenedStrings.StringInfo shortenedInfo = ShortenedStrings.getShortenedInfo((String) delegateValue);
            if (shortenedInfo != null) {
                // The value is too large,do not allow editing!
                FeatureDescriptor desc = env.getFeatureDescriptor();
                if (desc instanceof Node.Property){
                    Node.Property prop = (Node.Property)desc;
                    // Need to make it uneditable
                    try {
                        Method forceNotEditableMethod = prop.getClass().getDeclaredMethod("forceNotEditable");
                        forceNotEditableMethod.setAccessible(true);
                        forceNotEditableMethod.invoke(prop);
                    } catch (Exception ex){}
                    //editable = prop.canWrite();
                }
            }
        }
        ((Expropertyeditor) delegatepropertyeditor).attachEnv(env);
        this.env = env;
    }
}
项目:incubator-netbeans    文件:RuleEditorPanel.java   
private void call_propertysheet_select(propertysheet sheet,FeatureDescriptor descriptor,boolean edit) throws NoSuchMethodException,illegalaccessexception,IllegalArgumentException,InvocationTargetException {
    //private so far,will be public later
    Class clz = propertysheet.class;
    Method select_method = clz.getDeclaredMethod("select",FeatureDescriptor.class,boolean.class); //NOI18N
    select_method.setAccessible(true);
    select_method.invoke(sheet,descriptor,edit);
}
项目:incubator-netbeans    文件:RuleEditorPanel.java   
@Override
protected jpopupmenu createPopupMenu() {
    FeatureDescriptor fd = getSelection();
    if (fd != null) {
        if (fd instanceof RuleEditorNode.DeclarationProperty) {
            //property
            //
            //actions:
            //remove
            //hide
            //????
            //custom popop for the whole panel
            jpopupmenu pm = new jpopupmenu();

            if(!addPropertyMode) {
                pm.add(new GoToSourceAction(RuleEditorPanel.this,(RuleEditorNode.DeclarationProperty) fd));
                pm.addSeparator();
                pm.add(new RemovePropertyAction(RuleEditorPanel.this,(RuleEditorNode.DeclarationProperty) fd));
            }

            return pm;

        } else if (fd instanceof RuleEditorNode.PropertyCategoryPropertySet) {
            //property category
            //Todo possibly add "add property" action which would
            //preselect the css category in the "add property dialog".
        }
    }

    //no context popup - create the generic popup
    return genericPopupMenu;
}
项目:incubator-netbeans    文件:SheetTable.java   
private TableCellRenderer getCustomrenderer( int row ) {
    FeatureDescriptor fd = getPropertySetModel().getFeatureDescriptor(row);

    if (fd instanceof PropertySet)
        return null;

    Object res = fd.getValue( "custom.cell.renderer"); //NOI18N
    if( res instanceof TableCellRenderer ) {
        prepareCustomEditor( res );
        return ( TableCellRenderer ) res;
    }
    return null;
}
项目:incubator-netbeans    文件:SheetTable.java   
private TableCellEditor getCustomEditor( int row ) {
    FeatureDescriptor fd = getPropertySetModel().getFeatureDescriptor(row);

    if (fd instanceof PropertySet)
        return null;

    Object res = fd.getValue( "custom.cell.editor"); //NOI18N
    if( res instanceof TableCellEditor ) {
        prepareCustomEditor( res );
        return ( TableCellEditor ) res;
    }
    return null;
}
项目:incubator-netbeans    文件:SheetTable.java   
/** Overridden to cast value to FeatureDescriptor and return true if the
 * text matches its display name.  The popup search field uses this method
 * to check matches. */
@Override
protected boolean matchText(Object value,String text) {
    if (value instanceof FeatureDescriptor) {
        return ((FeatureDescriptor) value).getdisplayName().toupperCase().startsWith(text.toupperCase());
    } else {
        return false;
    }
}
项目:incubator-netbeans    文件:SheetTable.java   
/** We only use a single listener on the selected node,propertysheet.SheetPCListener,* to centralize things.  It will call this method if a property change is detected
 * so that it can be repainted. */
void repaintProperty(String name) {
    if (!isShowing()) {
        return;
    }

    if (PropUtils.isLoggable(SheetTable.class)) {
        PropUtils.log(SheetTable.class,"RepaintProperty: " + name);
    }

    PropertySetModel psm = getPropertySetModel();
    int min = getFirstVisibleRow();

    if (min == -1) {
        return;
    }

    int max = min + getVisibleRowCount();

    for (int i = min; i < max; i++) {
        FeatureDescriptor fd = psm.getFeatureDescriptor(i);

        if (null != fd && fd.getName().equals(name)) {
            //repaint property value & name
            paintRow( i );

            return;
        }
    }

    if (PropUtils.isLoggable(SheetTable.class)) {
        PropUtils.log(SheetTable.class,"Property is either scrolled offscreen or property name is bogus: " + name);
    }
}
项目:incubator-netbeans    文件:SheetTable.java   
/**Overridden to do the assorted black magic by which one determines if
 * a property is editable */
@Override
public boolean isCellEditable(int row,int column) {
    if (column == 0) {
        return null != getCustomEditor( row );
    }

    FeatureDescriptor fd = getPropertySetModel().getFeatureDescriptor(row);
    boolean result;

    if (fd instanceof PropertySet) {
        result = false;
    } else {
        Property p = (Property) fd;
        result = p.canWrite();

        if (result) {
            Object val = p.getValue("canEditAsText"); //NOI18N

            if (val != null) {
                result &= Boolean.TRUE.equals(val);
                if( !result ) {
                    //#227661 - combo Box editor should be allowed to show its popup
                    propertyeditor ped = PropUtils.getpropertyeditor(p);
                    result |= ped.getTags() != null;
                }
            }
        }
    }

    return result;
}
项目:incubator-netbeans    文件:SheetTable.java   
@Override
public void actionPerformed(ActionEvent ae) {
    FeatureDescriptor fd = _getSelection();

    if (fd instanceof PropertySet) {
        int row = SheetTable.this.getSelectedRow();
        boolean b = getPropertySetModel().isExpanded(fd);

        if (b) {
            toggleExpanded(row);
        }
    }
}
项目:incubator-netbeans    文件:SheetTable.java   
@Override
public void actionPerformed(ActionEvent ae) {
    FeatureDescriptor fd = _getSelection();

    if (fd instanceof PropertySet) {
        int row = SheetTable.this.getSelectedRow();
        boolean b = getPropertySetModel().isExpanded(fd);

        if (!b) {
            toggleExpanded(row);
        }
    }
}
项目:incubator-netbeans    文件:EditablePropertydisplayer.java   
public void valueChanged(propertyeditor editor) {
    Failed = false;

    try {
        //                System.err.println("ValueChanged - new value " + editor.getValue());
        if (getInplaceEditor() != null) {
            setEnteredValue(getproperty().getValue());
        } else {
            //Handle case where our parent PropertyPanel is no longer showing,but
            //the custom editor we invoked still is.  Issue 38004
            PropertyModel mdl = (modelRef != null) ? modelRef.get() : null;

            if (mdl != null) {
                FeatureDescriptor fd = null;

                if (mdl instanceof ExPropertyModel) {
                    fd = ((ExPropertyModel) mdl).getFeatureDescriptor();
                }

                String title = null;

                if (fd != null) {
                    title = fd.getdisplayName();
                }

                Failed = PropUtils.updateProp(mdl,editor,title); //XXX
            }
        }
    } catch (Exception e) {
        throw (IllegalStateException) new IllegalStateException("Problem setting entered value from custom editor").initCause(e);
    }
}
项目:incubator-netbeans    文件:EditorPropertydisplayer.java   
/** Basically some hacks to acquire the underlying property descriptor in
 * the case of a wrapper.  This is here because some property editors will
 * cast the result of PropertyEnv.getFeatureDescriptor() as a specific
 * implementation type,so even if we're wrapping a property model,we
 * still need to make sure we're returning the class they expect.  */
static final FeatureDescriptor findFeatureDescriptor(Propertydisplayer pd) {
    if (pd instanceof EditorPropertydisplayer) {
        //Issue 38004,more gunk to ensure we get the right feature
        //descriptor
        EditorPropertydisplayer epd = (EditorPropertydisplayer) pd;

        if (epd.modelRef != null) {
            PropertyModel pm = epd.modelRef.get();

            if (pm instanceof ExPropertyModel) {
                FeatureDescriptor fd = ((ExPropertyModel) pm).getFeatureDescriptor();

                if (fd != null) {
                    return fd;
                }
            }
        }
    }

    Property p = pd.getproperty();

    if (p instanceof ModelProperty) {
        return ((ModelProperty) p).getFeatureDescriptor();
    } else if (p instanceof ModelProperty.DPMWrapper) {
        return ((ModelProperty.DPMWrapper) p).getFeatureDescriptor();
    } else {
        return p;
    }
}
项目:incubator-netbeans    文件:ModelProperty.java   
/** Used by EditablePropertydisplayer to provide access to the real
 * feature descriptor.  Some property editors will cast the result of
 * env.getFeatureDescriptor() as Property or PropertyDescriptor,so we
 * need to return the original */
FeatureDescriptor getFeatureDescriptor() {
    if (mdl instanceof ExPropertyModel) {
        return ((ExPropertyModel) mdl).getFeatureDescriptor();
    } else {
        return this;
    }
}
项目:incubator-netbeans    文件:PropertyPanel.java   
public String getAccessibleName() {
    String name = super.getAccessibleName();

    if ((name == null) && model instanceof ExPropertyModel) {
        FeatureDescriptor fd = ((ExPropertyModel) model).getFeatureDescriptor();
        name = NbBundle.getMessage(PropertyPanel.class,"ACS_PropertyPanel",fd.getdisplayName()); //NOI18N
    }

    return name;
}
项目:incubator-netbeans    文件:PropertyPanel.java   
public String getAccessibleDescription() {
    String description = super.getAccessibleDescription();

    if ((description == null) && model instanceof ExPropertyModel) {
        FeatureDescriptor fd = ((ExPropertyModel) model).getFeatureDescriptor();
        description = NbBundle.getMessage(PropertyPanel.class,"ACSD_PropertyPanel",fd.getShortDescription()); //NOI18N
    }

    return description;
}
项目:incubator-netbeans    文件:PropertyEnv.java   
@Override
public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append(getClass().getName());
    sb.append("@"); //NOI18N
    sb.append(System.identityHashCode(this));
    sb.append("[state="); //NOI18N
    sb.append(
        (state == STATE_NEEDS_VALIDATION) ? "STATE_NEEDS_VALIDATION"
                                          : ((state == STATE_INVALID) ? "STATE_INVALID" : "STATE_VALID")
    ); //NOI18N
    sb.append(","); //NOI18N

    Factory f = factory;
    if (f != null) {
        sb.append("InplaceEditorFactory=").append(f.getClass().getName()); //NOI18N
        sb.append(","); //NOI18N
    }

    sb.append("editable="); //NOI18N
    sb.append(editable);
    sb.append(",isChangeImmediate="); //NOI18N
    sb.append(isChangeImmediate());
    sb.append(",featureDescriptor="); //NOI18N
    final FeatureDescriptor fd = getFeatureDescriptor();
    if (fd != null) {
        sb.append(fd.getdisplayName());
    } else {
        sb.append("null"); // NOI18N
    }

    return sb.toString();
}
项目:incubator-netbeans    文件:GlobalContextImpltest.java   
public void testCurrentNodes () throws Exception {
    tc.setActivatednodes(new Node[] {Node.EMPTY});

    assertEquals ("This fires change",cnt);

    assertEquals ("One item in result",result.allItems ().size ());
    Lookup.Item item = (Lookup.Item)result.allItems ().iterator ().next ();
    assertEquals ("Item should return Node.EMPTY",Node.EMPTY,item.getInstance());
    assertActionMap ();

    tc.setActivatednodes (null);
    assertEquals ("One change",2,cnt);

    assertEquals ("One empty item in result",result.allItems ().size ());
    item = (Lookup.Item)result.allItems ().iterator ().next ();
    assertEquals ("Item should return null",null,item.getInstance());
    assertEquals ("Name is null","none",item.getId ());
    assertActionMap ();

    Result<MyNode> subclass = lookup.lookup (new Lookup.Template<MyNode> (MyNode.class));
    assertTrue("No items are returned",subclass.allItems().isEmpty());

    Result<FeatureDescriptor> superclass = lookup.lookup (new Lookup.Template<FeatureDescriptor>(FeatureDescriptor.class));
    assertEquals("One item is returned",superclass.allItems().size());
    item = (Lookup.Item)superclass.allItems ().iterator ().next ();
    assertEquals ("Item should return null",item.getInstance());

    tc.setActivatednodes (new Node[0]);
    assertEquals ("No change",3,cnt);

    assertEquals ("No items in lookup",result.allItems ().size ());
    assertActionMap ();
}
项目:incubator-netbeans    文件:PropertiesEditor.java   
@Override
public void attachEnv(PropertyEnv env) {
    FeatureDescriptor d = env.getFeatureDescriptor();
    if (d instanceof Node.Property) {
        canWrite = ((Node.Property) d).canWrite();
    }
}
项目:incubator-netbeans    文件:NullStringEditor.java   
/**
 */
public void attachEnv (PropertyEnv env) {
    FeatureDescriptor desc = env.getFeatureDescriptor();

    if (desc instanceof Node.Property){
        Node.Property prop = (Node.Property)desc;

        editable = prop.canWrite();
    }
}
项目:incubator-netbeans    文件:HelpStringCustomEditor.java   
public void attachEnv(PropertyEnv env) {
    this.env = env;

    FeatureDescriptor desc = env.getFeatureDescriptor();
    if (desc instanceof Node.Property){
        Node.Property prop = (Node.Property)desc;
        editable = prop.canWrite();
        //enh 29294 - support one-line editor & suppression of custom
        //editor
        instructions = (String) prop.getValue ("instructions"); //NOI18N
        oneline = Boolean.TRUE.equals (prop.getValue ("oneline")); //NOI18N
        customEd = !Boolean.TRUE.equals (prop.getValue 
            ("suppressCustomEditor")); //NOI18N
    }
}
项目:tomcat7    文件:CompositeELResolver.java   
@Override
public FeatureDescriptor next() {
    if (!hasNext())
        throw new NoSuchElementException();
    FeatureDescriptor result = this.next;
    this.next = null;
    return result;

}

关于java.beans.PropertyDescriptor的实例源码java bean技术的介绍现已完结,谢谢您的耐心阅读,如果想了解更多关于hudson.model.JobPropertyDescriptor的实例源码、java.beans.BeanDescriptor的实例源码、java.beans.EventSetDescriptor的实例源码、java.beans.FeatureDescriptor的实例源码的相关知识,请在本站寻找。

本文标签: