001: /*
002: *
003: * JMoney - A Personal Finance Manager
004: * Copyright (c) 2004 Nigel Westbury <westbury@users.sourceforge.net>
005: *
006: *
007: * This program is free software; you can redistribute it and/or modify
008: * it under the terms of the GNU General Public License as published by
009: * the Free Software Foundation; either version 2 of the License, or
010: * (at your option) any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
015: * GNU General Public License for more details.
016: *
017: * You should have received a copy of the GNU General Public License
018: * along with this program; if not, write to the Free Software
019: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
020: *
021: */
022: package net.sf.jmoney.model2;
023:
024: /**
025: * This interface must be implemented by all classes that implement
026: * an extension to the net.sf.jmoney.fields extension point.
027: * (All classes referenced by the info-class attribute in the
028: * extensions must implement this interface).
029: * <P>
030: * Implementations of this interface provide detailed information
031: * about the properties in the property set.
032: *
033: * @author Nigel Westbury
034: */
035: public interface IPropertySetInfo {
036:
037: // TODO: This comment is WAY out of date (written in early prototyping days) and needs updating....
038: /**
039: * This method is the first method called by the framework.
040: * This method registers all the extension properties by calling
041: * into the supplied IPropertyRegistrar interface.
042: * <P>
043: * The framework calls this method to get information on extension
044: * properties.
045: * Properties may be applicable only in certain conditions.
046: * For example, the properties that relate to a stock account
047: * such as the commission rates should not be shown unless
048: * the account type has been set to 'stock'.
049: * Only two forms are condition are supported:
050: * - a boolean property is set to true
051: * - an enumerated property is set to a particular value
052: * <P>
053: * The applicability of a property in one bookkeeping object class may
054: * depend on the value of a property in a different bookkeeping
055: * object class. For example, the applicability of the indicator
056: * in an entry as to
057: * whether an entry has been reconciled may depend on whether
058: * the check box in the account properties has been set to allow
059: * reconciliation. The table is as follows:
060: * - entry can depend on entry, transaction, commodity or account.
061: * - transaction can depend on transaction only.
062: * - account can depend on account only.
063: * - commodity can depend on commodity only.
064: * <P>
065: * We also support custom dependencies. The EnumerationAccessor
066: * class and the PropertyAccessor_Boolean class implement the
067: * IPropertyDependency interface which contains the isSelected
068: * method. A property is set to be conditional by passing an
069: * IPropertyDependency interface. The property
070: * is applicable if the isSelected method returns true.
071: * <P>
072: * When a property is registered, a PropertyAccessor object is
073: * returned. The PropertyAccessor object must be used later on if
074: * there are other properties that depend on this property.
075: * <P>
076: * Properties may depend on properties defined in other plug-ins.
077: * In that
078: * case a PropertyAccessor object can be obtained by giving the fully
079: * qualified name of the property. The framework will be sure to first
080: * call the registerProperties method for any plug-ins on which
081: * this plug-in depends.
082: * <P>
083: * Properties may depend on properties defined elsewhere in this
084: * same plug-in. For example, an entry property may depend on
085: * a property of the account in which the entry occurs.
086: * The framework will always call registerProperties for
087: * classes in the order:
088: * <UL>
089: * <LI>Commodity</LI>
090: * <LI>CapitalAccount</LI>
091: * <LI>Transaction</LI>
092: * <LI>Entry</LI>
093: * </UL>
094: * <P>
095: * The dependencies can only occur in this order, so we are safe.
096: *
097: * @param propertySet the property set object being initialized by this call.
098: * The property set object is not in an initialized state when it is
099: * passed to this method so this method must not call any methods on
100: * the property set object. However, implementations of this method
101: * are encouraged to save the reference in a static member in order to
102: * provide quick reference to the PropertySet object.
103: */
104: PropertySet registerProperties();
105: }
|