1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package com.nordija.tapestry.bayeux.downloads;
17
18 import org.apache.tapestry.IMarkupWriter;
19 import org.apache.tapestry.IRequestCycle;
20 import org.apache.tapestry.engine.IEngineService;
21 import org.apache.tapestry.engine.ILink;
22 import org.apache.tapestry.link.AbstractLinkComponent;
23
24
25
26
27
28
29
30
31
32
33
34
35
36 public abstract class DownloadLink extends AbstractLinkComponent {
37
38 public abstract String getDownloadResourceId();
39
40 public abstract String getDownloadResourceSourceExtentionName();
41
42 public abstract boolean isStateful();
43
44 public abstract IEngineService getDownloadService();
45
46 protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) {
47 if (cycle.isRewinding()) {
48 return;
49 }
50
51 ILink link = getDownloadService().getLink(isStateful(), new Object[]{getDownloadResourceId(), getDownloadResourceSourceExtentionName()});
52
53 if (!isDisabled()) {
54 writer.begin("a");
55 writer.attribute("href", link.getURL());
56 renderInformalParameters(writer, cycle);
57 }
58 renderBody(writer, cycle);
59 if (!isDisabled()) {
60 writer.end();
61 }
62 }
63
64 }