| 1 33 34 package com.icesoft.faces.component.outputconnectionstatus; 35 36 import com.icesoft.faces.component.CSS_DEFAULT; 37 import com.icesoft.faces.component.ext.taglib.Util; 38 39 import javax.faces.component.html.HtmlPanelGroup; 40 import javax.faces.context.FacesContext; 41 import javax.faces.el.ValueBinding; 42 43 52 53 public class OutputConnectionStatus extends HtmlPanelGroup { 54 public static final String COMPONENT_TYPE = 55 "com.icesoft.faces.OutputConnectionStatus"; 56 public static final String RENDERER_TYPE = 57 "com.icesoft.faces.OutputConnectionStatusRenderer"; 58 public static final String COMPONENT_FAMILY = "javax.faces.Panel"; 59 private static final String DEFAULT_LABEL = ""; 60 private java.lang.String style; 61 private java.lang.String styleClass; 62 private java.lang.String inactiveLabel; 63 private java.lang.String activeLabel; 64 private java.lang.String cautionLabel; 65 private java.lang.String disconnectedLabel; 66 private java.lang.String renderedOnUserRole; 67 68 72 public String getFamily() { 73 return COMPONENT_FAMILY; 74 } 75 76 80 public String getRendererType() { 81 return RENDERER_TYPE; 82 } 83 84 88 public String getComponentType() { 89 return COMPONENT_TYPE; 90 } 91 92 95 public String getActiveClass() { 96 return Util.getQualifiedStyleClass(this, 97 CSS_DEFAULT.OUTPUT_CONNECTION_STATUS_DEFAULT_ACTIVE_CLASS); 98 } 99 100 103 public void setActiveLabel(java.lang.String activeLabel) { 104 this.activeLabel = activeLabel; 105 } 106 107 110 public String getActiveLabel() { 111 if (activeLabel != null) { 112 return activeLabel; 113 } 114 ValueBinding vb = getValueBinding("activeLabel"); 115 return vb != null ? (String ) vb.getValue(getFacesContext()) : 116 DEFAULT_LABEL; 117 } 118 119 122 public String getCautionClass() { 123 return Util.getQualifiedStyleClass(this, 124 CSS_DEFAULT.OUTPUT_CONNECTION_STATUS_DEFAULT_CAUTION_CLASS); 125 } 126 127 130 public void setCautionLabel(java.lang.String cautionLabel) { 131 this.cautionLabel = cautionLabel; 132 } 133 134 137 public String getCautionLabel() { 138 if (cautionLabel != null) { 139 return cautionLabel; 140 } 141 ValueBinding vb = getValueBinding("cautionLabel"); 142 return vb != null ? (String ) vb.getValue(getFacesContext()) : 143 DEFAULT_LABEL; 144 } 145 146 149 public String getDisconnectedClass() { 150 return Util.getQualifiedStyleClass(this, 151 CSS_DEFAULT.OUTPUT_CONNECTION_STATUS_DEFAULT_DISCONNECT_CLASS); 152 } 153 154 157 public void setDisconnectedLabel(java.lang.String disconnectedLabel) { 158 this.disconnectedLabel = disconnectedLabel; 159 } 160 161 164 public String getDisconnectedLabel() { 165 if (disconnectedLabel != null) { 166 return disconnectedLabel; 167 } 168 ValueBinding vb = getValueBinding("disconnectedLabel"); 169 return vb != null ? (String ) vb.getValue(getFacesContext()) : 170 DEFAULT_LABEL; 171 } 172 173 176 public String getInactiveClass() { 177 return Util.getQualifiedStyleClass(this, 178 CSS_DEFAULT.OUTPUT_CONNECTION_STATUS_DEFAULT_INACTIVE_CLASS); 179 } 180 181 184 public void setInactiveLabel(java.lang.String inactiveLabel) { 185 this.inactiveLabel = inactiveLabel; 186 } 187 188 191 public String getInactiveLabel() { 192 if (inactiveLabel != null) { 193 return inactiveLabel; 194 } 195 ValueBinding vb = getValueBinding("inactiveLabel"); 196 return vb != null ? (String ) vb.getValue(getFacesContext()) : 197 DEFAULT_LABEL; 198 } 199 200 203 public void setStyle(java.lang.String style) { 204 this.style = style; 205 } 206 207 210 public String getStyle() { 211 if (style != null) { 212 return style; 213 } 214 ValueBinding vb = getValueBinding("style"); 215 return vb != null ? (String ) vb.getValue(getFacesContext()) : null; 216 } 217 218 221 public void setStyleClass(java.lang.String styleClass) { 222 this.styleClass = styleClass; 223 } 224 225 228 public String getStyleClass() { 229 return Util.getQualifiedStyleClass(this, 230 styleClass, 231 CSS_DEFAULT.OUTPUT_CONNECTION_STATUS_DEFAULT_STYLE_CLASS, 232 "styleClass"); 233 } 234 235 236 239 public void setRenderedOnUserRole(String renderedOnUserRole) { 240 this.renderedOnUserRole = renderedOnUserRole; 241 } 242 243 246 public String getRenderedOnUserRole() { 247 if (renderedOnUserRole != null) { 248 return renderedOnUserRole; 249 } 250 ValueBinding vb = getValueBinding("renderedOnUserRole"); 251 return vb != null ? (String ) vb.getValue(getFacesContext()) : null; 252 } 253 254 257 public boolean isRendered() { 258 if (!Util.isRenderedOnUserRole(this)) { 259 return false; 260 } 261 return super.isRendered(); 262 } 263 264 268 public Object saveState(FacesContext context) { 269 Object values[] = new Object [11]; 270 values[0] = super.saveState(context); 271 values[1] = style; 272 values[2] = styleClass; 273 values[3] = inactiveLabel; 274 values[4] = activeLabel; 275 values[5] = cautionLabel; 276 values[6] = disconnectedLabel; 277 values[7] = renderedOnUserRole; 278 return ((Object ) (values)); 279 } 280 281 285 public void restoreState(FacesContext context, Object state) { 286 Object values[] = (Object []) state; 287 super.restoreState(context, values[0]); 288 style = (String ) values[1]; 289 styleClass = (String ) values[2]; 290 inactiveLabel = (String ) values[3]; 291 activeLabel = (String ) values[4]; 292 cautionLabel = (String ) values[5]; 293 disconnectedLabel = (String ) values[6]; 294 renderedOnUserRole = (String ) values[7]; 295 } 296 } 297 | Popular Tags |