类java.beans.PropertyEditorManager源码实例Demo

下面列出了怎么用java.beans.PropertyEditorManager的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: Tomcat8-Source-Read   文件: JspRuntimeLibrary.java
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()));
    }
}
 
源代码2 项目: dragonwell8_jdk   文件: Test6963811.java
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();
    }
}
 
源代码3 项目: tomcatsrc   文件: JspRuntimeLibrary.java
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()));
    }
}
 
源代码4 项目: openjdk-jdk8u   文件: Test6963811.java
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();
    }
}
 
源代码5 项目: netbeans   文件: ValuePropertyEditor.java
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;
}
 
源代码6 项目: netbeans   文件: PELookupTest.java
public void testPackageUnregistering() {
    MockLookup.setInstances(new NodesRegistrationSupport.PEPackageRegistration("test1.pkg"));
    NodeOp.registerPropertyEditors();
    MockLookup.setInstances(new NodesRegistrationSupport.PEPackageRegistration("test2.pkg"));
    
    String[] editorSearchPath = PropertyEditorManager.getEditorSearchPath();
    int count = 0;
    for (int i = 0; i < editorSearchPath.length; i++) {
        assertNotSame("test1.pkg", editorSearchPath[i]);
        if ("test2.pkg".equals(editorSearchPath[i])) {
            count++;
        }
    }
    assertEquals(1, count);
    
}
 
源代码7 项目: netbeans   文件: OutputSettingsPanel.java
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();
    }
}
 
源代码8 项目: netbeans   文件: TermOptionsPanel.java
private void fontButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fontButtonActionPerformed
PropertyEditor pe = PropertyEditorManager.findEditor(Font.class);
if (pe != null) {
    pe.setValue(termOptions.getFont());
    DialogDescriptor dd = new DialogDescriptor(pe.getCustomEditor(), FontChooser_title());

    String defaultFontString = FontChooser_defaultFont_label();
    dd.setOptions(new Object[]{DialogDescriptor.OK_OPTION,
	defaultFontString, DialogDescriptor.CANCEL_OPTION});  //NOI18N
    DialogDisplayer.getDefault().createDialog(dd).setVisible(true);
    if (dd.getValue() == DialogDescriptor.OK_OPTION) {
	Font f = (Font) pe.getValue();
	termOptions.setFont(f);
	applyTermOptions();
    } else if (dd.getValue() == defaultFontString) {
	Font controlFont = UIManager.getFont("controlFont");			//NOI18N
	int fontSize = (controlFont == null) ? 12 : controlFont.getSize();
	termOptions.setFont(new Font("monospaced", Font.PLAIN, fontSize));	//NOI18N
    }
}
   }
 
源代码9 项目: neoscada   文件: PropertyEditorRegistry.java
/**
 * @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;
}
 
源代码10 项目: Tomcat7.0.67   文件: JspRuntimeLibrary.java
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()));
    }
}
 
源代码11 项目: openjdk-jdk8u-backup   文件: Test6963811.java
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();
    }
}
 
源代码12 项目: openjdk-8-source   文件: Test6963811.java
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();
    }
}
 
源代码13 项目: packagedrone   文件: JspRuntimeLibrary.java
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()));
}
   }
 
源代码14 项目: openjdk-8   文件: Test6963811.java
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();
    }
}
 
源代码15 项目: jdk8u-dev-jdk   文件: Test6963811.java
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();
    }
}
 
源代码16 项目: Tomcat8-Source-Read   文件: TestELSupport.java
@Test
public void testCoerceToType14() {
    PropertyEditorManager.registerEditor(TesterType.class, TesterTypeEditorNoError.class);
    Object result = ELManager.getExpressionFactory().coerceToType(
            "Foo", TesterType.class);
    Assert.assertTrue(result instanceof TesterType);
    Assert.assertEquals("Foo", ((TesterType) result).getValue());
}
 
源代码17 项目: openjdk-8   文件: Test4080522.java
private static void test(String[] path) {
    try {
        Beans.setDesignTime(true);
        Beans.setGuiAvailable(true);
        Introspector.setBeanInfoSearchPath(path);
        PropertyEditorManager.setEditorSearchPath(path);
    } catch (SecurityException exception) {
        throw new Error("unexpected security exception", exception);
    }
}
 
源代码18 项目: Tomcat8-Source-Read   文件: TestELSupport.java
@Test
public void testCoerceToType16() {
    PropertyEditorManager.registerEditor(TesterType.class, TesterTypeEditorError.class);
    Object result = ELManager.getExpressionFactory().coerceToType(
            "", TesterType.class);
    Assert.assertNull(result);
}
 
源代码19 项目: openjdk-8-source   文件: TestEditor.java
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);
}
 
源代码20 项目: jdk8u-dev-jdk   文件: Test6397609.java
public static void main(String[] args) throws Exception {
    MemoryClassLoader loader = new MemoryClassLoader();
    PropertyEditorManager.registerEditor(
            Object.class,
            loader.compile("Editor",
                           "public class Editor extends java.beans.PropertyEditorSupport {}"));

    if (!isEditorExist(Object.class)) {
        throw new Error("the editor is lost");
    }
    loader = null; // clean the reference
    if (isEditorExist(Object.class)) {
        throw new Error("unexpected editor is found");
    }
}
 
源代码21 项目: dragonwell8_jdk   文件: TestPropertyEditor.java
private static void test(Class<?> type, Class<? extends PropertyEditor> expected) {
    PropertyEditor actual = PropertyEditorManager.findEditor(type);
    if ((actual == null) && (expected != null)) {
        throw new Error("expected editor is not found");
    }
    if ((actual != null) && !actual.getClass().equals(expected)) {
        throw new Error("found unexpected editor");
    }
}
 
源代码22 项目: jdk8u_jdk   文件: Test6397609.java
private static boolean isEditorExist(Class type) {
    for (int i = 0; i < 10; i++) {
        System.gc(); // clean all weak references
        if (null == PropertyEditorManager.findEditor(type)) {
            return false;
        }
    }
    return true;
}
 
源代码23 项目: dragonwell8_jdk   文件: Test6397609.java
public static void main(String[] args) throws Exception {
    MemoryClassLoader loader = new MemoryClassLoader();
    PropertyEditorManager.registerEditor(
            Object.class,
            loader.compile("Editor",
                           "public class Editor extends java.beans.PropertyEditorSupport {}"));

    if (!isEditorExist(Object.class)) {
        throw new Error("the editor is lost");
    }
    loader = null; // clean the reference
    if (isEditorExist(Object.class)) {
        throw new Error("unexpected editor is found");
    }
}
 
源代码24 项目: dragonwell8_jdk   文件: Test6397609.java
private static boolean isEditorExist(Class type) {
    for (int i = 0; i < 10; i++) {
        System.gc(); // clean all weak references
        if (null == PropertyEditorManager.findEditor(type)) {
            return false;
        }
    }
    return true;
}
 
源代码25 项目: ghidra   文件: EditorInitializer.java
@Override
public void run() {
	PropertyEditorManager.registerEditor(String.class, StringEditor.class);
	PropertyEditorManager.registerEditor(Color.class, ColorEditor.class);
	PropertyEditorManager.registerEditor(Font.class, FontPropertyEditor.class);
	PropertyEditorManager.registerEditor(Enum.class, EnumEditor.class);
	PropertyEditorManager.registerEditor(Boolean.class, BooleanEditor.class);
	PropertyEditorManager.registerEditor(Date.class, DateEditor.class);
	PropertyEditorManager.registerEditor(Integer.class, IntEditor.class);
	PropertyEditorManager.registerEditor(File.class, FileChooserEditor.class);
}
 
源代码26 项目: openjdk-8-source   文件: Test4968709.java
public static void main(String[] args) {
    String[] oldPath = PropertyEditorManager.getEditorSearchPath();
    String[] newPath = {"aaa.bbb", "aaa.ccc",};
    PropertyEditorManager.setEditorSearchPath(newPath);
    if (null != PropertyEditorManager.findEditor(Test4968709.class))
        throw new Error("found unexpected editor");

    PropertyEditorManager.setEditorSearchPath(oldPath);
    if (null == PropertyEditorManager.findEditor(Double.TYPE))
        throw new Error("expected editor is not found");
}
 
源代码27 项目: openjdk-8-source   文件: Test6397609.java
public static void main(String[] args) throws Exception {
    MemoryClassLoader loader = new MemoryClassLoader();
    PropertyEditorManager.registerEditor(
            Object.class,
            loader.compile("Editor",
                           "public class Editor extends java.beans.PropertyEditorSupport {}"));

    if (!isEditorExist(Object.class)) {
        throw new Error("the editor is lost");
    }
    loader = null; // clean the reference
    if (isEditorExist(Object.class)) {
        throw new Error("unexpected editor is found");
    }
}
 
源代码28 项目: jdk8u_jdk   文件: TestPropertyEditor.java
private static void test(Class<?> type, Class<? extends PropertyEditor> expected) {
    PropertyEditor actual = PropertyEditorManager.findEditor(type);
    if ((actual == null) && (expected != null)) {
        throw new Error("expected editor is not found");
    }
    if ((actual != null) && !actual.getClass().equals(expected)) {
        throw new Error("found unexpected editor");
    }
}
 
源代码29 项目: TencentKona-8   文件: TestPropertyEditor.java
private static void test(Class<?> type, Class<? extends PropertyEditor> expected) {
    PropertyEditor actual = PropertyEditorManager.findEditor(type);
    if ((actual == null) && (expected != null)) {
        throw new Error("expected editor is not found");
    }
    if ((actual != null) && !actual.getClass().equals(expected)) {
        throw new Error("found unexpected editor");
    }
}
 
源代码30 项目: TencentKona-8   文件: Test4968709.java
public static void main(String[] args) {
    String[] oldPath = PropertyEditorManager.getEditorSearchPath();
    String[] newPath = {"aaa.bbb", "aaa.ccc",};
    PropertyEditorManager.setEditorSearchPath(newPath);
    if (null != PropertyEditorManager.findEditor(Test4968709.class))
        throw new Error("found unexpected editor");

    PropertyEditorManager.setEditorSearchPath(oldPath);
    if (null == PropertyEditorManager.findEditor(Double.TYPE))
        throw new Error("expected editor is not found");
}
 
 类所在包
 同包方法