📄 propertyeditormanager.java
字号:
/* * Java core library component. * * Copyright (c) 1997, 1998 * Transvirtual Technologies, Inc. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file. */package java.beans;import java.util.Hashtable;public class PropertyEditorManager { private static String[] editorpath = { "kaffe.beans.editors" }; private static Hashtable assoc = new Hashtable(); public static void registerEditor(Class targetType, Class editorClass) { if (editorClass == null) { assoc.remove(targetType); } else { assoc.put(targetType, editorClass); } } public static PropertyEditor findEditor(Class targetType) { PropertyEditor editor = (PropertyEditor)assoc.get(targetType); if (editor == null) { editor = loadPropertyEditor(targetType); } return (editor); } public static String[] getEditorSearchPath() { return (editorpath); } public static void setEditorSearchPath(String path[]) { editorpath = path; } private static PropertyEditor loadPropertyEditor(Class editorClass) { String editorname = editorClass.getName(); // First try to load editor from package. PropertyEditor editor = loadNamedPropertyEditor( editorClass.getClassLoader(), editorname + "Editor"); if (editor != null) { return (editor); } // Extract the name without package information. // We make allowances for both '.' and '/' seperators. int pos = editorname.lastIndexOf('.'); int spos = editorname.lastIndexOf('/'); if (spos > pos) { pos = spos; } editorname = editorname.substring(pos+1); // Next try the search paths for (int i = 0; i < editorpath.length; i++) { editor = loadNamedPropertyEditor(editorClass.getClassLoader(), editorpath[i] + "." + editorname + "Editor"); if (editor != null) { return (editor); } } return (null); } private static PropertyEditor loadNamedPropertyEditor(ClassLoader loader, String cl) { try { return (PropertyEditor)Class.forName(cl, true, loader).newInstance(); } catch (ClassNotFoundException _) { } catch (ClassCastException _) { } catch (IllegalAccessException _) { } catch (InstantiationException _) { } return (null); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -