View Javadoc

1   /*
2   Wotonomy: OpenStep design patterns for pure Java applications.
3   Copyright (C) 2000 Blacksmith, Inc.
4   
5   This library is free software; you can redistribute it and/or
6   modify it under the terms of the GNU Lesser General Public
7   License as published by the Free Software Foundation; either
8   version 2.1 of the License, or (at your option) any later version.
9   
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  Lesser General Public License for more details.
14  
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, see http://www.gnu.org
17  */
18  
19  package net.wotonomy.web;
20  
21  import java.io.Serializable;
22  
23  import net.wotonomy.foundation.NSDictionary;
24  
25  /***
26  * This class represents a static or dynamic portion of the 
27  * content returned to a request.  Each request walks a tree
28  * of WOElements to generate a response.
29  *
30  * @author michael@mpowers.net
31  * @author $Author: cgruber $
32  * @version $Revision: 905 $
33  */
34  public abstract class WOElement implements WOActionResults, Serializable
35  {
36  	NSDictionary associations;
37      
38  	/***
39  	* Default constructor.  Performs necessary initialization.
40  	*/
41  	public WOElement()
42  	{
43  	}
44  
45  	/***
46  	* This method is called to retrieve user-entered data from
47  	* the request.  WOElements should retrieve data from the 
48  	* request based on their elementID and set values in the 
49  	* context's current WOComponent, typically those values that
50  	* are associated with the element in the binding.  This 
51  	* implementation does nothing.
52  	*/
53      public void takeValuesFromRequest (WORequest aRequest, WOContext aContext)
54      {
55      	// does nothing
56      }
57  
58      /***
59      * This method is called on all objects and elements of the 
60      * application until a non-null value is returned.
61      * WOElements should first check to see if they are the
62      * target of an action by checking the WOContext's senderID
63      * to see if it matches this element's elementID.  
64      * If this element is the target, it should perform an 
65      * appropriate action on the context's current WOComponent,
66      * usually the action specified in the binding, and return
67      * the result of that action.  This implementation returns null.
68      */
69      public WOActionResults invokeAction (WORequest aRequest, WOContext aContext)
70      {
71      	return null;
72      }
73      
74      /***
75      * This method is called on all elements of the content tree
76      * to build a response to a user request.  The message should 
77      * be forwarded to any child elements so that the entire tree
78      * is traversed.  This implementation does nothing.
79      */
80      public void appendToResponse (WOResponse aResponse, WOContext aContext)
81      {
82      	// does nothing
83      }
84      
85      /***
86      * Package access only.  Called to initialize the component with 
87      * the proper context before the start of the request-response cycle.
88      * If the context has a current component, that component becomes
89      * this component's parent.
90      */
91      void ensureAwakeInContext (WOContext aContext)
92      {
93          // does nothing
94      }
95  
96      
97  }