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


Java PropertyEditorManager.findEditor方法代码示例

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


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

示例1: findThePropertyEditor

import java.beans.PropertyEditorManager; //导入方法依赖的package包/类
private static PropertyEditor findThePropertyEditor(Class clazz) {
    PropertyEditor pe;
    if (Object.class.equals(clazz)) {
        pe = null;
    } else {
        pe = PropertyEditorManager.findEditor(clazz);
        if (pe == null) {
            Class sclazz = clazz.getSuperclass();
            if (sclazz != null) {
                pe = findPropertyEditor(sclazz);
            }
        }
    }
    classesWithPE.put(clazz, pe != null);
    return pe;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ValuePropertyEditor.java

示例2: btnSelectFontActionPerformed

import java.beans.PropertyEditorManager; //导入方法依赖的package包/类
private void btnSelectFontActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSelectFontActionPerformed
    PropertyEditor pe = PropertyEditorManager.findEditor(Font.class);
    if (pe != null) {
        pe.setValue(outputOptions.getFont());
        DialogDescriptor dd = new DialogDescriptor(pe.getCustomEditor(),
                NbBundle.getMessage(Controller.class,
                "LBL_Font_Chooser_Title"));                         //NOI18N
        String defaultFont = NbBundle.getMessage(Controller.class,
                "BTN_Defaul_Font");                                 //NOI18N
        dd.setOptions(new Object[]{DialogDescriptor.OK_OPTION,
                    defaultFont, DialogDescriptor.CANCEL_OPTION});  //NOI18N
        DialogDisplayer.getDefault().createDialog(dd).setVisible(true);
        if (dd.getValue() == DialogDescriptor.OK_OPTION) {
            Font f = (Font) pe.getValue();
            outputOptions.setFont(f);
        } else if (dd.getValue() == defaultFont) {
            outputOptions.setFont(null);
        }
        updateFontField();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:OutputSettingsPanel.java

示例3: getProperty

import java.beans.PropertyEditorManager; //导入方法依赖的package包/类
public static Property getProperty(Field field, Object object) {
    // access also protected and private fields
    field.setAccessible(true);

    // Properties are only primitive types marked by Prop annotation
    if (field.isAnnotationPresent(JProp.class)) {
        // We require that class of the field to be loaded, because we often specify
        // the PropertyEditor there in static block.
        forceInitialization(field.getType());

        //TODO this condition should be used on client when deciding whether to show an editor for it
        if (PropertyEditorManager.findEditor(field.getType()) != null) {
            // add the property
            return new JavaProperty(object, field);
        }
    }
    return null;
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:19,代码来源:Introspector.java

示例4: findCustomEditor

import java.beans.PropertyEditorManager; //导入方法依赖的package包/类
/**
 * @param requiredType
 * @param propertyPath
 * @return
 */
public PropertyEditor findCustomEditor ( final Class<?> requiredType, final String propertyPath )
{
    // first try to find exact match
    String key = requiredType.getCanonicalName () + ":" + propertyPath;
    PropertyEditor pe = this.propertyEditors.get ( key );
    // 2nd: try to find for class only
    if ( pe == null )
    {
        key = requiredType.getCanonicalName () + ":";
        pe = this.propertyEditors.get ( key );
    }
    // 3rd: try to get internal
    if ( pe == null )
    {
        pe = PropertyEditorManager.findEditor ( requiredType );
    }
    return pe;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:24,代码来源:PropertyEditorRegistry.java

示例5: getValueFromPropertyEditorManager

import java.beans.PropertyEditorManager; //导入方法依赖的package包/类
public static Object getValueFromPropertyEditorManager(
                 Class<?> attrClass, String attrName, String attrValue) 
    throws JasperException 
{
    try {
        PropertyEditor propEditor = 
            PropertyEditorManager.findEditor(attrClass);
        if (propEditor != null) {
            propEditor.setAsText(attrValue);
            return propEditor.getValue();
        } else {
            throw new IllegalArgumentException(
                Localizer.getMessage("jsp.error.beans.propertyeditor.notregistered"));
        }
    } catch (IllegalArgumentException ex) {
        throw new JasperException(
            Localizer.getMessage("jsp.error.beans.property.conversion",
                                 attrValue, attrClass.getName(), attrName,
                                 ex.getMessage()));
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:22,代码来源:JspRuntimeLibrary.java

示例6: getValueFromPropertyEditorManager

import java.beans.PropertyEditorManager; //导入方法依赖的package包/类
public static Object getValueFromPropertyEditorManager(
             Class attrClass, String attrName, String attrValue) 
throws JasperException 
   {
try {
    PropertyEditor propEditor = 
	PropertyEditorManager.findEditor(attrClass);
    if (propEditor != null) {
	propEditor.setAsText(attrValue);
	return propEditor.getValue();
    } else {
	throw new IllegalArgumentException(
                   Localizer.getMessage("jsp.error.beans.propertyeditor.notregistered"));
    }
} catch (IllegalArgumentException ex) {
    throw new JasperException(
               Localizer.getMessage("jsp.error.beans.property.conversion",
			     attrValue, attrClass.getName(), attrName,
			     ex.getMessage()));
}
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:JspRuntimeLibrary.java

示例7: getValueFromPropertyEditorManager

import java.beans.PropertyEditorManager; //导入方法依赖的package包/类
public static Object getValueFromPropertyEditorManager(Class<?> attrClass, String attrName, String attrValue)
		throws JasperException {
	try {
		PropertyEditor propEditor = PropertyEditorManager.findEditor(attrClass);
		if (propEditor != null) {
			propEditor.setAsText(attrValue);
			return propEditor.getValue();
		} else {
			throw new IllegalArgumentException(
					Localizer.getMessage("jsp.error.beans.propertyeditor.notregistered"));
		}
	} catch (IllegalArgumentException ex) {
		throw new JasperException(Localizer.getMessage("jsp.error.beans.property.conversion", attrValue,
				attrClass.getName(), attrName, ex.getMessage()));
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:17,代码来源:JspRuntimeLibrary.java

示例8: run

import java.beans.PropertyEditorManager; //导入方法依赖的package包/类
public void run() {
    try {
        Thread.sleep(this.time); // increase the chance of the deadlock
        if (this.sync) {
            synchronized (Test6963811.class) {
                PropertyEditorManager.findEditor(Super.class);
            }
        }
        else {
            PropertyEditorManager.findEditor(Sub.class);
        }
    }
    catch (Exception exception) {
        exception.printStackTrace();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:17,代码来源:Test6963811.java

示例9: convert

import java.beans.PropertyEditorManager; //导入方法依赖的package包/类
private static Object convert(Object value, Class<?> type) {
    if( type.isArray() ) {
        if( value.getClass().isArray() ) {
            int length = Array.getLength(value);
            Class<?> componentType = type.getComponentType();
            Object rc = Array.newInstance(componentType, length);
            for (int i = 0; i < length; i++) {
                Object o = Array.get(value, i);
                Array.set(rc, i, convert(o, componentType));
            }
            return rc;
        }
    }
    PropertyEditor editor = PropertyEditorManager.findEditor(type);
    if (editor != null) {
        editor.setAsText(value.toString());
        return editor.getValue();
    }
    return null;
}
 
开发者ID:apache,项目名称:aries-rsa,代码行数:21,代码来源:IntrospectionSupport.java

示例10: findEditor

import java.beans.PropertyEditorManager; //导入方法依赖的package包/类
/**
 * Retrieve an editor object for a given class.
 * This method seems unable to retrieve a primitive editor for obscure reasons.
 * So better use the one based on PropertyDescriptor if possible.
 */
public static PropertyEditor findEditor(Class<?> cls) {
    PropertyEditor editor = PropertyEditorManager.findEditor(cls);

    // Try to unwrap primitives
    if (editor == null && Primitives.isWrapperType(cls)) {
        editor = PropertyEditorManager.findEditor(Primitives.unwrap(cls));
    }

    if ((editor == null) && useDefaultGOE) {
        if (cls.isArray()) {
            Class<?> unwrapped = Primitives.isWrapperType(cls.getComponentType()) ? Primitives.unwrap(cls.getComponentType()) : cls;
            if (unwrapped.isPrimitive()) {
                editor = new ArrayEditor();
            } else {
                editor = new ObjectArrayEditor<>(unwrapped.getComponentType());
            }
        } else if (cls.isEnum()) {
            editor = new EnumEditor();
        } else {
            editor = new GenericObjectEditor();
            ((GenericObjectEditor)editor).setClassType(cls);
        }
    }
    return editor;
}
 
开发者ID:openea,项目名称:eva2,代码行数:31,代码来源:PropertyEditorProvider.java

示例11: load

import java.beans.PropertyEditorManager; //导入方法依赖的package包/类
/**
 * Load values from the LocaleOption
 */
void load() {
    final LocaleOption localeOption = LocaleOption.getDefault();
    
    final String[] datePatternsList = localeOption.getDatePatternList();
    this.datePatternsPE = PropertyEditorManager.findEditor(String[].class);
    this.datePatternsPE.setValue( datePatternsList );
    
    final String[] messagePatternsList = localeOption.getMessagePatternList();
    this.messagePatternsPE = PropertyEditorManager.findEditor(String[].class);
    this.messagePatternsPE.setValue( messagePatternsList );
    
    final String[] numberPatternsList = localeOption.getNumberPatternList();
    this.numberPatternsPE = PropertyEditorManager.findEditor(String[].class);
    this.numberPatternsPE.setValue( numberPatternsList );
    
    //---
    this.datePatternsTextField.setText( this.datePatternsPE.getAsText() );
    this.messagePatternsTextField.setText( this.messagePatternsPE.getAsText() );
    this.numberPatternsTextField.setText( this.numberPatternsPE.getAsText() );
    
    
    this.dateParseFormattedTextField.setValue( localeOption.getMessageArgDatePattern() );
    this.numberParseFormattedTextField.setValue( localeOption.getMessageArgNumberPattern() );
}
 
开发者ID:bernhardhuber,项目名称:netbeansplugins,代码行数:28,代码来源:LocalenbPanel.java

示例12: convert

import java.beans.PropertyEditorManager; //导入方法依赖的package包/类
private static Object convert(TypeConverter typeConverter, Class<?> type, Object value)
    throws URISyntaxException, NoTypeConversionAvailableException {
    if (typeConverter != null) {
        return typeConverter.mandatoryConvertTo(type, value);
    }
    if (type == URI.class) {
        return new URI(value.toString());
    }
    PropertyEditor editor = PropertyEditorManager.findEditor(type);
    if (editor != null) {
        // property editor is not thread safe, so we need to lock
        Object answer;
        synchronized (LOCK) {
            editor.setAsText(value.toString());
            answer = editor.getValue();
        }
        return answer;
    }
    return null;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:IntrospectionSupport.java

示例13: getPropertyEditor

import java.beans.PropertyEditorManager; //导入方法依赖的package包/类
/**
 * Get a property editor given a property type.
 *
 * @param propertyType The property type to look up an editor for.
 * @param path The property path, if applicable.
 * @return property editor
 */
public static PropertyEditor getPropertyEditor(Class<?> propertyType) {
    PropertyEditorRegistry registry = getPropertyEditorRegistry();
    PropertyEditor editor = null;
    
    if (registry != null) {
        editor = registry.findCustomEditor(propertyType, null);
    } else {
        
        DataDictionaryService dataDictionaryService = KRADServiceLocatorWeb.getDataDictionaryService();
        Map<Class<?>, String> editorMap = dataDictionaryService.getPropertyEditorMap();
        String editorPrototypeName = editorMap == null ? null : editorMap.get(propertyType);
        
        if (editorPrototypeName != null) {
            editor = (PropertyEditor) dataDictionaryService.getDataDictionary().getDictionaryPrototype(editorPrototypeName);
        }
    }

    if (editor == null && propertyType != null) {
        // Fall back to default beans lookup
        editor = PropertyEditorManager.findEditor(propertyType);
    }

    return editor;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:32,代码来源:ObjectPropertyUtils.java

示例14: TestEditor

import java.beans.PropertyEditorManager; //导入方法依赖的package包/类
TestEditor(Class type) {
    System.out.println("Property class: " + type);

    this.editor = PropertyEditorManager.findEditor(type);
    if (this.editor == null)
        throw new Error("could not find editor for " + type);

    System.out.println("PropertyEditor class: " + this.editor.getClass());
    validate(null, null);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:TestEditor.java

示例15: testPERegistered

import java.beans.PropertyEditorManager; //导入方法依赖的package包/类
public void testPERegistered() {
    NodeOp.registerPropertyEditors();
    PropertyEditor pEditor = PropertyEditorManager.findEditor(Double[].class);
    assertEquals("org.netbeans.modules.openide.nodes.TestPropertyEditor", pEditor.getClass().getName());
    pEditor = PropertyEditorManager.findEditor(Integer.class);
    assertEquals("org.netbeans.modules.openide.nodes.TestPropertyEditor", pEditor.getClass().getName());
    pEditor = PropertyEditorManager.findEditor(char[][].class);
    assertEquals("org.netbeans.modules.openide.nodes.TestPropertyEditor", pEditor.getClass().getName());
    pEditor = PropertyEditorManager.findEditor(short.class);
    assertEquals("org.netbeans.modules.openide.nodes.TestPropertyEditor", pEditor.getClass().getName());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:PEAnnotationProcessorTest.java


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