1. Project Clover database mar. avr. 16 2024 08:19:06 CEST
  2. Package org.devacfr.maven.skins.reflow.model

File BsComponent.java

 

Coverage histogram

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

Code metrics

6
13
6
1
98
39
9
0,69
2,17
6
1,5

Classes

Class Line # Actions
BsComponent 32 13 0% 9 4
0.8484%
 

Contributing tests

This file is covered by 11 tests. .

Source view

1    /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements. See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership. The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License. You may obtain a copy of the License at
9    *
10    * http://www.apache.org/licenses/LICENSE-2.0
11    *
12    * Unless required by applicable law or agreed to in writing,
13    * software distributed under the License is distributed on an
14    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15    * KIND, either express or implied. See the License for the
16    * specific language governing permissions and limitations
17    * under the License.
18    */
19    package org.devacfr.maven.skins.reflow.model;
20   
21    import javax.annotation.Nonnull;
22    import javax.annotation.Nullable;
23   
24    import com.google.common.base.Strings;
25   
26    /**
27    * Describe a Bootstrap component.
28    *
29    * @author devacfr
30    * @since 2.0
31    */
 
32    public abstract class BsComponent extends Component {
33   
34    /** */
35    private final String component;
36   
37    /** */
38    private String theme = "light";
39   
40    /** */
41    private String background = "light";
42   
43    /**
44    * Default constructor.
45    *
46    * @param component
47    * the bootstrap component name.
48    */
 
49  62 toggle public BsComponent(final String component) {
50  62 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  48 toggle protected void setTheme(@Nullable final String theme) {
81  48 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  48 toggle protected void setBackground(@Nullable final String background) {
96  48 this.background = background;
97    }
98    }