Skip to content

Package: HtmlTemplateSitemapView

HtmlTemplateSitemapView

nameinstructionbranchcomplexitylinemethod
HtmlTemplateSitemapView(Id, Site)
M: 0 C: 32
100%
M: 2 C: 2
50%
M: 2 C: 1
33%
M: 0 C: 3
100%
M: 0 C: 1
100%
render(Optional, Template.Aggregates)
M: 0 C: 22
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
static {...}
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /*
2: * *************************************************************************************************************************************************************
3: *
4: * NorthernWind - lightweight CMS
5: * http://tidalwave.it/projects/northernwind
6: *
7: * Copyright (C) 2011 - 2025 Tidalwave s.a.s. (http://tidalwave.it)
8: *
9: * *************************************************************************************************************************************************************
10: *
11: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
12: * You may obtain a copy of the License at
13: *
14: * http://www.apache.org/licenses/LICENSE-2.0
15: *
16: * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
17: * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
18: *
19: * *************************************************************************************************************************************************************
20: *
21: * git clone https://bitbucket.org/tidalwave/northernwind-src
22: * git clone https://github.com/tidalwave-it/northernwind-src
23: *
24: * *************************************************************************************************************************************************************
25: */
26: package it.tidalwave.northernwind.frontend.ui.component.sitemap.htmltemplate;
27:
28: import javax.annotation.Nonnull;
29: import java.util.Optional;
30: import it.tidalwave.util.Id;
31: import it.tidalwave.northernwind.core.model.ResourcePath;
32: import it.tidalwave.northernwind.core.model.Site;
33: import it.tidalwave.northernwind.core.model.Template.Aggregates;
34: import it.tidalwave.northernwind.frontend.ui.annotation.ViewMetadata;
35: import it.tidalwave.northernwind.frontend.ui.component.htmltemplate.HtmlHolder;
36: import it.tidalwave.northernwind.frontend.ui.component.htmlfragment.htmltemplate.HtmlTemplateHtmlFragmentView;
37: import it.tidalwave.northernwind.frontend.ui.component.sitemap.SitemapView;
38:
39: /***************************************************************************************************************************************************************
40: *
41: * <p>An implementation of {@link SitemapView} based on HTML templates.</p>
42: *
43: * @author Fabrizio Giudici
44: *
45: **************************************************************************************************************************************************************/
46: @ViewMetadata(typeUri="http://northernwind.tidalwave.it/component/Sitemap/#v1.0",
47: controlledBy=HtmlTemplateSitemapViewController.class)
48: public class HtmlTemplateSitemapView extends HtmlTemplateHtmlFragmentView implements SitemapView
49: {
50: @Nonnull
51: private final Site site;
52:
53: /***********************************************************************************************************************************************************
54: * Creates an instance with the given id.
55: *
56: * @param id the id of this view
57: * @param site the site
58: **********************************************************************************************************************************************************/
59: public HtmlTemplateSitemapView (@Nonnull final Id id, @Nonnull final Site site)
60: {
61: super(id);
62: this.site= site;
63:• }
64:
65: /***********************************************************************************************************************************************************
66: * Renders the sitemap contents. See {@link HtmlTemplateSitemapViewController} for more information.
67: *
68: * @see HtmlTemplateSitemapViewController
69: * @param templatePath the path of an optional template for the rendering
70: * @param entries the entries to render
71: **********************************************************************************************************************************************************/
72: public void render (@Nonnull final Optional<ResourcePath> templatePath, @Nonnull final Aggregates entries)
73: {
74: final var template = site.getTemplate(getClass(), templatePath, "Sitemap.st");
75: addComponent(new HtmlHolder(template.render(entries)));
76: }
77: }