1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.devacfr.maven.skins.reflow.context;
20
21 import javax.annotation.Nonnull;
22
23 import org.devacfr.maven.skins.reflow.ISkinConfig;
24 import org.devacfr.maven.skins.reflow.SkinConfigTool;
25 import org.devacfr.maven.skins.reflow.model.Toc;
26 import org.devacfr.maven.skins.reflow.model.TocSidebar;
27
28 import static java.util.Objects.requireNonNull;
29
30
31
32
33
34
35
36 public class FrameContext extends Context<FrameContext> {
37
38
39 private final String documentParent;
40
41
42 private final Toc<?> toc;
43
44
45
46
47
48
49
50 public FrameContext(final @Nonnull ISkinConfig config, @Nonnull final String documentParent) {
51 super(config, ContextType.frame);
52 final String type = config.getPropertyValue(Toc.COMPONENT, String.class, "sidebar");
53
54 if ("top".equals(type) || "sidebar".equals(type)) {
55 toc = new TocSidebar(config);
56 } else {
57 toc = new Toc<Toc<?>>("", "") {};
58 }
59
60 this.documentParent = requireNonNull(documentParent);
61
62 this.addChildren(this.toc);
63 }
64
65
66
67
68 public String getDocumentParent() {
69 return documentParent;
70 }
71
72
73
74
75 public String getSlugDocumentParent() {
76 return SkinConfigTool.slugFilename(documentParent);
77 }
78
79
80
81
82 public Toc<?> getToc() {
83 return toc;
84 }
85 }