1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package de.smartics.properties.admin.resources.representation.html;
17
18 import java.io.OutputStream;
19 import java.util.List;
20
21 import de.smartics.html5.jatl.HtmlResourceContext;
22 import de.smartics.properties.admin.domain.model.ApiServices;
23 import de.smartics.properties.admin.domain.model.ApiServices.ServiceDescriptor;
24 import de.smartics.properties.admin.resources.representation.html.share.AbstractHtmlRepresentationRenderer;
25 import de.smartics.properties.admin.resources.representation.share.BreadcrumbHelper;
26 import de.smartics.resteasy.hypermedia.renderer.LinkDescriptor;
27
28
29
30
31 public final class ApiServicesHtmlRepresentationRenderer extends
32 AbstractHtmlRepresentationRenderer<ApiServices>
33 {
34
35
36
37
38
39
40
41 private static final String TITLE = "Services";
42
43
44
45
46
47
48 private final ApiServices domainObject;
49
50
51
52
53
54
55
56
57
58
59
60
61 public ApiServicesHtmlRepresentationRenderer(
62 final HtmlResourceContext htmlContext, final ApiServices domainObject,
63 final OutputStream entityStream)
64 {
65 super(htmlContext, entityStream);
66 this.domainObject = domainObject;
67 }
68
69
70
71
72
73
74
75
76
77
78
79 @Override
80 protected void bodyContents()
81 {
82 renderPageTitle(">>>");
83 html.p().text("The following list shows services provided by the API.")
84 .end();
85
86 renderServices();
87 }
88
89 private void renderServices()
90 {
91 for (final ServiceDescriptor service : domainObject.getServices())
92 {
93 final LinkDescriptor link =
94 linkDescriptorFactory.createDescriptor(service, "getAsHtml");
95 html.dl();
96 html.dt().link(link).end();
97 html.dd().text(link.getHelp()).end();
98 html.end();
99 }
100 }
101
102 @Override
103 protected String getTitle()
104 {
105 return TITLE;
106 }
107
108 @Override
109 protected List<LinkDescriptor> breadcrumbLinks()
110 {
111 return BreadcrumbHelper.adjustSelf(breadcrumb.api());
112 }
113
114
115
116 }