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

File BsComponent.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart9.png
22% of files have more coverage

Code metrics

6
14
6
1
98
41
9
0,64
2,33
6
1,5

Classes

Class Line # Actions
BsComponent 29 14 0% 9 4
0.8461538684,6%
 

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 com.google.common.base.Strings;
19    import javax.annotation.Nonnull;
20    import javax.annotation.Nullable;
21    import org.devacfr.maven.skins.reflow.ISkinConfig;
22   
23    /**
24    * Describe a Bootstrap component.
25    *
26    * @author devacfr
27    * @since 2.0
28    */
 
29    public abstract class BsComponent extends Component {
30   
31    /** */
32    private final String component;
33   
34    /** */
35    private String theme = "light";
36   
37    /** */
38    private String background = "light";
39   
40    /**
41    * Default constructor.
42    *
43    * @param config
44    * a config (can not be {@code null}).
45    * @param component
46    * the bootstrap component name.
47    */
 
48  114 toggle public BsComponent(@Nonnull final ISkinConfig config, final String component) {
49  114 super(config);
50  114 this.component = component;
51    }
52   
 
53  8 toggle @Override
54    @Nonnull
55    public String getCssClass() {
56  8 String css = "";
57  8 if (!Strings.isNullOrEmpty(getTheme())) {
58  8 css += component + "-" + getTheme() + " ";
59    }
60  8 if (!Strings.isNullOrEmpty(getBackground())) {
61  8 css += "bg-" + getBackground() + " ";
62    }
63  8 if (!Strings.isNullOrEmpty(super.getCssClass())) {
64  0 css += super.getCssClass();
65    }
66  8 return css.trim();
67    }
68   
69    /**
70    * @return Returns a {@link String} representing the bootstrap theme to apply.
71    */
 
72  16 toggle public String getTheme() {
73  16 return theme;
74    }
75   
76    /**
77    * @param theme
78    * a bootstrap theme to use.
79    */
 
80  87 toggle protected void setTheme(@Nullable final String theme) {
81  87 this.theme = theme;
82    }
83   
84    /**
85    * @return Returns a {@link String} representing the bootstrap background color to apply.
86    */
 
87  16 toggle public String getBackground() {
88  16 return background;
89    }
90   
91    /**
92    * @param background
93    * a bootstrap background colour to use.
94    */
 
95  87 toggle protected void setBackground(@Nullable final String background) {
96  87 this.background = background;
97    }
98    }