Package: GalleryAdapterSupport
GalleryAdapterSupport
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
getExtraViewProperties(Id) |
|
|
|
|
|
||||||||||||||||||||
getInlinedScript() |
|
|
|
|
|
||||||||||||||||||||
loadTemplate(Key, String) |
|
|
|
|
|
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.gallery.spi;
27:
28: import javax.annotation.Nonnull;
29: import it.tidalwave.util.Id;
30: import it.tidalwave.util.Key;
31: import it.tidalwave.northernwind.core.model.ModelFactory;
32: import it.tidalwave.northernwind.core.model.ResourcePath;
33: import it.tidalwave.northernwind.core.model.ResourceProperties;
34: import it.tidalwave.northernwind.core.model.SiteNode;
35: import it.tidalwave.northernwind.core.model.Template;
36: import it.tidalwave.northernwind.frontend.ui.component.gallery.GalleryView;
37: import lombok.RequiredArgsConstructor;
38:
39: /***************************************************************************************************************************************************************
40: *
41: * @author Fabrizio Giudici
42: *
43: **************************************************************************************************************************************************************/
44: @RequiredArgsConstructor
45: public abstract class GalleryAdapterSupport implements GalleryAdapter
46: {
47: @Nonnull
48: protected final SiteNode siteNode;
49:
50: @Nonnull
51: protected final GalleryView view;
52:
53: @Nonnull
54: protected final ModelFactory modelFactory;
55:
56: /***********************************************************************************************************************************************************
57: * {@inheritDoc}
58: **********************************************************************************************************************************************************/
59: @Override @Nonnull
60: public ResourceProperties getExtraViewProperties (@Nonnull final Id viewId)
61: {
62: return modelFactory.createProperties().withId(viewId).build();
63: }
64:
65: /***********************************************************************************************************************************************************
66: * {@inheritDoc}
67: **********************************************************************************************************************************************************/
68: @Override @Nonnull
69: public String getInlinedScript()
70: {
71: return "";
72: }
73:
74: /***********************************************************************************************************************************************************
75: * {@inheritDoc}
76: **********************************************************************************************************************************************************/
77: @Nonnull
78: protected final Template loadTemplate (@Nonnull final Key<? extends ResourcePath> templateName,
79: @Nonnull final String fallbackTemplate)
80: {
81: final var viewProperties = siteNode.getPropertyGroup(view.getId());
82: return siteNode.getSite().getTemplate(getClass(), viewProperties.getProperty(templateName), fallbackTemplate);
83: }
84: }