jtulach@0: /* jtulach@0: * Sun Public License Notice jtulach@0: * jtulach@0: * The contents of this file are subject to the Sun Public License jtulach@0: * Version 1.0 (the "License"). You may not use this file except in jtulach@0: * compliance with the License. A copy of the License is available at jtulach@0: * http://www.sun.com/ jtulach@0: * jtulach@0: * The Original Code is NetBeans. The Initial Developer of the Original jtulach@36: * Code is Jaroslav Tulach. Portions Copyright 2007 Jaroslav Tulach. jtulach@36: * All Rights Reserved. jtulach@0: */ jtulach@0: jtulach@0: package implpkg; jtulach@0: jtulach@0: import apipkg.Item; jtulach@0: import javax.swing.event.ChangeListener; jtulach@0: jtulach@0: /** jtulach@0: * jtulach@0: * @author Jaroslav Tulach jtulach@0: */ jtulach@3: // BEGIN: design.less.friend.Accessor jtulach@0: public abstract class Accessor { jtulach@128: private static volatile Accessor DEFAULT; jtulach@128: public static Accessor getDefault() { jtulach@128: Accessor a = DEFAULT; jtulach@128: if (a != null) { jtulach@128: return a; jtulach@128: } jtulach@128: jtulach@0: try { jtulach@132: Class.forName( jtulach@132: Item.class.getName(), true, Item.class.getClassLoader() jtulach@132: ); jtulach@0: } catch (Exception ex) { jtulach@0: ex.printStackTrace(); jtulach@0: } jtulach@128: jtulach@128: return DEFAULT; jtulach@128: } jtulach@128: jtulach@128: public static void setDefault(Accessor accessor) { jtulach@128: if (DEFAULT != null) { jtulach@128: throw new IllegalStateException(); jtulach@128: } jtulach@128: DEFAULT = accessor; jtulach@0: } jtulach@0: jtulach@0: public Accessor() { jtulach@0: } jtulach@0: jtulach@0: protected abstract Item newItem(); jtulach@0: protected abstract void addChangeListener(Item item, ChangeListener l); jtulach@0: } jtulach@3: // END: design.less.friend.Accessor