1 package net.sf.tacos.components.scriptaculous;
2
3 import java.util.HashMap;
4 import java.util.List;
5 import java.util.Map;
6
7 import org.apache.tapestry.AbstractComponent;
8 import org.apache.tapestry.IMarkupWriter;
9 import org.apache.tapestry.IRequestCycle;
10 import org.apache.tapestry.IScript;
11 import org.apache.tapestry.TapestryUtils;
12 import org.apache.tapestry.json.JSONObject;
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 public abstract class Draggable extends AbstractComponent {
28
29
30
31
32 protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) {
33 renderBody(writer, cycle);
34
35 JSONObject json = new JSONObject();
36 json.put("revert", new Boolean(isRevert()));
37 json.put("ghosting", new Boolean(isGhosting()));
38
39 Map parms = new HashMap();
40 parms.put("props", json.toString());
41 parms.put("draggables", getDraggables());
42
43 getScript().execute(this, cycle, TapestryUtils.getPageRenderSupport(cycle, this), parms);
44 }
45
46
47
48
49 public abstract List getDraggables();
50
51
52
53
54
55 public abstract boolean isGhosting();
56
57
58
59
60 public abstract boolean isRevert();
61
62
63 public abstract IScript getScript();
64 }