com.icesoft.faces.component.panelconfirmation.PanelConfirmation Maven / Gradle / Ivy
Show all versions of icefaces-compat Show documentation
/*
* Copyright 2004-2013 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.panelconfirmation;
import javax.faces.component.UIComponentBase;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
import com.icesoft.faces.context.effects.JavascriptContext;
import com.icesoft.faces.component.ext.taglib.Util;
import com.icesoft.faces.component.CSS_DEFAULT;
public class PanelConfirmation extends UIComponentBase {
public static final String COMPONENT_TYPE = "com.icesoft.faces.PanelConfirmation";
public static final String COMPONENT_FAMILY = "com.icesoft.faces.PanelConfirmation";
public static final String DEFAULT_RENDERER_TYPE = "com.icesoft.faces.PanelConfirmationRenderer";
private String title = null;
private String message = null;
private String type = null;
private String acceptLabel = null;
private String cancelLabel = null;
private Boolean autoCentre = null;
private Boolean draggable = null;
private Boolean displayAtMouse = null;
private String style = null;
private String styleClass = null;
public PanelConfirmation() {
setRendererType(DEFAULT_RENDERER_TYPE);
JavascriptContext.includeLib(JavascriptContext.ICE_EXTRAS,
FacesContext.getCurrentInstance());
}
public String getFamily() {
return COMPONENT_FAMILY;
}
/**
* Set the value of the title
property.
*/
public void setTitle(String title) {
this.title = title;
}
/**
* Return the value of the title
property.
*/
public String getTitle() {
if (title != null) {
return title;
}
ValueBinding vb = getValueBinding("title");
return vb != null ? (String) vb.getValue(getFacesContext()) : null;
}
/**
* Set the value of the message
property.
*/
public void setMessage(String message) {
this.message = message;
}
/**
* Return the value of the message
property.
*/
public String getMessage() {
if (message != null) {
return message;
}
ValueBinding vb = getValueBinding("message");
return vb != null ? (String) vb.getValue(getFacesContext()) : null;
}
/**
* Set the value of the type
property.
*/
public void setType(String type) {
this.type = type;
}
/**
* Return the value of the type
property.
*/
public String getType() {
if (type != null) {
return type;
}
ValueBinding vb = getValueBinding("type");
return vb != null ? (String) vb.getValue(getFacesContext()) : "normal";
}
/**
* Set the value of the acceptLabel
property.
*/
public void setAcceptLabel(String acceptLabel) {
this.acceptLabel = acceptLabel;
}
/**
* Return the value of the acceptLabel
property.
*/
public String getAcceptLabel() {
if (acceptLabel != null) {
return acceptLabel;
}
ValueBinding vb = getValueBinding("acceptLabel");
return vb != null ? (String) vb.getValue(getFacesContext()) : null;
}
/**
* Set the value of the cancelLabel
property.
*/
public void setCancelLabel(String cancelLabel) {
this.cancelLabel = cancelLabel;
}
/**
* Return the value of the cancelLabel
property.
*/
public String getCancelLabel() {
if (cancelLabel != null) {
return cancelLabel;
}
ValueBinding vb = getValueBinding("cancelLabel");
return vb != null ? (String) vb.getValue(getFacesContext()) : null;
}
/**
* Set the value of the style
property.
*/
public void setStyle(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(String styleClass) {
this.styleClass = styleClass;
}
/**
* Return the value of the styleClass
property.
*/
public String getStyleClass() {
return Util.getQualifiedStyleClass(this, styleClass, CSS_DEFAULT.PANEL_CONFIRMATION_BASE, "styleClass");
}
/**
* Return the value of the headerClass
property.
*/
public String getHeaderClass() {
return Util.getQualifiedStyleClass(this, CSS_DEFAULT.PANEL_CONFIRMATION_HEADER);
}
/**
* Return the value of the bodyClass
property.
*/
public String getBodyClass() {
return Util.getQualifiedStyleClass(this, CSS_DEFAULT.PANEL_CONFIRMATION_BODY);
}
/**
* Return the value of the buttonsClass
property.
*/
public String getButtonsClass() {
return Util.getQualifiedStyleClass(this, CSS_DEFAULT.PANEL_CONFIRMATION_BUTTONS);
}
/**
* Set the value of the autoCentre
property.
*/
public void setAutoCentre(boolean autoCentre) {
this.autoCentre = Boolean.valueOf(autoCentre);
}
/**
* Return the value of the autoCentre
property.
*/
public boolean isAutoCentre() {
if (autoCentre != null) {
return autoCentre.booleanValue();
}
ValueBinding vb = getValueBinding("autoCentre");
Boolean boolVal = vb != null ? (Boolean) vb.getValue(getFacesContext())
: null;
return boolVal != null ? boolVal.booleanValue() : false;
}
/**
* Set the value of the draggable
property.
*/
public void setDraggable(boolean draggable) {
this.draggable = Boolean.valueOf(draggable);
}
/**
* Return the value of the draggable
property.
*/
public boolean isDraggable() {
if (draggable != null) {
return draggable.booleanValue();
}
ValueBinding vb = getValueBinding("draggable");
Boolean boolVal = vb != null ? (Boolean) vb.getValue(getFacesContext())
: null;
return boolVal != null ? boolVal.booleanValue() : false;
}
/**
* Set the value of the displayAtMouse
property.
*/
public void setDisplayAtMouse(boolean displayAtMouse) {
this.displayAtMouse = Boolean.valueOf(displayAtMouse);
}
/**
* Return the value of the displayAtMouse
property.
*/
public boolean isDisplayAtMouse() {
if (displayAtMouse != null) {
return displayAtMouse.booleanValue();
}
ValueBinding vb = getValueBinding("displayAtMouse");
Boolean boolVal = vb != null ? (Boolean) vb.getValue(getFacesContext())
: null;
return boolVal != null ? boolVal.booleanValue() : false;
}
private java.lang.Boolean escape;
/**
* Return the value of the escape
property.
* Contents: Flag indicating that characters that are sensitive
* in HTML and XML markup must be escaped. This flag
* is set to "true" by default.
*/
public boolean isEscape() {
if (null != this.escape) {
return this.escape.booleanValue();
}
ValueBinding vb = getValueBinding("escape");
Boolean boolVal = vb != null ? (Boolean) vb.getValue(getFacesContext()) : null;
return boolVal != null ? boolVal.booleanValue() : true;
}
/**
*
Set the value of the escape
property.
*/
public void setEscape(boolean escape) {
this.escape = Boolean.valueOf(escape);
}
private transient Object states[];
public Object saveState(FacesContext context) {
if(states == null) {
states = new Object[12];
}
states[0] = super.saveState(context);
states[1] = title;
states[2] = message;
states[3] = type;
states[4] = acceptLabel;
states[5] = cancelLabel;
states[6] = style;
states[7] = styleClass;
states[8] = autoCentre;
states[9] = draggable;
states[10] = displayAtMouse;
states[11] = escape;
return states;
}
public void restoreState(FacesContext context, Object state) {
states = (Object[]) state;
super.restoreState(context, states[0]);
title = (String) states[1];
message = (String) states[2];
type = (String) states[3];
acceptLabel = (String) states[4];
cancelLabel = (String) states[5];
style = (String) states[6];
styleClass = (String) states[7];
autoCentre = (Boolean) states[8];
draggable = (Boolean) states[9];
displayAtMouse = (Boolean) states[10];
escape = (Boolean) states[11];
}
}