View Javadoc
1   /*
2    * Copyright (c) 2011-2024 PrimeFaces Extensions
3    *
4    *  Permission is hereby granted, free of charge, to any person obtaining a copy
5    *  of this software and associated documentation files (the "Software"), to deal
6    *  in the Software without restriction, including without limitation the rights
7    *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    *  copies of the Software, and to permit persons to whom the Software is
9    *  furnished to do so, subject to the following conditions:
10   *
11   *  The above copyright notice and this permission notice shall be included in
12   *  all copies or substantial portions of the Software.
13   *
14   *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20   *  THE SOFTWARE.
21   */
22  package org.primefaces.extensions.component.keynote;
23  
24  import javax.faces.component.UIComponentBase;
25  
26  import org.primefaces.extensions.model.keynote.KeynoteItem;
27  
28  public class UIKeynoteItem extends UIComponentBase {
29  
30      public static final String COMPONENT_TYPE = "org.primefaces.extensions.component.UIKeynoteItem";
31      public static final String COMPONENT_FAMILY = "org.primefaces.extensions.component";
32  
33      // @formatter:off
34      @SuppressWarnings("java:S115")
35      protected enum PropertyKeys {
36          backgroundColor,
37          backgroundImage,
38          backgroundSize,
39          backgroundPosition,
40          backgroundRepeat,
41          backgroundOpacity,
42          backgroundVideo,
43          backgroundVideoLoop,
44          backgroundVideoMuted,
45          markdown,
46          note,
47          separator,
48          separatorVertical,
49          styleClass,
50          type,
51          visibility,
52      }
53      // @formatter:on
54  
55      public UIKeynoteItem() {
56          setRendererType(null);
57      }
58  
59      @Override
60      public String getFamily() {
61          return COMPONENT_FAMILY;
62      }
63  
64      public String getBackgroundColor() {
65          return (String) getStateHelper().eval(PropertyKeys.backgroundColor, null);
66      }
67  
68      public void setBackgroundColor(final String backgroundColor) {
69          getStateHelper().put(PropertyKeys.backgroundColor, backgroundColor);
70      }
71  
72      public String getBackgroundImage() {
73          return (String) getStateHelper().eval(PropertyKeys.backgroundImage, null);
74      }
75  
76      public void setBackgroundImage(final String backgroundImage) {
77          getStateHelper().put(PropertyKeys.backgroundImage, backgroundImage);
78      }
79  
80      public String getBackgroundSize() {
81          return (String) getStateHelper().eval(PropertyKeys.backgroundSize, "cover");
82      }
83  
84      public void setBackgroundSize(final String backgroundSize) {
85          getStateHelper().put(PropertyKeys.backgroundSize, backgroundSize);
86      }
87  
88      public String getBackgroundPosition() {
89          return (String) getStateHelper().eval(PropertyKeys.backgroundPosition, "center");
90      }
91  
92      public void setBackgroundPosition(final String backgroundPosition) {
93          getStateHelper().put(PropertyKeys.backgroundPosition, backgroundPosition);
94      }
95  
96      public String getBackgroundRepeat() {
97          return (String) getStateHelper().eval(PropertyKeys.backgroundRepeat, "no-repeat");
98      }
99  
100     public void setBackgroundRepeat(final String backgroundRepeat) {
101         getStateHelper().put(PropertyKeys.backgroundRepeat, backgroundRepeat);
102     }
103 
104     public Double getBackgroundOpacity() {
105         return (Double) getStateHelper().eval(PropertyKeys.backgroundOpacity, 1.0);
106     }
107 
108     public void setBackgroundOpacity(final Double backgroundOpacity) {
109         getStateHelper().put(PropertyKeys.backgroundOpacity, backgroundOpacity);
110     }
111 
112     public String getBackgroundVideo() {
113         return (String) getStateHelper().eval(PropertyKeys.backgroundVideo, null);
114     }
115 
116     public void setBackgroundVideo(final String backgroundVideo) {
117         getStateHelper().put(PropertyKeys.backgroundVideo, backgroundVideo);
118     }
119 
120     public Boolean isBackgroundVideoLoop() {
121         return (Boolean) getStateHelper().eval(PropertyKeys.backgroundVideoLoop, false);
122     }
123 
124     public void setBackgroundVideoLoop(final Boolean backgroundVideoLoop) {
125         getStateHelper().put(PropertyKeys.backgroundVideoLoop, backgroundVideoLoop);
126     }
127 
128     public Boolean isBackgroundVideoMuted() {
129         return (Boolean) getStateHelper().eval(PropertyKeys.backgroundVideoMuted, false);
130     }
131 
132     public void setBackgroundVideoMuted(final Boolean backgroundVideoMuted) {
133         getStateHelper().put(PropertyKeys.backgroundVideoMuted, backgroundVideoMuted);
134     }
135 
136     public Boolean isMarkdown() {
137         return (Boolean) getStateHelper().eval(PropertyKeys.markdown, false);
138     }
139 
140     public void setMarkdown(final Boolean markdown) {
141         getStateHelper().put(PropertyKeys.markdown, markdown);
142     }
143 
144     public String getNote() {
145         return (String) getStateHelper().eval(PropertyKeys.note, null);
146     }
147 
148     public void setNote(final String note) {
149         getStateHelper().put(PropertyKeys.note, note);
150     }
151 
152     public String getSeparator() {
153         return (String) getStateHelper().eval(PropertyKeys.separator, "^---$");
154     }
155 
156     public void setSeparator(final String separator) {
157         getStateHelper().put(PropertyKeys.separator, separator);
158     }
159 
160     public String getSeparatorVertical() {
161         return (String) getStateHelper().eval(PropertyKeys.separatorVertical, null);
162     }
163 
164     public void setSeparatorVertical(final String separatorVertical) {
165         getStateHelper().put(PropertyKeys.separatorVertical, separatorVertical);
166     }
167 
168     public String getStyleClass() {
169         return (String) getStateHelper().eval(PropertyKeys.styleClass, null);
170     }
171 
172     public void setStyleClass(final String styleClass) {
173         getStateHelper().put(PropertyKeys.styleClass, styleClass);
174     }
175 
176     public String getType() {
177         return (String) getStateHelper().eval(PropertyKeys.type, KeynoteItem.DEFAULT_TYPE);
178     }
179 
180     public void setType(final String type) {
181         getStateHelper().put(PropertyKeys.type, type);
182     }
183 
184     public String getVisibility() {
185         return (String) getStateHelper().eval(PropertyKeys.visibility, null);
186     }
187 
188     public void setVisibility(final String visibility) {
189         getStateHelper().put(PropertyKeys.visibility, visibility);
190     }
191 }