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.component.UIComponentBase; 023 import javax.faces.context.FacesContext; 024 import org.apache.commons.lang.ArrayUtils; 025 import org.apache.commons.lang.StringUtils; 026 import org.apache.myfaces.tobago.component.MethodBindingToMethodExpression; 027 import org.apache.myfaces.tobago.component.MethodExpressionToMethodBinding; 028 import org.apache.myfaces.tobago.internal.util.Deprecation; 029 import org.apache.myfaces.tobago.renderkit.MarginValues; 030 import org.apache.myfaces.tobago.renderkit.SpacingValues; 031 import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer; 032 import javax.el.ELException; 033 import javax.faces.FacesException; 034 import java.util.ArrayList; 035 import java.util.List; 036 import javax.el.MethodExpression; 037 import javax.el.ValueExpression; 038 039 /** 040 This tag add client side script to the rendered page. 041 * UIComponent class, generated from template {@code component1.2.stg} with class 042 * {@link org.apache.myfaces.tobago.internal.taglib.component.ScriptTagDeclaration}. 043 */ 044 public class UIScript 045 extends UIComponentBase { 046 047 public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Script"; 048 049 public static final String COMPONENT_FAMILY = "org.apache.myfaces.tobago.Script"; 050 051 private java.lang.String onload; 052 private java.lang.String file; 053 private java.lang.String onunload; 054 private java.lang.String script; 055 private java.lang.String onexit; 056 private java.lang.String onsubmit; 057 058 public String getFamily() { 059 return COMPONENT_FAMILY; 060 } 061 062 063 public java.lang.String getOnload() { 064 if (onload != null) { 065 return onload; 066 } 067 ValueExpression ve = getValueExpression("onload"); 068 if (ve != null) { 069 try { 070 return (java.lang.String) ve.getValue(getFacesContext().getELContext()); 071 } catch (ELException e) { 072 throw new FacesException(e); 073 } 074 } 075 return null; 076 } 077 078 public void setOnload(java.lang.String onload) { 079 this.onload = onload; 080 } 081 082 public java.lang.String getFile() { 083 if (file != null) { 084 return file; 085 } 086 ValueExpression ve = getValueExpression("file"); 087 if (ve != null) { 088 try { 089 return (java.lang.String) ve.getValue(getFacesContext().getELContext()); 090 } catch (ELException e) { 091 throw new FacesException(e); 092 } 093 } 094 return null; 095 } 096 097 public void setFile(java.lang.String file) { 098 this.file = file; 099 } 100 101 public java.lang.String getOnunload() { 102 if (onunload != null) { 103 return onunload; 104 } 105 ValueExpression ve = getValueExpression("onunload"); 106 if (ve != null) { 107 try { 108 return (java.lang.String) ve.getValue(getFacesContext().getELContext()); 109 } catch (ELException e) { 110 throw new FacesException(e); 111 } 112 } 113 return null; 114 } 115 116 public void setOnunload(java.lang.String onunload) { 117 this.onunload = onunload; 118 } 119 120 public java.lang.String getScript() { 121 if (script != null) { 122 return script; 123 } 124 ValueExpression ve = getValueExpression("script"); 125 if (ve != null) { 126 try { 127 return (java.lang.String) ve.getValue(getFacesContext().getELContext()); 128 } catch (ELException e) { 129 throw new FacesException(e); 130 } 131 } 132 return null; 133 } 134 135 public void setScript(java.lang.String script) { 136 this.script = script; 137 } 138 139 public java.lang.String getOnexit() { 140 if (onexit != null) { 141 return onexit; 142 } 143 ValueExpression ve = getValueExpression("onexit"); 144 if (ve != null) { 145 try { 146 return (java.lang.String) ve.getValue(getFacesContext().getELContext()); 147 } catch (ELException e) { 148 throw new FacesException(e); 149 } 150 } 151 return null; 152 } 153 154 public void setOnexit(java.lang.String onexit) { 155 this.onexit = onexit; 156 } 157 158 public java.lang.String getOnsubmit() { 159 if (onsubmit != null) { 160 return onsubmit; 161 } 162 ValueExpression ve = getValueExpression("onsubmit"); 163 if (ve != null) { 164 try { 165 return (java.lang.String) ve.getValue(getFacesContext().getELContext()); 166 } catch (ELException e) { 167 throw new FacesException(e); 168 } 169 } 170 return null; 171 } 172 173 public void setOnsubmit(java.lang.String onsubmit) { 174 this.onsubmit = onsubmit; 175 } 176 177 public void restoreState(FacesContext context, Object componentState) { 178 Object[] values = (Object[]) componentState; 179 super.restoreState(context, values[0]); 180 onload = (java.lang.String) values[1]; 181 file = (java.lang.String) values[2]; 182 onunload = (java.lang.String) values[3]; 183 script = (java.lang.String) values[4]; 184 onexit = (java.lang.String) values[5]; 185 onsubmit = (java.lang.String) values[6]; 186 } 187 188 public Object saveState(FacesContext context) { 189 Object[] values = new Object[7]; 190 values[0] = super.saveState(context); 191 values[1] = onload; 192 values[2] = file; 193 values[3] = onunload; 194 values[4] = script; 195 values[5] = onexit; 196 values[6] = onsubmit; 197 return values; 198 } 199 200 201 }