01: /*
02: *
03: * JMoney - A Personal Finance Manager
04: * Copyright (c) 2004 Nigel Westbury <westbury@users.sourceforge.net>
05: *
06: *
07: * This program is free software; you can redistribute it and/or modify
08: * it under the terms of the GNU General Public License as published by
09: * the Free Software Foundation; either version 2 of the License, or
10: * (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with this program; if not, write to the Free Software
19: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20: *
21: */
22:
23: package net.sf.jmoney.model2;
24:
25: import net.sf.jmoney.JMoneyPlugin;
26: import net.sf.jmoney.fields.TextControlFactory;
27:
28: /**
29: * This class is a listener class to the net.sf.jmoney.fields
30: * extension point. It implements an extension.
31: * <P>
32: * This extension registers the Entry properties. By registering
33: * the properties, every one can know how to display, edit, and store
34: * the properties.
35: * <P>
36: * These properties are supported in the JMoney base code, so everyone
37: * including plug-ins will know about these properties. However, to
38: * follow the Eclipse paradigm (every one should be treated equal,
39: * including oneself), these are registered through the same extension
40: * point that plug-ins must also use to register their properties.
41: *
42: * @author Nigel Westbury
43: * @author Johann Gyger
44: */
45: public class CommodityInfo implements IPropertySetInfo {
46:
47: private static ExtendablePropertySet<Commodity> propertySet = PropertySet
48: .addBaseAbstractPropertySet(Commodity.class,
49: "Base Commodity (includes currencies)");
50:
51: private static ScalarPropertyAccessor<String> nameAccessor = null;
52:
53: public PropertySet registerProperties() {
54: IPropertyControlFactory<String> textControlFactory = new TextControlFactory();
55:
56: nameAccessor = propertySet.addProperty("name", JMoneyPlugin
57: .getResourceString("Commodity.name"), String.class, 3,
58: 20, textControlFactory, null);
59:
60: return propertySet;
61: }
62:
63: /**
64: * @return
65: */
66: public static ExtendablePropertySet<Commodity> getPropertySet() {
67: return propertySet;
68: }
69:
70: /**
71: * @return
72: */
73: public static ScalarPropertyAccessor<String> getNameAccessor() {
74: return nameAccessor;
75: }
76: }
|