/*
* xulfaces : bring XUL power to Java
*
* Copyright (C) 2005 Olivier SCHMITT
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.xulfaces.component;
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
import org.xulfaces.SmoothlyUpdateable;
import org.xulfaces.annotation.faces.ATTRIBUTE;
import org.xulfaces.annotation.faces.COMPONENT;
import org.xulfaces.renderkit.KitConstants;
/**
*
* @author kito31
* @version $Id: CommandComponent.java,v 1.10 2007/07/17 20:24:33 kito31 Exp $
*/
@COMPONENT(type="xul.component.Command")
public class CommandComponent extends XULCommand implements SmoothlyUpdateable{
@ATTRIBUTE(automateRendering=false,description = "If true the AJAX request is asynchronous, false otherwise.")
private Boolean asynchronous;
@ATTRIBUTE(description = "The label inherited by the menu items and keys that are attached to the command.")
private String label;
public String getFamily() {
return KitConstants.FAMILY;
}
public String getRenderKitId() {
return KitConstants.RENDERKIT_ID;
}
// @StartGeneration
public java.lang.Boolean getAsynchronous(){
java.lang.Boolean value = null;
ValueBinding vb = getValueBinding("asynchronous");
if (vb != null) {
return (java.lang.Boolean)(vb.getValue(getFacesContext()));
}
else {
value = this.asynchronous;
}
return value;
}
public void setAsynchronous(java.lang.Boolean value){
this.asynchronous = value;
}
public java.lang.String getLabel(){
java.lang.String value = null;
ValueBinding vb = getValueBinding("label");
if (vb != null) {
return (java.lang.String)(vb.getValue(getFacesContext()));
}
else {
value = this.label;
}
return value;
}
public void setLabel(java.lang.String value){
this.label = value;
}
public Object saveState(FacesContext context) {
Object values[] = new Object[3];
values[0] = super.saveState(context);
values[1] = this.asynchronous;
values[2] = this.label;
return ((Object) (values));
}
public void restoreState(FacesContext context, Object state) {
Object values[] = (Object[]) state;
super.restoreState(context, values[0]);
this.asynchronous = (java.lang.Boolean) values[1];
this.label = (java.lang.String) values[2];
}
// @EndGeneration
}