package sale; import java.io.*; /** * Helper class that creates the contents of a {@link FormSheet}. * * <p>A FormSheetContentsCreator is used by FormSheets to create their contents, i.e. to set their component * and the buttons in the FormSheet's button bar. Objectifying this process is needed to make FormSheets * persistent as the Swing components' serializability is not reliable. Therefore, whenever you create a * serializable FormSheet, use FormSheetContentsCreators.</p> * * @see FormSheet#addContentCreator * * @author Steffen Zschaler * @version 2.0 17/08/1999 * @since v2.0 */ public abstract class FormSheetContentCreator extends Object implements Serializable { /** * The parent of this FormSheetContentCreator. The parent of a FormSheetContentCreator is the * FormSheetContentCreator that was added to the FormSheet immediately before this FormSheetContentCreator. * * @serial */ private FormSheetContentCreator m_fsccParent; /** * Create the FormSheet's contents. * * <p>This method is called in the following circumstances:</p> * * <ol> * <li>On creation of the FormSheet object.</li> * <li>Whenever the FormSheet gets deserialized from a stream.</li> * </ol> * * <p>Although the FormSheet whose contents is to be set is passed as a parameter, a new instance of the * FormSheetContentCreator is needed with every new instance of the FormSheet!</p> * * @override Always * * @param fs the FormSheet whose contents is to be created. */ protected abstract void createFormSheetContent (FormSheet fs); /** * Internal communication method called by FormSheet. * * @override Never * * @param fs the FormSheet that needs to be set up. * @param fCallParent if true, the entire chain of FormSheetContentCreators will be called. */ void createFormSheetContent (FormSheet fs, boolean fCallParent) { if ((fCallParent) && (m_fsccParent != null)){ m_fsccParent.createFormSheetContent (fs, true); } createFormSheetContent (fs); } /** * Internal communication method called by FormSheet. * * @override Never * * @param fsccParent the new parent of this FormSheetContentCreator */ void setParent (FormSheetContentCreator fsccParent) { m_fsccParent = fsccParent; } }