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.myfaces.tobago.context.Markup; 024 import org.apache.myfaces.tobago.internal.component.AbstractUITreeSelect; 025 import org.apache.commons.lang.ArrayUtils; 026 import org.apache.commons.lang.StringUtils; 027 import org.apache.myfaces.tobago.component.MethodBindingToMethodExpression; 028 import org.apache.myfaces.tobago.component.MethodExpressionToMethodBinding; 029 import org.apache.myfaces.tobago.internal.util.Deprecation; 030 import org.apache.myfaces.tobago.renderkit.MarginValues; 031 import org.apache.myfaces.tobago.renderkit.SpacingValues; 032 import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer; 033 import javax.el.ELException; 034 import javax.faces.FacesException; 035 import java.util.ArrayList; 036 import java.util.List; 037 import javax.el.MethodExpression; 038 import javax.el.ValueExpression; 039 040 /** 041 Makes a tree node selectable. 042 * UIComponent class, generated from template {@code component1.2.stg} with class 043 * {@link org.apache.myfaces.tobago.internal.taglib.component.TreeSelectTagDeclaration}. 044 */ 045 public class UITreeSelect 046 extends AbstractUITreeSelect implements SupportsMarkup { 047 048 public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.TreeSelect"; 049 050 private org.apache.myfaces.tobago.context.Markup markup; 051 private org.apache.myfaces.tobago.context.Markup currentMarkup; 052 private java.lang.String label; 053 private java.lang.Boolean showCheckbox; 054 private java.lang.String tip; 055 056 057 public org.apache.myfaces.tobago.context.Markup getMarkup() { 058 if (markup != null) { 059 return markup; 060 } 061 ValueExpression ve = getValueExpression("markup"); 062 if (ve != null) { 063 try { 064 Object object = ve.getValue(getFacesContext().getELContext()); 065 return Markup.valueOf(object); 066 } catch (ELException e) { 067 throw new FacesException(e); 068 } 069 } 070 return null; 071 } 072 073 public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) { 074 this.markup = markup; 075 } 076 077 public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() { 078 if (currentMarkup != null) { 079 return currentMarkup; 080 } 081 ValueExpression ve = getValueExpression("currentMarkup"); 082 if (ve != null) { 083 try { 084 Object object = ve.getValue(getFacesContext().getELContext()); 085 return Markup.valueOf(object); 086 } catch (ELException e) { 087 throw new FacesException(e); 088 } 089 } 090 return null; 091 } 092 093 public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) { 094 this.currentMarkup = currentMarkup; 095 } 096 097 /** 098 Text value to display as label. 099 If text contains an underscore the next character is used as accesskey. 100 101 */ 102 public java.lang.String getLabel() { 103 if (label != null) { 104 return label; 105 } 106 ValueExpression ve = getValueExpression("label"); 107 if (ve != null) { 108 try { 109 return (java.lang.String) ve.getValue(getFacesContext().getELContext()); 110 } catch (ELException e) { 111 throw new FacesException(e); 112 } 113 } 114 return null; 115 } 116 117 public void setLabel(java.lang.String label) { 118 this.label = label; 119 } 120 121 /** 122 Show a checkbox to visualize the selection state. 123 <br />Default: <code>false</code> 124 */ 125 public boolean isShowCheckbox() { 126 if (showCheckbox != null) { 127 return showCheckbox; 128 } 129 ValueExpression ve = getValueExpression("showCheckbox"); 130 if (ve != null) { 131 try { 132 Boolean bool = (Boolean) ve.getValue(getFacesContext().getELContext()); 133 if (bool != null) { 134 return bool; 135 } 136 } catch (ELException e) { 137 throw new FacesException(e); 138 } 139 } 140 return false; 141 } 142 143 public void setShowCheckbox(boolean showCheckbox) { 144 this.showCheckbox = showCheckbox; 145 } 146 147 /** 148 Text value to display as tooltip. 149 150 */ 151 public java.lang.String getTip() { 152 if (tip != null) { 153 return tip; 154 } 155 ValueExpression ve = getValueExpression("tip"); 156 if (ve != null) { 157 try { 158 return (java.lang.String) ve.getValue(getFacesContext().getELContext()); 159 } catch (ELException e) { 160 throw new FacesException(e); 161 } 162 } 163 return null; 164 } 165 166 public void setTip(java.lang.String tip) { 167 this.tip = tip; 168 } 169 170 public void restoreState(FacesContext context, Object componentState) { 171 Object[] values = (Object[]) componentState; 172 super.restoreState(context, values[0]); 173 markup = (org.apache.myfaces.tobago.context.Markup) values[1]; 174 currentMarkup = (org.apache.myfaces.tobago.context.Markup) values[2]; 175 label = (java.lang.String) values[3]; 176 showCheckbox = (java.lang.Boolean) values[4]; 177 tip = (java.lang.String) values[5]; 178 } 179 180 public Object saveState(FacesContext context) { 181 Object[] values = new Object[6]; 182 values[0] = super.saveState(context); 183 values[1] = markup; 184 values[2] = currentMarkup; 185 values[3] = label; 186 values[4] = showCheckbox; 187 values[5] = tip; 188 return values; 189 } 190 191 192 }