1 5 package net.sf.panoptes.swing.propeditors; 6 7 import java.util.HashMap ; 8 9 import sun.beans.editors.StringEditor; 10 11 17 public class PropertyEditorRegistry { 18 19 20 private HashMap editors = new HashMap (); 21 private static PropertyEditorRegistry instance = null; 22 23 private PropertyEditorRegistry() { 24 } 25 26 private static PropertyEditorRegistry getInstance() { 27 if (instance == null) instance = new PropertyEditorRegistry(); 28 return instance; 29 } 30 31 public static void registerEditor(String className, Class clazz) { 32 getInstance().editors.put(className, clazz); 33 } 34 35 public static Class [] getEditor(String className) { 36 if (getInstance().editors.get(className) == null) return new Class [0]; 37 else return new Class [] { (Class ) getInstance().editors.get(className) }; 38 } 39 } 40 | Popular Tags |