1. Project Clover database mar. janv. 20 2026 12:32:22 CET
  2. Package org.devacfr.maven.skins.reflow.context

File FrameContext.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart8.png
45% of files have more coverage

Code metrics

2
10
4
1
81
31
6
0,6
2,5
4
1,5

Classes

Class Line # Actions
FrameContext 32 10 0% 6 4
0.7575%
 

Contributing tests

This file is covered by 1 test. .

Source view

1    /*
2    * Copyright 2012-2025 Christophe Friederich
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10    * Unless required by applicable law or agreed to in writing, software
11    * distributed under the License is distributed on an "AS IS" BASIS,
12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    * See the License for the specific language governing permissions and
14    * limitations under the License.
15    */
16    package org.devacfr.maven.skins.reflow.context;
17   
18    import static java.util.Objects.requireNonNull;
19   
20    import javax.annotation.Nonnull;
21    import org.devacfr.maven.skins.reflow.ISkinConfig;
22    import org.devacfr.maven.skins.reflow.SkinConfigTool;
23    import org.devacfr.maven.skins.reflow.model.Toc;
24    import org.devacfr.maven.skins.reflow.model.TocSidebar;
25   
26    /**
27    * The context associate to page of frame page.
28    *
29    * @author Christophe Friederich
30    * @since 2.0
31    */
 
32    public class FrameContext extends Context<FrameContext> {
33   
34    /** */
35    private final String documentParent;
36   
37    /** */
38    private final Toc<?> toc;
39   
40    /**
41    * @param config
42    * a config (can not be {@code null}).
43    * @param documentParent
44    * name of parent.
45    */
 
46  1 toggle public FrameContext(final @Nonnull ISkinConfig config, @Nonnull final String documentParent) {
47  1 super(config, ContextType.frame);
48  1 final String type = config.getPropertyValue(Toc.COMPONENT, String.class, "sidebar");
49    // enforce sidebar
50  1 if ("top".equals(type) || "sidebar".equals(type)) {
51  1 toc = new TocSidebar(config);
52    } else {
53  0 toc = new Toc<Toc<?>>(config, "", "") {};
54    }
55   
56  1 this.documentParent = requireNonNull(documentParent);
57   
58  1 this.addChildren(this.toc);
59    }
60   
61    /**
62    * @return Returns a {@link String} representing the name of parent page.
63    */
 
64  1 toggle public String getDocumentParent() {
65  1 return documentParent;
66    }
67   
68    /**
69    * @return Returns a {@link String} representing the slugged name(pageId) of parent page.
70    */
 
71  0 toggle public String getSlugDocumentParent() {
72  0 return SkinConfigTool.slugFilename(documentParent);
73    }
74   
75    /**
76    * @return returns the {@link Toc}.
77    */
 
78  2 toggle public Toc<?> getToc() {
79  2 return toc;
80    }
81    }