View Javadoc
1   package siouxsie.mvc.impl;
2   
3   
4   import siouxsie.mvc.IScreenHandler;
5   
6   import com.opensymphony.xwork2.ActionInvocation;
7   import com.opensymphony.xwork2.Result;
8   import com.opensymphony.xwork2.inject.Inject;
9   
10  /**
11   * The XW {@link Result} which delegates
12   * the {@link IScreen} installation
13   * in injected {@link IScreenHandler}.
14   * @author Arnaud Cogoluegnes
15   * @version $Id$
16   * @todo should make a screen result interface?
17   */
18  public class ScreenResult implements Result {
19  	
20  	/**
21  	 * 
22  	 */
23  	private static final long serialVersionUID = 2122700362002463237L;
24  
25  	/**
26  	 * The screen handler.
27  	 * Injected by XW container.
28  	 */
29  	@Inject
30  	private IScreenHandler screenHandler;
31  	
32  	/**
33  	 * The default parameter (the screen class usually).
34  	 * Allows the <result ...>something</result> syntax. 
35  	 */
36      public static final String DEFAULT_PARAM = "location";
37  	
38      /**
39       * The screen location (screen class).
40       */
41  	private String location;
42  	
43  
44  	public String getLocation() {
45  		return location;
46  	}
47  
48  	public void setLocation(String location) {
49  		this.location = location;
50  	}
51  
52  	/*
53  	 * (non-Javadoc)
54  	 * @see com.opensymphony.xwork2.Result#execute(com.opensymphony.xwork2.ActionInvocation)
55  	 */
56  	public void execute(ActionInvocation invocation) throws Exception {
57  	
58  		screenHandler.displayScreen(
59  				invocation				
60  		);		
61  
62  	}
63  
64  	public void setScreenHandler(IScreenHandler screenHandler) {
65  		this.screenHandler = screenHandler;
66  	}
67  	
68  	
69  
70  }