/* * � Copyright IBM Corp. 2011 * * 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.ibm.xsp.extlib.dojo.form; import java.io.Serializable; import javax.faces.context.FacesContext; import javax.faces.el.ValueBinding; import com.ibm.xsp.complex.ValueBindingObjectImpl; /** * Dojo Slider Rule Label * * @author Darin Egan (darin.egan@ie.ibm.com) */ public class SliderRuleLabel extends ValueBindingObjectImpl implements Serializable { private static final long serialVersionUID = -2196447863026413988L; private String label; public String getLabel() { if (label != null) { return label; } ValueBinding vb = getValueBinding("label"); //$NON-NLS-1$ if (vb != null) { return (String)vb.getValue(getFacesContext()); } return null; } @Override public void restoreState(FacesContext context, Object value) { Object[] state = (Object[])value; super.restoreState(context, state[0]); label = (String)state[1]; } @Override public Object saveState(FacesContext context) { Object[] state = new Object[2]; state[0] = super.saveState(context); state[1] = label; return state; } public void setLabel(String label) { this.label = label; } }