com.icesoft.faces.component.outputconnectionstatus.OutputConnectionStatus Maven / Gradle / Ivy
Show all versions of icefaces-compat Show documentation
/*
* Copyright 2004-2012 ICEsoft Technologies Canada Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an "AS
* IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package com.icesoft.faces.component.outputconnectionstatus;
import com.icesoft.faces.component.CSS_DEFAULT;
import com.icesoft.faces.component.ext.taglib.Util;
import javax.faces.component.html.HtmlPanelGroup;
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
/**
* OutputConnectionStatus is a JSF component class representing an ICEfaces
* output connection status state indicator.
*
* This component extends the JSF HtmlPanelGroup component.
*
* By default the OutputConnectionStatus is rendered by the
* "com.icesoft.faces.OutputConnectionStatusRenderer" renderer type.
*/
public class OutputConnectionStatus extends HtmlPanelGroup {
public static final String COMPONENT_TYPE =
"com.icesoft.faces.OutputConnectionStatus";
public static final String RENDERER_TYPE =
"com.icesoft.faces.OutputConnectionStatusRenderer";
public static final String COMPONENT_FAMILY = "javax.faces.Panel";
private static final String DEFAULT_LABEL = "";
private java.lang.String style;
private java.lang.String styleClass;
private java.lang.String inactiveLabel;
private java.lang.String activeLabel;
private java.lang.String cautionLabel;
private java.lang.String disconnectedLabel;
private java.lang.String renderedOnUserRole;
private Boolean showPopupOnDisconnect; // ICE-2621
private Boolean displayHourglassWhenActive;
/**
* Return the value of the COMPONENT_FAMILY
of this
* component.
*/
public String getFamily() {
return COMPONENT_FAMILY;
}
/**
* Return the value of the RENDERER_TYPE
of this
* component.
*/
public String getRendererType() {
return RENDERER_TYPE;
}
/**
* Return the value of the COMPONENT_TYPE
of this
* component.
*/
public String getComponentType() {
return COMPONENT_TYPE;
}
/**
* Return the value of the activeClass
property.
*/
public String getActiveClass() {
return Util.getQualifiedStyleClass(this,
CSS_DEFAULT.OUTPUT_CONNECTION_STATUS_DEFAULT_ACTIVE_CLASS);
}
/**
* Set the value of the activeLabel
property.
*/
public void setActiveLabel(java.lang.String activeLabel) {
this.activeLabel = activeLabel;
}
/**
* Return the value of the activeLabel
property.
*/
public String getActiveLabel() {
if (activeLabel != null) {
return activeLabel;
}
ValueBinding vb = getValueBinding("activeLabel");
return vb != null ? (String) vb.getValue(getFacesContext()) :
DEFAULT_LABEL;
}
/**
* Return the value of the cautionClass
property.
*/
public String getCautionClass() {
return Util.getQualifiedStyleClass(this,
CSS_DEFAULT.OUTPUT_CONNECTION_STATUS_DEFAULT_CAUTION_CLASS);
}
/**
* Set the value of the cautionLabel
property.
*/
public void setCautionLabel(java.lang.String cautionLabel) {
this.cautionLabel = cautionLabel;
}
/**
* Return the value of the cautionLabel
property.
*/
public String getCautionLabel() {
if (cautionLabel != null) {
return cautionLabel;
}
ValueBinding vb = getValueBinding("cautionLabel");
return vb != null ? (String) vb.getValue(getFacesContext()) :
DEFAULT_LABEL;
}
/**
* Return the value of the disconnectedClass
property.
*/
public String getDisconnectedClass() {
return Util.getQualifiedStyleClass(this,
CSS_DEFAULT.OUTPUT_CONNECTION_STATUS_DEFAULT_DISCONNECT_CLASS);
}
/**
* Set the value of the disconnectedLabel
property.
*/
public void setDisconnectedLabel(java.lang.String disconnectedLabel) {
this.disconnectedLabel = disconnectedLabel;
}
/**
* Return the value of the disconnectedLabel
property.
*/
public String getDisconnectedLabel() {
if (disconnectedLabel != null) {
return disconnectedLabel;
}
ValueBinding vb = getValueBinding("disconnectedLabel");
return vb != null ? (String) vb.getValue(getFacesContext()) :
DEFAULT_LABEL;
}
/**
* Return the value of the inactiveClass
property.
*/
public String getInactiveClass() {
return Util.getQualifiedStyleClass(this,
CSS_DEFAULT.OUTPUT_CONNECTION_STATUS_DEFAULT_INACTIVE_CLASS);
}
/**
* Set the value of the inactiveLabel
property.
*/
public void setInactiveLabel(java.lang.String inactiveLabel) {
this.inactiveLabel = inactiveLabel;
}
/**
* Return the value of the inactiveLabel
property.
*/
public String getInactiveLabel() {
if (inactiveLabel != null) {
return inactiveLabel;
}
ValueBinding vb = getValueBinding("inactiveLabel");
return vb != null ? (String) vb.getValue(getFacesContext()) :
DEFAULT_LABEL;
}
/**
* Set the value of the style
property.
*/
public void setStyle(java.lang.String style) {
this.style = style;
}
/**
* Return the value of the style
property.
*/
public String getStyle() {
if (style != null) {
return style;
}
ValueBinding vb = getValueBinding("style");
return vb != null ? (String) vb.getValue(getFacesContext()) : null;
}
/**
* Set the value of the styleClass
property.
*/
public void setStyleClass(java.lang.String styleClass) {
this.styleClass = styleClass;
}
/**
* Return the value of the styleClass
property.
*/
public String getStyleClass() {
return Util.getQualifiedStyleClass(this,
styleClass,
CSS_DEFAULT.OUTPUT_CONNECTION_STATUS_DEFAULT_STYLE_CLASS,
"styleClass");
}
/**
* Set the value of the renderedOnUserRole
property.
*/
public void setRenderedOnUserRole(String renderedOnUserRole) {
this.renderedOnUserRole = renderedOnUserRole;
}
/**
* Return the value of the renderedOnUserRole
property.
*/
public String getRenderedOnUserRole() {
if (renderedOnUserRole != null) {
return renderedOnUserRole;
}
ValueBinding vb = getValueBinding("renderedOnUserRole");
return vb != null ? (String) vb.getValue(getFacesContext()) : null;
}
/**
* Return the value of the rendered
property.
*/
public boolean isRendered() {
if (!Util.isRenderedOnUserRole(this)) {
return false;
}
return super.isRendered();
}
/**
* Gets the state of the instance as a Serializable
* Object.
*/
public Object saveState(FacesContext context) {
Object values[] = new Object[10];
values[0] = super.saveState(context);
values[1] = style;
values[2] = styleClass;
values[3] = inactiveLabel;
values[4] = activeLabel;
values[5] = cautionLabel;
values[6] = disconnectedLabel;
values[7] = renderedOnUserRole;
values[8] = showPopupOnDisconnect;
values[9] = displayHourglassWhenActive;
return ((Object) (values));
}
/**
* Perform any processing required to restore the state from the entries
* in the state Object.
*/
public void restoreState(FacesContext context, Object state) {
Object values[] = (Object[]) state;
super.restoreState(context, values[0]);
style = (String) values[1];
styleClass = (String) values[2];
inactiveLabel = (String) values[3];
activeLabel = (String) values[4];
cautionLabel = (String) values[5];
disconnectedLabel = (String) values[6];
renderedOnUserRole = (String) values[7];
showPopupOnDisconnect = (Boolean) values[8];
displayHourglassWhenActive = (Boolean) values[9];
}
public boolean isShowPopupOnDisconnect() {
if (showPopupOnDisconnect != null) return showPopupOnDisconnect.booleanValue();
ValueBinding vb = getValueBinding("showPopupOnDisconnect");
if (vb == null) return false;
Object value = vb.getValue(getFacesContext());
if (value == null) return false;
return ((Boolean) value).booleanValue();
}
public void setShowPopupOnDisconnect(boolean showPopupOnDisconnect) {
this.showPopupOnDisconnect = Boolean.valueOf(showPopupOnDisconnect);
}
public boolean isDisplayHourglassWhenActive() {
if (displayHourglassWhenActive != null) return displayHourglassWhenActive.booleanValue();
ValueBinding vb = getValueBinding("displayHourglassWhenActive");
if (vb == null) return false;
Object value = vb.getValue(getFacesContext());
if (value == null) return false;
return ((Boolean) value).booleanValue();
}
public void setDisplayHourglassWhenActive(boolean displayHourglassWhenActive) {
this.displayHourglassWhenActive = Boolean.valueOf(displayHourglassWhenActive);
}
}