001 // ---------- Attention: Generated code, please do not modify! ----------- 002 003 /* 004 * Licensed to the Apache Software Foundation (ASF) under one or more 005 * contributor license agreements. See the NOTICE file distributed with 006 * this work for additional information regarding copyright ownership. 007 * The ASF licenses this file to You under the Apache License, Version 2.0 008 * (the "License"); you may not use this file except in compliance with 009 * the License. You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 */ 019 020 package org.apache.myfaces.tobago.component; 021 022 import javax.faces.context.FacesContext; 023 import org.apache.commons.lang.ArrayUtils; 024 import org.apache.commons.lang.StringUtils; 025 import org.apache.myfaces.tobago.component.MethodBindingToMethodExpression; 026 import org.apache.myfaces.tobago.component.MethodExpressionToMethodBinding; 027 import org.apache.myfaces.tobago.internal.util.Deprecation; 028 import org.apache.myfaces.tobago.renderkit.MarginValues; 029 import org.apache.myfaces.tobago.renderkit.SpacingValues; 030 import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer; 031 import javax.el.ELException; 032 import javax.faces.FacesException; 033 import java.util.ArrayList; 034 import java.util.List; 035 import javax.el.MethodExpression; 036 import javax.el.ValueExpression; 037 038 /** 039 Renders a selectable command button within a toolbar. 040 * UIComponent class, generated from template {@code component1.2.stg} with class 041 * {@link org.apache.myfaces.tobago.internal.taglib.component.ToolBarSelectBooleanTagDeclaration}. 042 */ 043 public class UIToolBarCheck 044 extends UISelectBooleanCommand { 045 046 public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.ToolBarCheck"; 047 048 private java.lang.Character accessKey; 049 private java.lang.String labelWithAccessKey; 050 private java.lang.String image; 051 private java.lang.String label; 052 private java.lang.String tip; 053 private java.lang.Boolean disabled; 054 055 056 /** 057 Deprecated! Has not longer any function. 058 059 @deprecated*/ 060 @Deprecated 061 public java.lang.Character getAccessKey() { 062 if (accessKey != null) { 063 return accessKey; 064 } 065 ValueExpression ve = getValueExpression("accessKey"); 066 if (ve != null) { 067 try { 068 return (java.lang.Character) ve.getValue(getFacesContext().getELContext()); 069 } catch (ELException e) { 070 throw new FacesException(e); 071 } 072 } 073 return null; 074 } 075 076 @Deprecated 077 public void setAccessKey(java.lang.Character accessKey) { 078 this.accessKey = accessKey; 079 } 080 081 /** 082 Deprecated! Use 'label' instead. 083 Text value to display as label. 084 If text contains an underscore the next character overwrites 'accesskey'. 085 086 @deprecated*/ 087 @Deprecated 088 public java.lang.String getLabelWithAccessKey() { 089 if (labelWithAccessKey != null) { 090 return labelWithAccessKey; 091 } 092 ValueExpression ve = getValueExpression("labelWithAccessKey"); 093 if (ve != null) { 094 try { 095 return (java.lang.String) ve.getValue(getFacesContext().getELContext()); 096 } catch (ELException e) { 097 throw new FacesException(e); 098 } 099 } 100 return null; 101 } 102 103 @Deprecated 104 public void setLabelWithAccessKey(java.lang.String labelWithAccessKey) { 105 this.labelWithAccessKey = labelWithAccessKey; 106 } 107 108 /** 109 Url to an image to display. 110 111 */ 112 public java.lang.String getImage() { 113 if (image != null) { 114 return image; 115 } 116 ValueExpression ve = getValueExpression("image"); 117 if (ve != null) { 118 try { 119 return (java.lang.String) ve.getValue(getFacesContext().getELContext()); 120 } catch (ELException e) { 121 throw new FacesException(e); 122 } 123 } 124 return null; 125 } 126 127 public void setImage(java.lang.String image) { 128 this.image = image; 129 } 130 131 /** 132 Text value to display as label. 133 If text contains an underscore the next character is used as accesskey. 134 135 */ 136 public java.lang.String getLabel() { 137 if (label != null) { 138 return label; 139 } 140 ValueExpression ve = getValueExpression("label"); 141 if (ve != null) { 142 try { 143 return (java.lang.String) ve.getValue(getFacesContext().getELContext()); 144 } catch (ELException e) { 145 throw new FacesException(e); 146 } 147 } 148 return null; 149 } 150 151 public void setLabel(java.lang.String label) { 152 this.label = label; 153 } 154 155 /** 156 Text value to display as tooltip. 157 158 */ 159 public java.lang.String getTip() { 160 if (tip != null) { 161 return tip; 162 } 163 ValueExpression ve = getValueExpression("tip"); 164 if (ve != null) { 165 try { 166 return (java.lang.String) ve.getValue(getFacesContext().getELContext()); 167 } catch (ELException e) { 168 throw new FacesException(e); 169 } 170 } 171 return null; 172 } 173 174 public void setTip(java.lang.String tip) { 175 this.tip = tip; 176 } 177 178 /** 179 Flag indicating that this element is disabled. 180 <br />Default: <code>false</code> 181 */ 182 public boolean isDisabled() { 183 if (disabled != null) { 184 return disabled; 185 } 186 ValueExpression ve = getValueExpression("disabled"); 187 if (ve != null) { 188 try { 189 Boolean bool = (Boolean) ve.getValue(getFacesContext().getELContext()); 190 if (bool != null) { 191 return bool; 192 } 193 } catch (ELException e) { 194 throw new FacesException(e); 195 } 196 } 197 return false; 198 } 199 200 public void setDisabled(boolean disabled) { 201 this.disabled = disabled; 202 } 203 204 public void restoreState(FacesContext context, Object componentState) { 205 Object[] values = (Object[]) componentState; 206 super.restoreState(context, values[0]); 207 accessKey = (java.lang.Character) values[1]; 208 labelWithAccessKey = (java.lang.String) values[2]; 209 image = (java.lang.String) values[3]; 210 label = (java.lang.String) values[4]; 211 tip = (java.lang.String) values[5]; 212 disabled = (java.lang.Boolean) values[6]; 213 } 214 215 public Object saveState(FacesContext context) { 216 Object[] values = new Object[7]; 217 values[0] = super.saveState(context); 218 values[1] = accessKey; 219 values[2] = labelWithAccessKey; 220 values[3] = image; 221 values[4] = label; 222 values[5] = tip; 223 values[6] = disabled; 224 return values; 225 } 226 227 228 }