1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| package org.apache.tapestry.contrib.ajax; |
16 |
| |
17 |
| import java.util.HashMap; |
18 |
| import java.util.Map; |
19 |
| |
20 |
| import org.apache.tapestry.BaseComponent; |
21 |
| import org.apache.tapestry.IActionListener; |
22 |
| import org.apache.tapestry.IRequestCycle; |
23 |
| import org.apache.tapestry.Tapestry; |
24 |
| import org.apache.tapestry.engine.ILink; |
25 |
| import org.apache.tapestry.services.LinkFactory; |
26 |
| import org.apache.tapestry.services.ServiceConstants; |
27 |
| |
28 |
| |
29 |
| |
30 |
| |
31 |
| |
32 |
| |
33 |
| public abstract class XTile extends BaseComponent implements IXTile |
34 |
| { |
35 |
| public abstract LinkFactory getLinkFactory(); |
36 |
| |
37 |
| public abstract IActionListener getListener(); |
38 |
| public abstract String getSendName(); |
39 |
| public abstract String getReceiveName(); |
40 |
| public abstract String getErrorName(); |
41 |
| public abstract boolean getDisableCaching(); |
42 |
| |
43 |
0
| public void trigger(IRequestCycle cycle) {
|
44 |
0
| IActionListener listener = getListener();
|
45 |
| |
46 |
0
| if (listener == null)
|
47 |
0
| throw Tapestry.createRequiredParameterException(this, "listener");
|
48 |
| |
49 |
0
| listener.actionTriggered(this, cycle);
|
50 |
| } |
51 |
| |
52 |
0
| public Map getScriptSymbols()
|
53 |
| { |
54 |
0
| Map ret = new HashMap();
|
55 |
0
| ret.put("sendFunctionName", getSendName());
|
56 |
0
| ret.put("receiveFunctionName", getReceiveName());
|
57 |
0
| ret.put("errorFunctionName", getErrorName());
|
58 |
0
| ret.put("disableCaching", getDisableCaching() ? "true" : null);
|
59 |
| |
60 |
0
| Map parameters = new HashMap();
|
61 |
0
| parameters.put(ServiceConstants.SERVICE, XTileService.SERVICE_NAME);
|
62 |
0
| parameters.put(ServiceConstants.PAGE, getPage().getPageName());
|
63 |
0
| parameters.put(ServiceConstants.COMPONENT, getIdPath());
|
64 |
| |
65 |
0
| ILink link = getLinkFactory().constructLink(getPage().getRequestCycle(),
|
66 |
| false, parameters, false); |
67 |
| |
68 |
0
| ret.put("url", link.getURL());
|
69 |
| |
70 |
0
| return ret;
|
71 |
| } |
72 |
| |
73 |
| } |