1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.myfaces.component.html.ext;
20
21 import javax.faces.context.FacesContext;
22
23 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
24 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
25 import org.apache.myfaces.component.AltProperty;
26 import org.apache.myfaces.component.DataProperties;
27 import org.apache.myfaces.component.DisplayValueOnlyAware;
28 import org.apache.myfaces.component.EscapeAware;
29 import org.apache.myfaces.component.ForceIdAware;
30 import org.apache.myfaces.component.UserRoleAware;
31 import org.apache.myfaces.component.UserRoleUtils;
32 import org.apache.myfaces.component.html.util.HtmlComponentUtils;
33 import org.apache.myfaces.custom.ExtendedComponentBase;
34 import org.apache.myfaces.shared_tomahawk.component.DisplayValueOnlyCapable;
35 import org.apache.myfaces.shared_tomahawk.component.EscapeCapable;
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50 @JSFComponent(
51 name = "t:selectManyCheckbox",
52 clazz = "org.apache.myfaces.component.html.ext.HtmlSelectManyCheckbox",
53 tagClass = "org.apache.myfaces.generated.taglib.html.ext.HtmlSelectManyCheckboxTag")
54 public abstract class AbstractHtmlSelectManyCheckbox
55 extends javax.faces.component.html.HtmlSelectManyCheckbox
56 implements UserRoleAware, DisplayValueOnlyCapable,
57 EscapeCapable, DisplayValueOnlyAware, EscapeAware,
58 ForceIdAware, DataProperties, AltProperty,
59 ExtendedComponentBase
60 {
61 public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlSelectManyCheckbox";
62 public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Checkbox";
63
64 public String getClientId(FacesContext context)
65 {
66 String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
67 if (clientId == null)
68 {
69 clientId = super.getClientId(context);
70 }
71
72 return clientId;
73 }
74
75 public boolean isRendered()
76 {
77 if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
78 return super.isRendered();
79 }
80
81 public boolean isSetDisplayValueOnly(){
82 return getDisplayValueOnly() != null ? true : false;
83 }
84
85 public boolean isDisplayValueOnly(){
86 return getDisplayValueOnly() != null ? getDisplayValueOnly().booleanValue() : false;
87 }
88
89 public void setDisplayValueOnly(boolean displayValueOnly){
90 this.setDisplayValueOnly((Boolean) Boolean.valueOf(displayValueOnly));
91 }
92
93
94
95
96
97
98 @JSFProperty
99 public abstract String getLayoutWidth();
100
101
102
103
104
105
106
107
108
109
110
111 @JSFProperty
112 public abstract String getValueType();
113
114 private static boolean booleanFromObject(Object obj, boolean defaultValue)
115 {
116 if(obj instanceof Boolean)
117 {
118 return ((Boolean) obj).booleanValue();
119 }
120 else if(obj instanceof String)
121 {
122 return Boolean.valueOf(((String) obj)).booleanValue();
123 }
124
125 return defaultValue;
126 }
127 }