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

File Footer.java

 

Coverage histogram

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

Code metrics

8
28
4
2
121
60
10
0,36
7
2
2,5

Classes

Class Line # Actions
34 24 0% 8 9
0.735294173,5%
Footer.Column 97 4 0% 2 2
0.666666766,7%
 

Contributing tests

This file is covered by 22 tests. .

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.model;
17   
18    import static java.util.Objects.requireNonNull;
19   
20    import com.google.common.base.Strings;
21    import com.google.common.collect.Lists;
22    import java.util.List;
23    import javax.annotation.Nonnull;
24    import org.apache.maven.doxia.site.SiteModel;
25    import org.codehaus.plexus.util.xml.Xpp3Dom;
26    import org.devacfr.maven.skins.reflow.ISkinConfig;
27   
28    /**
29    * Represents the footer component.
30    *
31    * @author devacfr
32    * @since 2.0
33    */
 
34    public class Footer extends BsComponent {
35   
36    /** */
37    private static final String COMPONENT = "footer";
38   
39    /** */
40    private final List<Column> columns = Lists.newArrayList();
41   
42    /**
43    * Default constructor.
44    *
45    * @param config
46    * a config (can not be {@code null}).
47    */
 
48  30 toggle public Footer(@Nonnull final ISkinConfig config) {
49  30 super(config, COMPONENT);
50  30 requireNonNull(config);
51  30 final SiteModel model = requireNonNull(config.getSiteModel());
52  30 this.setTheme(config.getAttributeValue(COMPONENT, "theme", String.class, "light"));
53  30 this.setBackground(config.getAttributeValue(COMPONENT, "background", String.class, "light"));
54  30 this.setCssClass(config.getAttributeValue(COMPONENT, "cssClass", String.class, null));
55   
56  30 final Xpp3Dom bottomNav = config.get("bottomNav");
57   
58  30 if (model.getBody() != null && model.getBody().getMenus() != null) {
59  11 final List<org.apache.maven.doxia.site.Menu> menus = model.getBody().getMenus();
60  11 if (bottomNav != null && bottomNav.getChildren().length > 0) {
61    // foreach columns
62  11 for (final Xpp3Dom col : bottomNav.getChildren()) {
63  33 final String regex = col.getValue();
64  33 if (Strings.isNullOrEmpty(regex)) {
65  0 continue;
66    }
67  33 final List<Menu> amenus = Lists.newArrayList();
68  33 for (final org.apache.maven.doxia.site.Menu menu : menus) {
69    // add in column, if matches with regex
70  165 if (Menu.matches(regex, menu)) {
71  55 amenus.add(new Menu(config, menu));
72    }
73    }
74  33 this.columns.add(new Column(config, amenus));
75    }
76    } else {
77  0 final List<Menu> amenus = Lists.newArrayList();
78  0 for (final org.apache.maven.doxia.site.Menu menu : menus) {
79  0 amenus.add(new Menu(config, menu));
80    }
81  0 this.columns.add(new Column(config, amenus));
82    }
83    }
84    }
85   
86    /**
87    * @return Returns a list of {@link Column}.
88    */
 
89  0 toggle public List<Column> getColumns() {
90  0 return columns;
91    }
92   
93    /**
94    * @author Christophe Friederich
95    * @since 2.0
96    */
 
97    public static class Column {
98   
99    /** */
100    private final List<Menu> menus;
101   
102    /**
103    * @param config
104    * a config (can not be {@code null}).
105    * @param menus
106    * list of menu.
107    */
 
108  33 toggle public Column(@Nonnull final ISkinConfig config, @Nonnull final List<Menu> menus) {
109  33 requireNonNull(config);
110  33 requireNonNull(menus);
111  33 this.menus = menus;
112    }
113   
114    /**
115    * @return Returns a list of {@link Menu}.
116    */
 
117  0 toggle public List<Menu> getMenus() {
118  0 return menus;
119    }
120    }
121    }