001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.dto.html5;
014
015import static org.apache.juneau.common.internal.StringUtils.*;
016
017import java.net.*;
018
019import org.apache.juneau.*;
020import org.apache.juneau.annotation.*;
021import org.apache.juneau.internal.*;
022
023/**
024 * DTO for an HTML <a class="doclink" href="https://www.w3.org/TR/html5/scripting-1.html#the-script-element">&lt;script&gt;</a>
025 * element.
026 *
027 * <h5 class='section'>See Also:</h5><ul>
028 *    <li class='link'><a class="doclink" href="../../../../../index.html#jd.Html5">Overview &gt; juneau-dto &gt; HTML5</a>
029 * </ul>
030 */
031@Bean(typeName="script")
032@FluentSetters
033public class Script extends HtmlElementRawText {
034
035   /**
036    * Creates an empty {@link Script} element.
037    */
038   public Script() {}
039
040   /**
041    * Creates a {@link Script} element with the specified {@link Script#type(String)} attribute and
042    * {@link Script#text(Object)} node.
043    *
044    * @param type The {@link Script#type(String)} attribute.
045    * @param text The child text node.
046    */
047   public Script(String type, String...text) {
048      type(type).text(joinnl(text));
049   }
050
051   /**
052    * <a class="doclink" href="https://www.w3.org/TR/html5/scripting-1.html#attr-script-async">async</a> attribute.
053    *
054    * <p>
055    * Execute script asynchronously.
056    *
057    * @param async
058    *    The new value for this attribute.
059    *    Typically a {@link Boolean} or {@link String}.
060    * @return This object.
061    */
062   public final Script async(Object async) {
063      attr("async", deminimize(async, "async"));
064      return this;
065   }
066
067   /**
068    * <a class="doclink" href="https://www.w3.org/TR/html5/scripting-1.html#attr-script-charset">charset</a> attribute.
069    *
070    * <p>
071    * Character encoding of the external script resource.
072    *
073    * @param charset The new value for this attribute.
074    * @return This object.
075    */
076   public final Script charset(String charset) {
077      attr("charset", charset);
078      return this;
079   }
080
081   /**
082    * <a class="doclink" href="https://www.w3.org/TR/html5/scripting-1.html#attr-script-crossorigin">crossorigin</a>
083    * attribute.
084    *
085    * <p>
086    * How the element handles cross-origin requests.
087    *
088    * @param crossorigin The new value for this attribute.
089    * @return This object.
090    */
091   public final Script crossorigin(String crossorigin) {
092      attr("crossorigin", crossorigin);
093      return this;
094   }
095
096   /**
097    * <a class="doclink" href="https://www.w3.org/TR/html5/scripting-1.html#attr-script-defer">defer</a> attribute.
098    *
099    * <p>
100    * Defer script execution.
101    *
102    * @param defer
103    *    The new value for this attribute.
104    *    Typically a {@link Boolean} or {@link String}.
105    * @return This object.
106    */
107   public final Script defer(Object defer) {
108      attr("defer", deminimize(defer, "defer"));
109      return this;
110   }
111
112   /**
113    * <a class="doclink" href="https://www.w3.org/TR/html5/scripting-1.html#attr-script-src">src</a> attribute.
114    *
115    * <p>
116    * Address of the resource.
117    *
118    * <p>
119    * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}.
120    * Strings must be valid URIs.
121    *
122    * <p>
123    * URIs defined by {@link UriResolver} can be used for values.
124    *
125    * @param src
126    *    The new value for this attribute.
127    *    Typically a {@link URL} or {@link String}.
128    * @return This object.
129    */
130   public final Script src(Object src) {
131      attrUri("src", src);
132      return this;
133   }
134
135   /**
136    * <a class="doclink" href="https://www.w3.org/TR/html5/scripting-1.html#attr-script-type">type</a> attribute.
137    *
138    * <p>
139    * Type of embedded resource.
140    *
141    * @param type The new value for this attribute.
142    * @return This object.
143    */
144   public final Script type(String type) {
145      attr("type", type);
146      return this;
147   }
148
149
150   //-----------------------------------------------------------------------------------------------------------------
151   // Overridden methods
152   //-----------------------------------------------------------------------------------------------------------------
153
154   // <FluentSetters>
155
156   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
157   public Script _class(String _class) {
158      super._class(_class);
159      return this;
160   }
161
162   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
163   public Script accesskey(String accesskey) {
164      super.accesskey(accesskey);
165      return this;
166   }
167
168   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
169   public Script contenteditable(Object contenteditable) {
170      super.contenteditable(contenteditable);
171      return this;
172   }
173
174   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
175   public Script dir(String dir) {
176      super.dir(dir);
177      return this;
178   }
179
180   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
181   public Script hidden(Object hidden) {
182      super.hidden(hidden);
183      return this;
184   }
185
186   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
187   public Script id(String id) {
188      super.id(id);
189      return this;
190   }
191
192   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
193   public Script lang(String lang) {
194      super.lang(lang);
195      return this;
196   }
197
198   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
199   public Script onabort(String onabort) {
200      super.onabort(onabort);
201      return this;
202   }
203
204   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
205   public Script onblur(String onblur) {
206      super.onblur(onblur);
207      return this;
208   }
209
210   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
211   public Script oncancel(String oncancel) {
212      super.oncancel(oncancel);
213      return this;
214   }
215
216   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
217   public Script oncanplay(String oncanplay) {
218      super.oncanplay(oncanplay);
219      return this;
220   }
221
222   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
223   public Script oncanplaythrough(String oncanplaythrough) {
224      super.oncanplaythrough(oncanplaythrough);
225      return this;
226   }
227
228   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
229   public Script onchange(String onchange) {
230      super.onchange(onchange);
231      return this;
232   }
233
234   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
235   public Script onclick(String onclick) {
236      super.onclick(onclick);
237      return this;
238   }
239
240   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
241   public Script oncuechange(String oncuechange) {
242      super.oncuechange(oncuechange);
243      return this;
244   }
245
246   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
247   public Script ondblclick(String ondblclick) {
248      super.ondblclick(ondblclick);
249      return this;
250   }
251
252   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
253   public Script ondurationchange(String ondurationchange) {
254      super.ondurationchange(ondurationchange);
255      return this;
256   }
257
258   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
259   public Script onemptied(String onemptied) {
260      super.onemptied(onemptied);
261      return this;
262   }
263
264   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
265   public Script onended(String onended) {
266      super.onended(onended);
267      return this;
268   }
269
270   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
271   public Script onerror(String onerror) {
272      super.onerror(onerror);
273      return this;
274   }
275
276   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
277   public Script onfocus(String onfocus) {
278      super.onfocus(onfocus);
279      return this;
280   }
281
282   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
283   public Script oninput(String oninput) {
284      super.oninput(oninput);
285      return this;
286   }
287
288   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
289   public Script oninvalid(String oninvalid) {
290      super.oninvalid(oninvalid);
291      return this;
292   }
293
294   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
295   public Script onkeydown(String onkeydown) {
296      super.onkeydown(onkeydown);
297      return this;
298   }
299
300   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
301   public Script onkeypress(String onkeypress) {
302      super.onkeypress(onkeypress);
303      return this;
304   }
305
306   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
307   public Script onkeyup(String onkeyup) {
308      super.onkeyup(onkeyup);
309      return this;
310   }
311
312   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
313   public Script onload(String onload) {
314      super.onload(onload);
315      return this;
316   }
317
318   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
319   public Script onloadeddata(String onloadeddata) {
320      super.onloadeddata(onloadeddata);
321      return this;
322   }
323
324   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
325   public Script onloadedmetadata(String onloadedmetadata) {
326      super.onloadedmetadata(onloadedmetadata);
327      return this;
328   }
329
330   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
331   public Script onloadstart(String onloadstart) {
332      super.onloadstart(onloadstart);
333      return this;
334   }
335
336   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
337   public Script onmousedown(String onmousedown) {
338      super.onmousedown(onmousedown);
339      return this;
340   }
341
342   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
343   public Script onmouseenter(String onmouseenter) {
344      super.onmouseenter(onmouseenter);
345      return this;
346   }
347
348   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
349   public Script onmouseleave(String onmouseleave) {
350      super.onmouseleave(onmouseleave);
351      return this;
352   }
353
354   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
355   public Script onmousemove(String onmousemove) {
356      super.onmousemove(onmousemove);
357      return this;
358   }
359
360   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
361   public Script onmouseout(String onmouseout) {
362      super.onmouseout(onmouseout);
363      return this;
364   }
365
366   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
367   public Script onmouseover(String onmouseover) {
368      super.onmouseover(onmouseover);
369      return this;
370   }
371
372   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
373   public Script onmouseup(String onmouseup) {
374      super.onmouseup(onmouseup);
375      return this;
376   }
377
378   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
379   public Script onmousewheel(String onmousewheel) {
380      super.onmousewheel(onmousewheel);
381      return this;
382   }
383
384   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
385   public Script onpause(String onpause) {
386      super.onpause(onpause);
387      return this;
388   }
389
390   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
391   public Script onplay(String onplay) {
392      super.onplay(onplay);
393      return this;
394   }
395
396   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
397   public Script onplaying(String onplaying) {
398      super.onplaying(onplaying);
399      return this;
400   }
401
402   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
403   public Script onprogress(String onprogress) {
404      super.onprogress(onprogress);
405      return this;
406   }
407
408   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
409   public Script onratechange(String onratechange) {
410      super.onratechange(onratechange);
411      return this;
412   }
413
414   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
415   public Script onreset(String onreset) {
416      super.onreset(onreset);
417      return this;
418   }
419
420   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
421   public Script onresize(String onresize) {
422      super.onresize(onresize);
423      return this;
424   }
425
426   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
427   public Script onscroll(String onscroll) {
428      super.onscroll(onscroll);
429      return this;
430   }
431
432   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
433   public Script onseeked(String onseeked) {
434      super.onseeked(onseeked);
435      return this;
436   }
437
438   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
439   public Script onseeking(String onseeking) {
440      super.onseeking(onseeking);
441      return this;
442   }
443
444   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
445   public Script onselect(String onselect) {
446      super.onselect(onselect);
447      return this;
448   }
449
450   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
451   public Script onshow(String onshow) {
452      super.onshow(onshow);
453      return this;
454   }
455
456   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
457   public Script onstalled(String onstalled) {
458      super.onstalled(onstalled);
459      return this;
460   }
461
462   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
463   public Script onsubmit(String onsubmit) {
464      super.onsubmit(onsubmit);
465      return this;
466   }
467
468   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
469   public Script onsuspend(String onsuspend) {
470      super.onsuspend(onsuspend);
471      return this;
472   }
473
474   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
475   public Script ontimeupdate(String ontimeupdate) {
476      super.ontimeupdate(ontimeupdate);
477      return this;
478   }
479
480   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
481   public Script ontoggle(String ontoggle) {
482      super.ontoggle(ontoggle);
483      return this;
484   }
485
486   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
487   public Script onvolumechange(String onvolumechange) {
488      super.onvolumechange(onvolumechange);
489      return this;
490   }
491
492   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
493   public Script onwaiting(String onwaiting) {
494      super.onwaiting(onwaiting);
495      return this;
496   }
497
498   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
499   public Script spellcheck(Object spellcheck) {
500      super.spellcheck(spellcheck);
501      return this;
502   }
503
504   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
505   public Script style(String style) {
506      super.style(style);
507      return this;
508   }
509
510   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
511   public Script tabindex(Object tabindex) {
512      super.tabindex(tabindex);
513      return this;
514   }
515
516   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
517   public Script title(String title) {
518      super.title(title);
519      return this;
520   }
521
522   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElement */
523   public Script translate(Object translate) {
524      super.translate(translate);
525      return this;
526   }
527
528   @Override /* GENERATED - org.apache.juneau.dto.html5.HtmlElementRawText */
529   public Script text(Object text) {
530      super.text(text);
531      return this;
532   }
533
534   // </FluentSetters>
535}