當前位置: 首頁>>代碼示例>>Java>>正文


Java PropertyEditorManager.setEditorSearchPath方法代碼示例

本文整理匯總了Java中java.beans.PropertyEditorManager.setEditorSearchPath方法的典型用法代碼示例。如果您正苦於以下問題:Java PropertyEditorManager.setEditorSearchPath方法的具體用法?Java PropertyEditorManager.setEditorSearchPath怎麽用?Java PropertyEditorManager.setEditorSearchPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.beans.PropertyEditorManager的用法示例。


在下文中一共展示了PropertyEditorManager.setEditorSearchPath方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: test

import java.beans.PropertyEditorManager; //導入方法依賴的package包/類
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);
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:11,代碼來源:Test4080522.java

示例2: testFindEditorAccordingPath_1

import java.beans.PropertyEditorManager; //導入方法依賴的package包/類
public void testFindEditorAccordingPath_1() throws Exception {
    // Regression Harmony-1205
    String newPath[] = new String[origPath.length + 1];
    newPath[0] = "org.apache.harmony.beans.tests.support";
    for (int i = 0; i < origPath.length; i++) {
        newPath[i + 1] = origPath[i];
    }

    PropertyEditorManager.setEditorSearchPath(newPath);

    PropertyEditor editor = PropertyEditorManager.findEditor(Class
            .forName("java.lang.String"));

    assertEquals(org.apache.harmony.beans.tests.support.StringEditor.class,
            editor.getClass());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:17,代碼來源:PropertyEditorManagerRegressionTest.java

示例3: testFindEditorAccordingPath_2

import java.beans.PropertyEditorManager; //導入方法依賴的package包/類
public void testFindEditorAccordingPath_2() throws Exception {
    // Regression Harmony-1205
    String newPath[] = new String[origPath.length + 1];
    newPath[origPath.length] = "org.apache.harmony.beans.tests.support";
    for (int i = 0; i < origPath.length; i++) {
        newPath[i] = origPath[i];
    }

    PropertyEditorManager.setEditorSearchPath(newPath);

    PropertyEditor editor = PropertyEditorManager.findEditor(Class
            .forName("java.lang.String"));

    assertEquals(org.apache.harmony.beans.editors.StringEditor.class,
            editor.getClass());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:17,代碼來源:PropertyEditorManagerRegressionTest.java

示例4: installCorePropertyEditors

import java.beans.PropertyEditorManager; //導入方法依賴的package包/類
protected static final void installCorePropertyEditors() {
    String[] syspesp = PropertyEditorManager.getEditorSearchPath();
    String[] nbpesp = new String[] {
        "org.netbeans.beaninfo.editors", // NOI18N
        "org.openide.explorer.propertysheet.editors", // NOI18N
    };
    String[] allpesp = new String[syspesp.length + nbpesp.length];
    System.arraycopy(nbpesp, 0, allpesp, 0, nbpesp.length);
    System.arraycopy(syspesp, 0, allpesp, nbpesp.length, syspesp.length);
    PropertyEditorManager.setEditorSearchPath(allpesp);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:ExtTestCase.java

示例5: main

import java.beans.PropertyEditorManager; //導入方法依賴的package包/類
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");
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:12,代碼來源:Test4968709.java

示例6: testGetEditorSearchPath

import java.beans.PropertyEditorManager; //導入方法依賴的package包/類
public void testGetEditorSearchPath() {
    String[] original = PropertyEditorManager.getEditorSearchPath();

    String[] path = new String[] { "java.beans",
            "org.apache.harmony.beans.tests.java.beans.editor", "", };
    PropertyEditorManager.setEditorSearchPath(path);
    String[] newPath = PropertyEditorManager.getEditorSearchPath();

    assertTrue(Arrays.equals(path, newPath));

    PropertyEditorManager.setEditorSearchPath(original);
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:13,代碼來源:PropertyEditorManagerTest.java

示例7: testSetEditorSearchPath_nullpath

import java.beans.PropertyEditorManager; //導入方法依賴的package包/類
public void testSetEditorSearchPath_nullpath() {
    String[] original = PropertyEditorManager.getEditorSearchPath();
    PropertyEditorManager.setEditorSearchPath(new String[] { null });
    assertEquals(1, PropertyEditorManager.getEditorSearchPath().length);
    assertNull(PropertyEditorManager.getEditorSearchPath()[0]);
    assertNull(PropertyEditorManager.findEditor(PropertyEditorManagerTest.class));
    PropertyEditorManager.setEditorSearchPath(original);
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:9,代碼來源:PropertyEditorManagerTest.java

示例8: testFindEditorByDefaultLocation

import java.beans.PropertyEditorManager; //導入方法依賴的package包/類
/**
 * The test checks the method findEditor() for editors on search path
 */
public void testFindEditorByDefaultLocation() {
    PropertyEditorManager
            .setEditorSearchPath(new String[] { "org.apache.harmony.beans.tests.java.beans.editors" });
    PropertyEditor pe = PropertyEditorManager
            .findEditor(AnotherSampleProperty.class);

    assertNotNull("No property editor found", pe);
    assertTrue(pe instanceof AnotherSamplePropertyEditor);
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:13,代碼來源:PropertyEditorManagerTest.java

示例9: testGetSetEditorPath

import java.beans.PropertyEditorManager; //導入方法依賴的package包/類
public void testGetSetEditorPath() throws Exception{
  String[] s = new String[]{"path1", "path2"};
  PropertyEditorManager.setEditorSearchPath(s);
  s[1] = "path3";
  String[] s2 = PropertyEditorManager.getEditorSearchPath();
  assertFalse(s==s2);
  assertEquals("path1", s2[0]);
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:9,代碼來源:PropertyEditorManagerTest.java

示例10: testFindEditorAccordingPath_3

import java.beans.PropertyEditorManager; //導入方法依賴的package包/類
public void testFindEditorAccordingPath_3() throws Exception {
    // Regression Harmony-5477
    class TestClassLoader extends ClassLoader {
        protected Class<?> findClass(String name) throws ClassNotFoundException {
            if (!MOCK_TEST_CLASS_EDITOR.equals(name)) {
                throw new ClassNotFoundException(name);
            }

            try {
                byte[] buf = new byte[1024];
                InputStream in = getResourceAsStream(MOCK_TEST_CLASS_EDITOR_FILE);
                int sz = 0;
                int read;

                while ((read = in.read(buf, sz, buf.length - sz)) >= 0) {
                    sz += read;
                }
                return defineClass(MOCK_TEST_CLASS_EDITOR, buf, 0, sz);
            } catch (IOException e) {
                throw (ClassNotFoundException) new ClassNotFoundException(
                        e.getMessage()).initCause(e);
            }
        }
    }
    PropertyEditorManager.setEditorSearchPath(new String[] { "testPackage" });
    ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();

    try {
        Thread.currentThread().setContextClassLoader(new TestClassLoader());
        PropertyEditor editor = PropertyEditorManager.findEditor(TestClass.class);
        assertEquals(MOCK_TEST_CLASS_EDITOR, editor.getClass().getName());
    } finally {
        Thread.currentThread().setContextClassLoader(oldLoader);
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:36,代碼來源:PropertyEditorManagerRegressionTest.java

示例11: testStringEditor

import java.beans.PropertyEditorManager; //導入方法依賴的package包/類
public void testStringEditor() throws Exception {
    // Regression Harmony-1199
    PropertyEditorManager.setEditorSearchPath(origPath);
    PropertyEditor editor = PropertyEditorManager.findEditor(Class
            .forName("java.lang.String"));
    String text = "A sample string";

    editor.setAsText(text);
    assertEquals(text, editor.getAsText());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:11,代碼來源:PropertyEditorManagerRegressionTest.java

示例12: registerPropertyEditors

import java.beans.PropertyEditorManager; //導入方法依賴的package包/類
public static synchronized void registerPropertyEditors() {
    
    if (clsReg == null) {
        clsReg = new AbstractRegistrator(PEClassRegistration.class) {

            @Override
            void register() {
                ClassLoader clsLoader = findClsLoader();
                for (Iterator it = lookupResult.allInstances().iterator(); it.hasNext();) {
                    PEClassRegistration clsReg = (PEClassRegistration) it.next();
                    for (String type : clsReg.targetTypes) {
                        try {
                            Class<?> cls = getClassFromCanonicalName(type);
                            Class<?> editorCls = Class.forName(clsReg.editorClass, true, clsLoader);
                            PropertyEditorManager.registerEditor(cls, editorCls);
                        } catch (ClassNotFoundException ex) {
                            Exceptions.printStackTrace(ex);
                        }
                    }
                }
            }

            @Override
            void init() {
            }
        };
    } else {
        clsReg.register();
    }
    
    if (pkgReg == null) {
        pkgReg = new AbstractRegistrator(PEPackageRegistration.class) {

            @Override
            void register() {
                Set<String> newPath = new LinkedHashSet<String> ();
                for (Iterator it = lookupResult.allInstances().iterator(); it.hasNext();) {
                    PEPackageRegistration pkgReg = (PEPackageRegistration) it.next();
                    newPath.add(pkgReg.pkg);
                }
                newPath.addAll(originalPath);
                PropertyEditorManager.setEditorSearchPath(newPath.toArray(new String[newPath.size()]));
            }

            @Override
            void init() {
                if (originalPath == null) {
                    originalPath = Arrays.asList(PropertyEditorManager.getEditorSearchPath());
                }
            }
        };
    } else {
        pkgReg.register();
    }
    
    if (beanInfoReg == null) {
        beanInfoReg = new AbstractRegistrator(BeanInfoRegistration.class) {

            @Override
            void register() {
                Set<String> newPath = new LinkedHashSet<String> ();
                for (Iterator it = lookupResult.allInstances().iterator(); it.hasNext();) {
                    BeanInfoRegistration biReg = (BeanInfoRegistration) it.next();
                    newPath.add(biReg.searchPath);
                }
                newPath.addAll(originalBeanInfoSearchPath);
                Introspector.setBeanInfoSearchPath(newPath.toArray(new String[newPath.size()]));
            }

            @Override
            void init() {
                if (originalBeanInfoSearchPath == null) {
                originalBeanInfoSearchPath = Arrays.asList(Introspector.getBeanInfoSearchPath());
                }
            }
        };
    } else {
        beanInfoReg.register();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:81,代碼來源:NodesRegistrationSupport.java

示例13: run

import java.beans.PropertyEditorManager; //導入方法依賴的package包/類
public void run() {
    PropertyEditorManager.registerEditor(ThirdBean.class, ThirdBeanEditor.class);

    test(FirstBean.class, FirstBeanEditor.class);
    test(SecondBean.class, null);
    test(ThirdBean.class, ThirdBeanEditor.class);
    // test editors for default primitive types
    test(Byte.TYPE, ByteEditor.class);
    test(Short.TYPE, ShortEditor.class);
    test(Integer.TYPE, IntegerEditor.class);
    test(Long.TYPE, LongEditor.class);
    test(Boolean.TYPE, BooleanEditor.class);
    test(Float.TYPE, FloatEditor.class);
    test(Double.TYPE, DoubleEditor.class);
    // test editors for default object types
    test(Byte.class, ByteEditor.class);
    test(Short.class, ShortEditor.class);
    test(Integer.class, IntegerEditor.class);
    test(Long.class, LongEditor.class);
    test(Boolean.class, BooleanEditor.class);
    test(Float.class, FloatEditor.class);
    test(Double.class, DoubleEditor.class);
    test(String.class, StringEditor.class);
    test(Color.class, ColorEditor.class);
    test(Font.class, FontEditor.class);
    test(Enumeration.class, EnumEditor.class);

    PropertyEditorManager.registerEditor(ThirdBean.class, null);
    PropertyEditorManager.setEditorSearchPath(SEARCH_PATH);

    test(FirstBean.class, FirstBeanEditor.class);
    test(SecondBean.class, SecondBeanEditor.class);
    test(ThirdBean.class, ThirdBeanEditor.class);
    // test editors for default primitive types
    test(Byte.TYPE, ByteEditor.class);
    test(Short.TYPE, ShortEditor.class);
    test(Integer.TYPE, IntegerEditor.class);
    test(Long.TYPE, LongEditor.class);
    test(Boolean.TYPE, BooleanEditor.class);
    test(Float.TYPE, FloatEditor.class);
    test(Double.TYPE, DoubleEditor.class);
    // test editors for default object types
    test(Byte.class, null);
    test(Short.class, null);
    test(Integer.class, null);
    test(Long.class, null);
    test(Boolean.class, null);
    test(Float.class, null);
    test(Double.class, null);
    test(String.class, null);
    test(Color.class, null);
    test(Font.class, null);
    test(Enumeration.class, EnumEditor.class);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:55,代碼來源:TestPropertyEditor.java

示例14: run

import java.beans.PropertyEditorManager; //導入方法依賴的package包/類
public void run() {
    if (this.passed) {
        SunToolkit.createNewAppContext();
    }
    PropertyEditorManager.registerEditor(ThirdBean.class, ThirdBeanEditor.class);

    test(FirstBean.class, FirstBeanEditor.class);
    test(SecondBean.class, null);
    test(ThirdBean.class, ThirdBeanEditor.class);
    // test editors for default primitive types
    test(Byte.TYPE, ByteEditor.class);
    test(Short.TYPE, ShortEditor.class);
    test(Integer.TYPE, IntegerEditor.class);
    test(Long.TYPE, LongEditor.class);
    test(Boolean.TYPE, BooleanEditor.class);
    test(Float.TYPE, FloatEditor.class);
    test(Double.TYPE, DoubleEditor.class);
    // test editors for default object types
    test(Byte.class, ByteEditor.class);
    test(Short.class, ShortEditor.class);
    test(Integer.class, IntegerEditor.class);
    test(Long.class, LongEditor.class);
    test(Boolean.class, BooleanEditor.class);
    test(Float.class, FloatEditor.class);
    test(Double.class, DoubleEditor.class);
    test(String.class, StringEditor.class);
    test(Color.class, ColorEditor.class);
    test(Font.class, FontEditor.class);
    test(Enumeration.class, EnumEditor.class);

    PropertyEditorManager.registerEditor(ThirdBean.class, null);
    PropertyEditorManager.setEditorSearchPath(SEARCH_PATH);

    test(FirstBean.class, FirstBeanEditor.class);
    test(SecondBean.class, SecondBeanEditor.class);
    test(ThirdBean.class, ThirdBeanEditor.class);
    // test editors for default primitive types
    test(Byte.TYPE, ByteEditor.class);
    test(Short.TYPE, ShortEditor.class);
    test(Integer.TYPE, IntegerEditor.class);
    test(Long.TYPE, LongEditor.class);
    test(Boolean.TYPE, BooleanEditor.class);
    test(Float.TYPE, FloatEditor.class);
    test(Double.TYPE, DoubleEditor.class);
    // test editors for default object types
    test(Byte.class, null);
    test(Short.class, null);
    test(Integer.class, null);
    test(Long.class, null);
    test(Boolean.class, null);
    test(Float.class, null);
    test(Double.class, null);
    test(String.class, null);
    test(Color.class, null);
    test(Font.class, null);
    test(Enumeration.class, EnumEditor.class);

    this.passed = true;
}
 
開發者ID:openjdk,項目名稱:jdk7-jdk,代碼行數:60,代碼來源:TestPropertyEditor.java

示例15: tearDown

import java.beans.PropertyEditorManager; //導入方法依賴的package包/類
public void tearDown(){
    PropertyEditorManager.setEditorSearchPath(defaultSearchPath);
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:4,代碼來源:PropertyEditorManagerRegressionTest.java


注:本文中的java.beans.PropertyEditorManager.setEditorSearchPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。