java.beans.PropertyEditorManager Java Examples
The following examples show how to use
java.beans.PropertyEditorManager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Test6963811.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
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(); } }
Example #2
Source File: Test6963811.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
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(); } }
Example #3
Source File: JspRuntimeLibrary.java From Tomcat8-Source-Read with MIT License | 6 votes |
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())); } }
Example #4
Source File: JspRuntimeLibrary.java From tomcatsrc with Apache License 2.0 | 6 votes |
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())); } }
Example #5
Source File: Test6963811.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
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(); } }
Example #6
Source File: ValuePropertyEditor.java From netbeans with Apache License 2.0 | 6 votes |
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; }
Example #7
Source File: PELookupTest.java From netbeans with Apache License 2.0 | 6 votes |
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); }
Example #8
Source File: OutputSettingsPanel.java From netbeans with Apache License 2.0 | 6 votes |
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(); } }
Example #9
Source File: TermOptionsPanel.java From netbeans with Apache License 2.0 | 6 votes |
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 } } }
Example #10
Source File: PropertyEditorRegistry.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * @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; }
Example #11
Source File: JspRuntimeLibrary.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
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())); } }
Example #12
Source File: Test6963811.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
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(); } }
Example #13
Source File: Test6963811.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
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(); } }
Example #14
Source File: JspRuntimeLibrary.java From packagedrone with Eclipse Public License 1.0 | 6 votes |
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())); } }
Example #15
Source File: Test6963811.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
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(); } }
Example #16
Source File: Test4968709.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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"); }
Example #17
Source File: TestPropertyEditor.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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"); } }
Example #18
Source File: TestEditor.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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); }
Example #19
Source File: Test4080522.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
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); } }
Example #20
Source File: Test4080522.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
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); } }
Example #21
Source File: TestEditor.java From hottub with GNU General Public License v2.0 | 5 votes |
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); }
Example #22
Source File: TestELSupport.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
@Test public void testCoerceToType14() { PropertyEditorManager.registerEditor(TesterType.class, TesterTypeEditorNoError.class); Object result = ELSupport.coerceToType("Foo", TesterType.class); Assert.assertTrue(result instanceof TesterType); Assert.assertEquals("Foo", ((TesterType) result).getValue()); }
Example #23
Source File: Test6397609.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
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"); } }
Example #24
Source File: Test4080522.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
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); } }
Example #25
Source File: PropertyEditorTest.java From type-parser with MIT License | 5 votes |
@Test public void canUsePropertyEditor() throws Exception { //given PropertyEditorManager.registerEditor(TypeToUseWithPropertyEditor.class, MyPropertyEditor.class); //when parser = builder.enablePropertyEditor().build(); Object o = parser.parse("alex", TypeToUseWithPropertyEditor.class); //then assertThat(o).isInstanceOf(TypeToUseWithPropertyEditor.class); }
Example #26
Source File: TestPropertyEditor.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
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"); } }
Example #27
Source File: EditorInitializer.java From ghidra with Apache License 2.0 | 5 votes |
@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); }
Example #28
Source File: PEAnnotationProcessorTest.java From netbeans with Apache License 2.0 | 5 votes |
public void testDuplicateRegistration() { NodeOp.registerPropertyEditors(); NodeOp.registerPropertyEditors(); int count = 0; String[] editorSearchPath = PropertyEditorManager.getEditorSearchPath(); for (int i = 0; i < editorSearchPath.length; i++) { if ("org.netbeans.modules.openide.nodes".equals(editorSearchPath[i])) { count++; } } assertFalse("Package path is registered multiple times", count > 1); assertFalse("Package path is not registered", count == 0); }
Example #29
Source File: TestPropertyEditor.java From hottub with GNU General Public License v2.0 | 5 votes |
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"); } }
Example #30
Source File: TestEditor.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
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); }