001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.juneau.bean.html5;
018
019import org.apache.juneau.annotation.*;
020
021/**
022 * DTO for an HTML <a class="doclink" href="https://www.w3.org/TR/html5/sections.html#the-body-element">&lt;body&gt;</a>
023 * element.
024 *
025 * <p>
026 * The body element represents the content of an HTML document. It contains all the visible content
027 * of the page, including text, images, links, forms, and other elements. The body element is
028 * typically the direct child of the html element and contains all the main content of the document.
029 *
030 * <h5 class='section'>Examples:</h5>
031 * <p class='bcode w800'>
032 *    <jc>// Simple body with text content</jc>
033 *    Body <jv>body1</jv> = <jsm>body</jsm>().text(<js>"Welcome to our website!"</js>);
034 *
035 *    <jc>// Body with structured content</jc>
036 *    Body <jv>body2</jv> = <jsm>body</jsm>()
037 *       .children(
038 *          <jsm>header</jsm>().children(
039 *             <jsm>h1</jsm>().text(<js>"Page Title"</js>)
040 *          ),
041 *          <jsm>main</jsm>().children(
042 *             <jsm>p</jsm>().text(<js>"Main content goes here."</js>)
043 *          ),
044 *          <jsm>footer</jsm>().text(<js>"Copyright 2024"</js>)
045 *       );
046 *
047 *    <jc>// Body with event handlers</jc>
048 *    Body <jv>body3</jv> = <jsm>body</jsm>()
049 *       .onload(<js>"initializePage()"</js>)
050 *       .onbeforeunload(<js>"return confirm('Are you sure you want to leave?')"</js>)
051 *       .text(<js>"Page content"</js>);
052 * </p>
053 *
054 * <p>
055 * The following convenience methods are provided for constructing instances of this bean:
056 * <ul class='javatree'>
057 *    <li class='jc'>{@link HtmlBuilder}
058 *    <ul class='javatree'>
059 *       <li class='jm'>{@link HtmlBuilder#body() body()}
060 *       <li class='jm'>{@link HtmlBuilder#body(Object...) body(Object...)}
061 *    </ul>
062 * </ul>
063 * </p>
064 *
065 * <h5 class='section'>See Also:</h5><ul>
066 *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanHtml5">juneau-bean-html5</a>
067 * </ul>
068 */
069@Bean(typeName = "body")
070public class Body extends HtmlElementMixed {
071
072   /**
073    * Creates an empty {@link Body} element.
074    */
075   public Body() {}
076
077   /**
078    * Creates a {@link Body} element with the specified child nodes.
079    *
080    * @param children The child nodes.
081    */
082   public Body(Object...children) {
083      children(children);
084   }
085
086   @Override /* Overridden from HtmlElement */
087   public Body _class(String value) { // NOSONAR - Intentional naming.
088      super._class(value);
089      return this;
090   }
091
092   @Override /* Overridden from HtmlElement */
093   public Body accesskey(String value) {
094      super.accesskey(value);
095      return this;
096   }
097
098   @Override /* Overridden from HtmlElement */
099   public Body attr(String key, Object val) {
100      super.attr(key, val);
101      return this;
102   }
103
104   @Override /* Overridden from HtmlElement */
105   public Body attrUri(String key, Object val) {
106      super.attrUri(key, val);
107      return this;
108   }
109
110   @Override /* Overridden from HtmlElementMixed */
111   public Body child(Object value) {
112      super.child(value);
113      return this;
114   }
115
116   @Override /* Overridden from HtmlElementMixed */
117   public Body children(Object...value) {
118      super.children(value);
119      return this;
120   }
121
122   @Override /* Overridden from HtmlElement */
123   public Body contenteditable(Object value) {
124      super.contenteditable(value);
125      return this;
126   }
127
128   @Override /* Overridden from HtmlElement */
129   public Body dir(String value) {
130      super.dir(value);
131      return this;
132   }
133
134   @Override /* Overridden from HtmlElement */
135   public Body hidden(Object value) {
136      super.hidden(value);
137      return this;
138   }
139
140   @Override /* Overridden from HtmlElement */
141   public Body id(String value) {
142      super.id(value);
143      return this;
144   }
145
146   @Override /* Overridden from HtmlElement */
147   public Body lang(String value) {
148      super.lang(value);
149      return this;
150   }
151
152   @Override /* Overridden from HtmlElement */
153   public Body onabort(String value) {
154      super.onabort(value);
155      return this;
156   }
157
158   /**
159    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-window-onafterprint">onafterprint</a>
160    * attribute.
161    *
162    * <p>
163    * Event handler for when the document has finished printing.
164    *
165    * @param value JavaScript code to execute when the afterprint event occurs.
166    * @return This object.
167    */
168   public Body onafterprint(String value) {
169      attr("onafterprint", value);
170      return this;
171   }
172
173   /**
174    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-window-onbeforeunload">onbeforeunload</a>
175    * attribute.
176    *
177    * <p>
178    * Event handler for when the document is about to be unloaded (page refresh, navigation, etc.).
179    *
180    * @param value JavaScript code to execute when the beforeunload event occurs.
181    * @return This object.
182    */
183   public Body onbeforeunload(String value) {
184      attr("onbeforeunload", value);
185      return this;
186   }
187
188   @Override /* Overridden from HtmlElement */
189   public Body onblur(String value) {
190      super.onblur(value);
191      return this;
192   }
193
194   @Override /* Overridden from HtmlElement */
195   public Body oncancel(String value) {
196      super.oncancel(value);
197      return this;
198   }
199
200   @Override /* Overridden from HtmlElement */
201   public Body oncanplay(String value) {
202      super.oncanplay(value);
203      return this;
204   }
205
206   @Override /* Overridden from HtmlElement */
207   public Body oncanplaythrough(String value) {
208      super.oncanplaythrough(value);
209      return this;
210   }
211
212   @Override /* Overridden from HtmlElement */
213   public Body onchange(String value) {
214      super.onchange(value);
215      return this;
216   }
217
218   @Override /* Overridden from HtmlElement */
219   public Body onclick(String value) {
220      super.onclick(value);
221      return this;
222   }
223
224   @Override /* Overridden from HtmlElement */
225   public Body oncuechange(String value) {
226      super.oncuechange(value);
227      return this;
228   }
229
230   @Override /* Overridden from HtmlElement */
231   public Body ondblclick(String value) {
232      super.ondblclick(value);
233      return this;
234   }
235
236   @Override /* Overridden from HtmlElement */
237   public Body ondurationchange(String value) {
238      super.ondurationchange(value);
239      return this;
240   }
241
242   @Override /* Overridden from HtmlElement */
243   public Body onemptied(String value) {
244      super.onemptied(value);
245      return this;
246   }
247
248   @Override /* Overridden from HtmlElement */
249   public Body onended(String value) {
250      super.onended(value);
251      return this;
252   }
253
254   @Override /* Overridden from HtmlElement */
255   public Body onerror(String value) {
256      super.onerror(value);
257      return this;
258   }
259
260   @Override /* Overridden from HtmlElement */
261   public Body onfocus(String value) {
262      super.onfocus(value);
263      return this;
264   }
265
266   @Override /* Overridden from HtmlElement */
267   public Body oninput(String value) {
268      super.oninput(value);
269      return this;
270   }
271
272   @Override /* Overridden from HtmlElement */
273   public Body oninvalid(String value) {
274      super.oninvalid(value);
275      return this;
276   }
277
278   @Override /* Overridden from HtmlElement */
279   public Body onkeydown(String value) {
280      super.onkeydown(value);
281      return this;
282   }
283
284   @Override /* Overridden from HtmlElement */
285   public Body onkeypress(String value) {
286      super.onkeypress(value);
287      return this;
288   }
289
290   @Override /* Overridden from HtmlElement */
291   public Body onkeyup(String value) {
292      super.onkeyup(value);
293      return this;
294   }
295
296   @Override /* Overridden from HtmlElement */
297   public Body onload(String value) {
298      super.onload(value);
299      return this;
300   }
301
302   @Override /* Overridden from HtmlElement */
303   public Body onloadeddata(String value) {
304      super.onloadeddata(value);
305      return this;
306   }
307
308   @Override /* Overridden from HtmlElement */
309   public Body onloadedmetadata(String value) {
310      super.onloadedmetadata(value);
311      return this;
312   }
313
314   @Override /* Overridden from HtmlElement */
315   public Body onloadstart(String value) {
316      super.onloadstart(value);
317      return this;
318   }
319
320   /**
321    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-window-onmessage">onmessage</a>
322    * attribute.
323    *
324    * <p>
325    * Event handler for when a message is received from another window or worker.
326    *
327    * @param value JavaScript code to execute when the message event occurs.
328    * @return This object.
329    */
330   public Body onmessage(String value) {
331      attr("onmessage", value);
332      return this;
333   }
334
335   @Override /* Overridden from HtmlElement */
336   public Body onmousedown(String value) {
337      super.onmousedown(value);
338      return this;
339   }
340
341   @Override /* Overridden from HtmlElement */
342   public Body onmouseenter(String value) {
343      super.onmouseenter(value);
344      return this;
345   }
346
347   @Override /* Overridden from HtmlElement */
348   public Body onmouseleave(String value) {
349      super.onmouseleave(value);
350      return this;
351   }
352
353   @Override /* Overridden from HtmlElement */
354   public Body onmousemove(String value) {
355      super.onmousemove(value);
356      return this;
357   }
358
359   @Override /* Overridden from HtmlElement */
360   public Body onmouseout(String value) {
361      super.onmouseout(value);
362      return this;
363   }
364
365   @Override /* Overridden from HtmlElement */
366   public Body onmouseover(String value) {
367      super.onmouseover(value);
368      return this;
369   }
370
371   @Override /* Overridden from HtmlElement */
372   public Body onmouseup(String value) {
373      super.onmouseup(value);
374      return this;
375   }
376
377   @Override /* Overridden from HtmlElement */
378   public Body onmousewheel(String value) {
379      super.onmousewheel(value);
380      return this;
381   }
382
383   /**
384    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-window-ononline">ononline</a>
385    * attribute.
386    *
387    * <p>
388    * Event handler for when the browser has gone online.
389    *
390    * @param value JavaScript code to execute when the online event occurs.
391    * @return This object.
392    */
393   public Body ononline(String value) {
394      attr("ononline", value);
395      return this;
396   }
397
398   /**
399    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-window-onpageshow">onpageshow</a>
400    * attribute.
401    *
402    * <p>
403    * Event handler for when the page is displayed (including when returning from back/forward cache).
404    *
405    * @param value JavaScript code to execute when the pageshow event occurs.
406    * @return This object.
407    */
408   public Body onpageshow(String value) {
409      attr("onpageshow", value);
410      return this;
411   }
412
413   @Override /* Overridden from HtmlElement */
414   public Body onpause(String value) {
415      super.onpause(value);
416      return this;
417   }
418
419   @Override /* Overridden from HtmlElement */
420   public Body onplay(String value) {
421      super.onplay(value);
422      return this;
423   }
424
425   @Override /* Overridden from HtmlElement */
426   public Body onplaying(String value) {
427      super.onplaying(value);
428      return this;
429   }
430
431   @Override /* Overridden from HtmlElement */
432   public Body onprogress(String value) {
433      super.onprogress(value);
434      return this;
435   }
436
437   @Override /* Overridden from HtmlElement */
438   public Body onratechange(String value) {
439      super.onratechange(value);
440      return this;
441   }
442
443   @Override /* Overridden from HtmlElement */
444   public Body onreset(String value) {
445      super.onreset(value);
446      return this;
447   }
448
449   @Override /* Overridden from HtmlElement */
450   public Body onresize(String value) {
451      super.onresize(value);
452      return this;
453   }
454
455   @Override /* Overridden from HtmlElement */
456   public Body onscroll(String value) {
457      super.onscroll(value);
458      return this;
459   }
460
461   @Override /* Overridden from HtmlElement */
462   public Body onseeked(String value) {
463      super.onseeked(value);
464      return this;
465   }
466
467   @Override /* Overridden from HtmlElement */
468   public Body onseeking(String value) {
469      super.onseeking(value);
470      return this;
471   }
472
473   @Override /* Overridden from HtmlElement */
474   public Body onselect(String value) {
475      super.onselect(value);
476      return this;
477   }
478
479   @Override /* Overridden from HtmlElement */
480   public Body onshow(String value) {
481      super.onshow(value);
482      return this;
483   }
484
485   @Override /* Overridden from HtmlElement */
486   public Body onstalled(String value) {
487      super.onstalled(value);
488      return this;
489   }
490
491   /**
492    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-window-onstorage">onstorage</a>
493    * attribute.
494    *
495    * <p>
496    * Event handler for when the storage area (localStorage or sessionStorage) is modified.
497    *
498    * @param value JavaScript code to execute when the storage event occurs.
499    * @return This object.
500    */
501   public Body onstorage(String value) {
502      attr("onstorage", value);
503      return this;
504   }
505
506   @Override /* Overridden from HtmlElement */
507   public Body onsubmit(String value) {
508      super.onsubmit(value);
509      return this;
510   }
511
512   @Override /* Overridden from HtmlElement */
513   public Body onsuspend(String value) {
514      super.onsuspend(value);
515      return this;
516   }
517
518   @Override /* Overridden from HtmlElement */
519   public Body ontimeupdate(String value) {
520      super.ontimeupdate(value);
521      return this;
522   }
523
524   @Override /* Overridden from HtmlElement */
525   public Body ontoggle(String value) {
526      super.ontoggle(value);
527      return this;
528   }
529
530   @Override /* Overridden from HtmlElement */
531   public Body onvolumechange(String value) {
532      super.onvolumechange(value);
533      return this;
534   }
535
536   @Override /* Overridden from HtmlElement */
537   public Body onwaiting(String value) {
538      super.onwaiting(value);
539      return this;
540   }
541
542   @Override /* Overridden from HtmlElement */
543   public Body spellcheck(Object value) {
544      super.spellcheck(value);
545      return this;
546   }
547
548   @Override /* Overridden from HtmlElement */
549   public Body style(String value) {
550      super.style(value);
551      return this;
552   }
553
554   @Override /* Overridden from HtmlElement */
555   public Body tabindex(Object value) {
556      super.tabindex(value);
557      return this;
558   }
559
560   @Override /* Overridden from HtmlElement */
561   public Body title(String value) {
562      super.title(value);
563      return this;
564   }
565
566   @Override /* Overridden from HtmlElement */
567   public Body translate(Object value) {
568      super.translate(value);
569      return this;
570   }
571}