summaryrefslogtreecommitdiff
path: root/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOElement.java
blob: 11944d3708cbc736fcc00cb60e4ad391dd706e4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
Wotonomy: OpenStep design patterns for pure Java applications.
Copyright (C) 2000 Blacksmith, Inc.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see http://www.gnu.org
*/

package net.wotonomy.web;

import java.io.Serializable;

import net.wotonomy.foundation.NSDictionary;

/**
* This class represents a static or dynamic portion of the 
* content returned to a request.  Each request walks a tree
* of WOElements to generate a response.
*
* @author michael@mpowers.net
* @author $Author: cgruber $
* @version $Revision: 905 $
*/
public abstract class WOElement implements WOActionResults, Serializable
{
	NSDictionary associations;
    
	/**
	* Default constructor.  Performs necessary initialization.
	*/
	public WOElement()
	{
	}

	/**
	* This method is called to retrieve user-entered data from
	* the request.  WOElements should retrieve data from the 
	* request based on their elementID and set values in the 
	* context's current WOComponent, typically those values that
	* are associated with the element in the binding.  This 
	* implementation does nothing.
	*/
    public void takeValuesFromRequest (WORequest aRequest, WOContext aContext)
    {
    	// does nothing
    }

    /**
    * This method is called on all objects and elements of the 
    * application until a non-null value is returned.
    * WOElements should first check to see if they are the
    * target of an action by checking the WOContext's senderID
    * to see if it matches this element's elementID.  
    * If this element is the target, it should perform an 
    * appropriate action on the context's current WOComponent,
    * usually the action specified in the binding, and return
    * the result of that action.  This implementation returns null.
    */
    public WOActionResults invokeAction (WORequest aRequest, WOContext aContext)
    {
    	return null;
    }
    
    /**
    * This method is called on all elements of the content tree
    * to build a response to a user request.  The message should 
    * be forwarded to any child elements so that the entire tree
    * is traversed.  This implementation does nothing.
    */
    public void appendToResponse (WOResponse aResponse, WOContext aContext)
    {
    	// does nothing
    }
    
    /**
    * Package access only.  Called to initialize the component with 
    * the proper context before the start of the request-response cycle.
    * If the context has a current component, that component becomes
    * this component's parent.
    */
    void ensureAwakeInContext (WOContext aContext)
    {
        // does nothing
    }

    
}