1 // WARNING: This file was automatically generated. Do not edit it directly,
2 // or you will lose your changes.
3
4 /*
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements. See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership. The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License. You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied. See the License for the
19 * specific language governing permissions and limitations
20 * under the License.
21 */
22 package org.apache.myfaces.trinidad.component.html;
23
24 import org.apache.myfaces.trinidad.bean.FacesBean;
25 import org.apache.myfaces.trinidad.bean.PropertyKey;
26 import org.apache.myfaces.trinidad.component.UIXComponentBase;
27 import org.apache.myfaces.trinidad.util.ComponentUtils;
28
29 /**
30 *
31 * <html:p>
32 * The script component supports both the importing of libraries and
33 * inline scripts.
34 * </html:p>
35 *
36 * <h4>Events:</h4>
37 * <table border="1" width="100%" cellpadding="3" summary="">
38 * <tr bgcolor="#CCCCFF" class="TableHeadingColor">
39 * <th align="left">Type</th>
40 * <th align="left">Phases</th>
41 * <th align="left">Description</th>
42 * </tr>
43 * <tr class="TableRowColor">
44 * <td valign="top"><code>org.apache.myfaces.trinidad.event.AttributeChangeEvent</code></td>
45 * <td valign="top" nowrap>Invoke<br>Application<br>Apply<br>Request<br>Values</td>
46 * <td valign="top">Event delivered to describe an attribute change. Attribute change events are not delivered for any programmatic change to a property. They are only delivered when a renderer changes a property without the application's specific request. An example of an attribute change event might include the width of a column that supported client-side resizing.</td>
47 * </tr>
48 * </table>
49 */
50 public class HtmlScript extends UIXComponentBase
51 {
52 static public final FacesBean.Type TYPE = new FacesBean.Type(
53 UIXComponentBase.TYPE);
54 static public final PropertyKey TEXT_KEY =
55 TYPE.registerKey("text", String.class);
56 static public final PropertyKey SOURCE_KEY =
57 TYPE.registerKey("source", String.class);
58 static public final PropertyKey GENERATES_CONTENT_KEY =
59 TYPE.registerKey("generatesContent", Boolean.class, Boolean.FALSE);
60 static public final PropertyKey PARTIAL_TRIGGERS_KEY =
61 TYPE.registerKey("partialTriggers", String[].class, null, 0, PropertyKey.Mutable.RARELY);
62
63 static public final String COMPONENT_FAMILY =
64 "org.apache.myfaces.trinidad.Script";
65 static public final String COMPONENT_TYPE =
66 "org.apache.myfaces.trinidad.HtmlScript";
67
68 /**
69 * Construct an instance of the HtmlScript.
70 */
71 public HtmlScript()
72 {
73 super("org.apache.myfaces.trinidad.Script");
74 }
75
76 /**
77 * Gets the inline script
78 *
79 * @return the new text value
80 */
81 final public String getText()
82 {
83 return ComponentUtils.resolveString(getProperty(TEXT_KEY));
84 }
85
86 /**
87 * Sets the inline script
88 *
89 * @param text the new text value
90 */
91 final public void setText(String text)
92 {
93 setProperty(TEXT_KEY, (text));
94 }
95
96 /**
97 * Gets the URI of a script library to import.
98 *
99 * @return the new source value
100 */
101 final public String getSource()
102 {
103 return ComponentUtils.resolveString(getProperty(SOURCE_KEY));
104 }
105
106 /**
107 * Sets the URI of a script library to import.
108 *
109 * @param source the new source value
110 */
111 final public void setSource(String source)
112 {
113 setProperty(SOURCE_KEY, (source));
114 }
115
116 /**
117 * Gets if the script generates content
118 * using document.write() or document.writeln(), set this to true.
119 * It defaults to false.
120 *
121 * @return the new generatesContent value
122 */
123 final public boolean isGeneratesContent()
124 {
125 return ComponentUtils.resolveBoolean(getProperty(GENERATES_CONTENT_KEY), false);
126 }
127
128 /**
129 * Sets if the script generates content
130 * using document.write() or document.writeln(), set this to true.
131 * It defaults to false.
132 *
133 * @param generatesContent the new generatesContent value
134 */
135 final public void setGeneratesContent(boolean generatesContent)
136 {
137 setProperty(GENERATES_CONTENT_KEY, generatesContent ? Boolean.TRUE : Boolean.FALSE);
138 }
139
140 /**
141 * Gets the IDs of the components that should trigger a partial update.
142 * This component will listen on the trigger components. If one of the
143 * trigger components receives an event that will cause it to update
144 * in some way, this component will request to be updated too.
145 *
146 * @return the new partialTriggers value
147 */
148 final public String[] getPartialTriggers()
149 {
150 return (String[])getProperty(PARTIAL_TRIGGERS_KEY);
151 }
152
153 /**
154 * Sets the IDs of the components that should trigger a partial update.
155 * This component will listen on the trigger components. If one of the
156 * trigger components receives an event that will cause it to update
157 * in some way, this component will request to be updated too.
158 *
159 * @param partialTriggers the new partialTriggers value
160 */
161 final public void setPartialTriggers(String[] partialTriggers)
162 {
163 setProperty(PARTIAL_TRIGGERS_KEY, (partialTriggers));
164 }
165
166 @Override
167 public String getFamily()
168 {
169 return COMPONENT_FAMILY;
170 }
171
172 @Override
173 protected FacesBean.Type getBeanType()
174 {
175 return TYPE;
176 }
177
178 /**
179 * Construct an instance of the HtmlScript.
180 */
181 protected HtmlScript(
182 String rendererType
183 )
184 {
185 super(rendererType);
186 }
187
188 static
189 {
190 TYPE.lockAndRegister("org.apache.myfaces.trinidad.Script","org.apache.myfaces.trinidad.Script");
191 }
192 }