1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
28
29
30
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
42
43
44
45
46 public FrameContext(final @Nonnull ISkinConfig config, @Nonnull final String documentParent) {
47 super(config, ContextType.frame);
48 final String type = config.getPropertyValue(Toc.COMPONENT, String.class, "sidebar");
49
50 if ("top".equals(type) || "sidebar".equals(type)) {
51 toc = new TocSidebar(config);
52 } else {
53 toc = new Toc<Toc<?>>(config, "", "") {};
54 }
55
56 this.documentParent = requireNonNull(documentParent);
57
58 this.addChildren(this.toc);
59 }
60
61
62
63
64 public String getDocumentParent() {
65 return documentParent;
66 }
67
68
69
70
71 public String getSlugDocumentParent() {
72 return SkinConfigTool.slugFilename(documentParent);
73 }
74
75
76
77
78 public Toc<?> getToc() {
79 return toc;
80 }
81 }