View Javadoc
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 org.devacfr.maven.skins.reflow.model.Toc.createToc;
19  
20  import javax.annotation.Nonnull;
21  import org.devacfr.maven.skins.reflow.ISkinConfig;
22  import org.devacfr.maven.skins.reflow.model.Header;
23  import org.devacfr.maven.skins.reflow.model.Toc;
24  
25  /**
26   * @author Christophe Friederich
27   * @since 2.0
28   */
29  public class PageContext extends Context<PageContext> {
30  
31    /** */
32    private final Toc<?> toc;
33  
34    /** */
35    private final Header header;
36  
37    /**
38     * Default constructor.
39     *
40     * @param config
41     *          a config (can not be {@code null}).
42     */
43    public PageContext(final @Nonnull ISkinConfig config) {
44      super(config, ContextType.page);
45      this.toc = createToc(config, null);
46      this.header = new Header(config);
47      this.addChildren(this.header, this.toc);
48    }
49  
50    /**
51     * Gets the header of page.
52     *
53     * @return Returns a {@code Header} representing the configuration of header.
54     */
55    public Header getHeader() {
56      return header;
57    }
58  
59    /**
60     * @return Returns the {@link Toc}.
61     */
62    public Toc<?> getToc() {
63      return toc;
64    }
65  }