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.html.annotation.HtmlFormat.*; 016import static org.apache.juneau.internal.CollectionUtils.*; 017import static org.apache.juneau.xml.annotation.XmlFormat.*; 018 019import java.net.*; 020import java.util.*; 021 022import org.apache.juneau.*; 023import org.apache.juneau.annotation.*; 024import org.apache.juneau.common.internal.*; 025import org.apache.juneau.html.*; 026import org.apache.juneau.internal.*; 027import org.apache.juneau.xml.annotation.*; 028 029/** 030 * Superclass for all HTML elements. 031 * 032 * <p> 033 * These are beans that when serialized using {@link HtmlSerializer} generate valid HTML5 elements. 034 * 035 * <h5 class='section'>See Also:</h5><ul> 036 * <li class='link'><a class="doclink" href="../../../../../index.html#jd.Html5">Overview > juneau-dto > HTML5</a> 037 038 * </ul> 039 */ 040@org.apache.juneau.html.annotation.Html(format=XML) 041@FluentSetters 042public abstract class HtmlElement { 043 044 private LinkedHashMap<String,Object> attrs; 045 046 /** 047 * The attributes of this element. 048 * 049 * @return The attributes of this element. 050 */ 051 @Xml(format=ATTRS) 052 @Beanp("a") 053 public LinkedHashMap<String,Object> getAttrs() { 054 return attrs; 055 } 056 057 /** 058 * Sets the attributes for this element. 059 * 060 * @param attrs The new attributes for this element. 061 * @return This object. 062 */ 063 @Beanp("a") 064 public HtmlElement setAttrs(LinkedHashMap<String,Object> attrs) { 065 if (attrs != null) { 066 attrs.entrySet().forEach(x -> { 067 String key = x.getKey(); 068 if ("url".equals(key) || "href".equals(key) || key.endsWith("action")) 069 x.setValue(StringUtils.toURI(x.getValue())); 070 }); 071 } 072 this.attrs = attrs; 073 return this; 074 } 075 076 /** 077 * Adds an arbitrary attribute to this element. 078 * 079 * @param key The attribute name. 080 * @param val The attribute value. 081 * @return This object. 082 */ 083 public HtmlElement attr(String key, Object val) { 084 if (attrs == null) 085 attrs = map(); 086 if (val == null) 087 attrs.remove(key); 088 else { 089 if ("url".equals(key) || "href".equals(key) || key.endsWith("action")) 090 val = StringUtils.toURI(val); 091 attrs.put(key, val); 092 } 093 return this; 094 } 095 096 /** 097 * Adds an arbitrary URI attribute to this element. 098 * 099 * <p> 100 * Same as {@link #attr(String, Object)}, except if the value is a string that appears to be a URI 101 * (e.g. <js>"servlet:/xxx"</js>). 102 * 103 * <p> 104 * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}. 105 * Strings must be valid URIs. 106 * 107 * <p> 108 * URIs defined by {@link UriResolver} can be used for values. 109 * 110 * @param key The attribute name. 111 * @param val The attribute value. 112 * @return This object. 113 */ 114 public HtmlElement attrUri(String key, Object val) { 115 if (attrs == null) 116 attrs = map(); 117 attrs.put(key, StringUtils.toURI(val)); 118 return this; 119 } 120 121 /** 122 * Returns the attribute with the specified name. 123 * 124 * @param key The attribute name. 125 * @return The attribute value, or <jk>null</jk> if the named attribute does not exist. 126 */ 127 public String getAttr(String key) { 128 return getAttr(String.class, key); 129 } 130 131 /** 132 * Returns the attribute with the specified name converted to the specified class type. 133 * 134 * @param <T> The class type to convert this class to. 135 * @param type 136 * The class type to convert this class to. 137 * See {@link ConverterUtils} for a list of supported conversion types. 138 * @param key The attribute name. 139 * @return The attribute value, or <jk>null</jk> if the named attribute does not exist. 140 */ 141 public <T> T getAttr(Class<T> type, String key) { 142 return attrs == null ? null : ConverterUtils.toType(attrs.get(key), type); 143 } 144 145 /** 146 * <a class="doclink" href="https://www.w3.org/TR/html5/editing.html#the-accesskey-attribute">accesskey</a> 147 * attribute. 148 * 149 * @param accesskey The new value for this attribute. 150 * @return This object. 151 */ 152 @FluentSetter 153 public HtmlElement accesskey(String accesskey) { 154 attr("accesskey", accesskey); 155 return this; 156 } 157 158 /** 159 * <a class="doclink" href="https://www.w3.org/TR/html5/dom.html#classes">class</a> attribute. 160 * 161 * @param _class The new value for this attribute. 162 * @return This object. 163 */ 164 @FluentSetter 165 public HtmlElement _class(String _class) { 166 attr("class", _class); 167 return this; 168 } 169 170 /** 171 * <a class="doclink" href="https://www.w3.org/TR/html5/editing.html#attr-contenteditable">contenteditable</a> 172 * attribute. 173 * 174 * @param contenteditable The new value for this attribute. 175 * Typically a {@link Boolean} or {@link String}. 176 * @return This object. 177 */ 178 @FluentSetter 179 public HtmlElement contenteditable(Object contenteditable) { 180 attr("contenteditable", contenteditable); 181 return this; 182 } 183 184 /** 185 * <a class="doclink" href="https://www.w3.org/TR/html5/dom.html#the-dir-attribute">dir</a> attribute. 186 * 187 * @param dir The new value for this attribute. 188 * @return This object. 189 */ 190 @FluentSetter 191 public HtmlElement dir(String dir) { 192 attr("dir", dir); 193 return this; 194 } 195 196 /** 197 * <a class="doclink" href="https://www.w3.org/TR/html5/editing.html#the-hidden-attribute">hidden</a> attribute. 198 * 199 * @param hidden 200 * The new value for this attribute. 201 * Typically a {@link Boolean} or {@link String}. 202 * @return This object. 203 */ 204 @FluentSetter 205 public HtmlElement hidden(Object hidden) { 206 attr("hidden", deminimize(hidden, "hidden")); 207 return this; 208 } 209 210 /** 211 * <a class="doclink" href="https://www.w3.org/TR/html5/dom.html#the-id-attribute">id</a> attribute. 212 * 213 * @param id The new value for this attribute. 214 * @return This object. 215 */ 216 @FluentSetter 217 public HtmlElement id(String id) { 218 attr("id", id); 219 return this; 220 } 221 222 /** 223 * <a class="doclink" href="https://www.w3.org/TR/html5/dom.html#attr-lang">lang</a> attribute. 224 * 225 * @param lang The new value for this attribute. 226 * @return This object. 227 */ 228 @FluentSetter 229 public HtmlElement lang(String lang) { 230 attr("lang", lang); 231 return this; 232 } 233 234 /** 235 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onabort">onabort</a> attribute. 236 * 237 * @param onabort The new value for this attribute. 238 * @return This object. 239 */ 240 @FluentSetter 241 public HtmlElement onabort(String onabort) { 242 attr("onabort", onabort); 243 return this; 244 } 245 246 /** 247 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onblur">onblur</a> attribute. 248 * 249 * @param onblur The new value for this attribute. 250 * @return This object. 251 */ 252 @FluentSetter 253 public HtmlElement onblur(String onblur) { 254 attr("onblur", onblur); 255 return this; 256 } 257 258 /** 259 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-oncancel">oncancel</a> attribute. 260 * 261 * @param oncancel The new value for this attribute. 262 * @return This object. 263 */ 264 @FluentSetter 265 public HtmlElement oncancel(String oncancel) { 266 attr("oncancel", oncancel); 267 return this; 268 } 269 270 /** 271 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-oncanplay">oncanplay</a> attribute. 272 * 273 * @param oncanplay The new value for this attribute. 274 * @return This object. 275 */ 276 @FluentSetter 277 public HtmlElement oncanplay(String oncanplay) { 278 attr("oncanplay", oncanplay); 279 return this; 280 } 281 282 /** 283 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-oncanplaythrough">oncanplaythrough</a> 284 * attribute. 285 * 286 * @param oncanplaythrough The new value for this attribute. 287 * @return This object. 288 */ 289 @FluentSetter 290 public HtmlElement oncanplaythrough(String oncanplaythrough) { 291 attr("oncanplaythrough", oncanplaythrough); 292 return this; 293 } 294 295 /** 296 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onchange">onchange</a> attribute. 297 * 298 * @param onchange The new value for this attribute. 299 * @return This object. 300 */ 301 @FluentSetter 302 public HtmlElement onchange(String onchange) { 303 attr("onchange", onchange); 304 return this; 305 } 306 307 /** 308 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onclick">onclick</a> attribute. 309 * 310 * @param onclick The new value for this attribute. 311 * @return This object. 312 */ 313 @FluentSetter 314 public HtmlElement onclick(String onclick) { 315 attr("onclick", onclick); 316 return this; 317 } 318 319 /** 320 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-oncuechange">oncuechange</a> 321 * attribute. 322 * 323 * @param oncuechange The new value for this attribute. 324 * @return This object. 325 */ 326 @FluentSetter 327 public HtmlElement oncuechange(String oncuechange) { 328 attr("oncuechange", oncuechange); 329 return this; 330 } 331 332 /** 333 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-ondblclick">ondblclick</a> attribute. 334 * 335 * @param ondblclick The new value for this attribute. 336 * @return This object. 337 */ 338 @FluentSetter 339 public HtmlElement ondblclick(String ondblclick) { 340 attr("ondblclick", ondblclick); 341 return this; 342 } 343 344 /** 345 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-ondurationchange">ondurationchange</a> 346 * attribute. 347 * 348 * @param ondurationchange The new value for this attribute. 349 * @return This object. 350 */ 351 @FluentSetter 352 public HtmlElement ondurationchange(String ondurationchange) { 353 attr("ondurationchange", ondurationchange); 354 return this; 355 } 356 357 /** 358 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onemptied">onemptied</a> attribute. 359 * 360 * @param onemptied The new value for this attribute. 361 * @return This object. 362 */ 363 @FluentSetter 364 public HtmlElement onemptied(String onemptied) { 365 attr("onemptied", onemptied); 366 return this; 367 } 368 369 /** 370 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onended">onended</a> attribute. 371 * 372 * @param onended The new value for this attribute. 373 * @return This object. 374 */ 375 @FluentSetter 376 public HtmlElement onended(String onended) { 377 attr("onended", onended); 378 return this; 379 } 380 381 /** 382 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onerror">onerror</a> attribute. 383 * 384 * @param onerror The new value for this attribute. 385 * @return This object. 386 */ 387 @FluentSetter 388 public HtmlElement onerror(String onerror) { 389 attr("onerror", onerror); 390 return this; 391 } 392 393 /** 394 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onfocus">onfocus</a> attribute. 395 * 396 * @param onfocus The new value for this attribute. 397 * @return This object. 398 */ 399 @FluentSetter 400 public HtmlElement onfocus(String onfocus) { 401 attr("onfocus", onfocus); 402 return this; 403 } 404 405 /** 406 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-oninput">oninput</a> attribute. 407 * 408 * @param oninput The new value for this attribute. 409 * @return This object. 410 */ 411 @FluentSetter 412 public HtmlElement oninput(String oninput) { 413 attr("oninput", oninput); 414 return this; 415 } 416 417 /** 418 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-oninvalid">oninvalid</a> attribute. 419 * 420 * @param oninvalid The new value for this attribute. 421 * @return This object. 422 */ 423 @FluentSetter 424 public HtmlElement oninvalid(String oninvalid) { 425 attr("oninvalid", oninvalid); 426 return this; 427 } 428 429 /** 430 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onkeydown">onkeydown</a> attribute. 431 * 432 * @param onkeydown The new value for this attribute. 433 * @return This object. 434 */ 435 @FluentSetter 436 public HtmlElement onkeydown(String onkeydown) { 437 attr("onkeydown", onkeydown); 438 return this; 439 } 440 441 /** 442 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onkeypress">onkeypress</a> attribute. 443 * 444 * @param onkeypress The new value for this attribute. 445 * @return This object. 446 */ 447 @FluentSetter 448 public HtmlElement onkeypress(String onkeypress) { 449 attr("onkeypress", onkeypress); 450 return this; 451 } 452 453 /** 454 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onkeyup">onkeyup</a> attribute. 455 * 456 * @param onkeyup The new value for this attribute. 457 * @return This object. 458 */ 459 @FluentSetter 460 public HtmlElement onkeyup(String onkeyup) { 461 attr("onkeyup", onkeyup); 462 return this; 463 } 464 465 /** 466 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onload">onload</a> attribute. 467 * 468 * @param onload The new value for this attribute. 469 * @return This object. 470 */ 471 @FluentSetter 472 public HtmlElement onload(String onload) { 473 attr("onload", onload); 474 return this; 475 } 476 477 /** 478 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onloadeddata">onloadeddata</a> 479 * attribute. 480 * 481 * @param onloadeddata The new value for this attribute. 482 * @return This object. 483 */ 484 @FluentSetter 485 public HtmlElement onloadeddata(String onloadeddata) { 486 attr("onloadeddata", onloadeddata); 487 return this; 488 } 489 490 /** 491 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onloadedmetadata">onloadedmetadata</a> 492 * attribute. 493 * 494 * @param onloadedmetadata The new value for this attribute. 495 * @return This object. 496 */ 497 @FluentSetter 498 public HtmlElement onloadedmetadata(String onloadedmetadata) { 499 attr("onloadedmetadata", onloadedmetadata); 500 return this; 501 } 502 503 /** 504 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onloadstart">onloadstart</a> 505 * attribute. 506 * 507 * @param onloadstart The new value for this attribute. 508 * @return This object. 509 */ 510 @FluentSetter 511 public HtmlElement onloadstart(String onloadstart) { 512 attr("onloadstart", onloadstart); 513 return this; 514 } 515 516 /** 517 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onmousedown">onmousedown</a> 518 * attribute. 519 * 520 * @param onmousedown The new value for this attribute. 521 * @return This object. 522 */ 523 @FluentSetter 524 public HtmlElement onmousedown(String onmousedown) { 525 attr("onmousedown", onmousedown); 526 return this; 527 } 528 529 /** 530 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onmouseenter">onmouseenter</a> attribute. 531 * 532 * @param onmouseenter The new value for this attribute. 533 * @return This object. 534 */ 535 @FluentSetter 536 public HtmlElement onmouseenter(String onmouseenter) { 537 attr("onmouseenter", onmouseenter); 538 return this; 539 } 540 541 /** 542 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onmouseleave">onmouseleave</a> 543 * attribute. 544 * 545 * @param onmouseleave The new value for this attribute. 546 * @return This object. 547 */ 548 @FluentSetter 549 public HtmlElement onmouseleave(String onmouseleave) { 550 attr("onmouseleave", onmouseleave); 551 return this; 552 } 553 554 /** 555 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onmousemove">onmousemove</a> 556 * attribute. 557 * 558 * @param onmousemove The new value for this attribute. 559 * @return This object. 560 */ 561 @FluentSetter 562 public HtmlElement onmousemove(String onmousemove) { 563 attr("onmousemove", onmousemove); 564 return this; 565 } 566 567 /** 568 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onmouseout">onmouseout</a> attribute. 569 * 570 * @param onmouseout The new value for this attribute. 571 * @return This object. 572 */ 573 @FluentSetter 574 public HtmlElement onmouseout(String onmouseout) { 575 attr("onmouseout", onmouseout); 576 return this; 577 } 578 579 /** 580 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onmouseover">onmouseover</a> 581 * attribute. 582 * 583 * @param onmouseover The new value for this attribute. 584 * @return This object. 585 */ 586 @FluentSetter 587 public HtmlElement onmouseover(String onmouseover) { 588 attr("onmouseover", onmouseover); 589 return this; 590 } 591 592 /** 593 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onmouseup">onmouseup</a> attribute. 594 * 595 * @param onmouseup The new value for this attribute. 596 * @return This object. 597 */ 598 @FluentSetter 599 public HtmlElement onmouseup(String onmouseup) { 600 attr("onmouseup", onmouseup); 601 return this; 602 } 603 604 /** 605 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onmousewheel">onmousewheel</a> 606 * attribute. 607 * 608 * @param onmousewheel The new value for this attribute. 609 * @return This object. 610 */ 611 @FluentSetter 612 public HtmlElement onmousewheel(String onmousewheel) { 613 attr("onmousewheel", onmousewheel); 614 return this; 615 } 616 617 /** 618 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onpause">onpause</a> attribute. 619 * 620 * @param onpause The new value for this attribute. 621 * @return This object. 622 */ 623 @FluentSetter 624 public HtmlElement onpause(String onpause) { 625 attr("onpause", onpause); 626 return this; 627 } 628 629 /** 630 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onplay">onplay</a> attribute. 631 * 632 * @param onplay The new value for this attribute. 633 * @return This object. 634 */ 635 @FluentSetter 636 public HtmlElement onplay(String onplay) { 637 attr("onplay", onplay); 638 return this; 639 } 640 641 /** 642 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onplaying">onplaying</a> attribute. 643 * 644 * @param onplaying The new value for this attribute. 645 * @return This object. 646 */ 647 @FluentSetter 648 public HtmlElement onplaying(String onplaying) { 649 attr("onplaying", onplaying); 650 return this; 651 } 652 653 /** 654 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onprogress">onprogress</a> attribute. 655 * 656 * @param onprogress The new value for this attribute. 657 * @return This object. 658 */ 659 @FluentSetter 660 public HtmlElement onprogress(String onprogress) { 661 attr("onprogress", onprogress); 662 return this; 663 } 664 665 /** 666 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onratechange">onratechange</a> 667 * attribute. 668 * 669 * @param onratechange The new value for this attribute. 670 * @return This object. 671 */ 672 @FluentSetter 673 public HtmlElement onratechange(String onratechange) { 674 attr("onratechange", onratechange); 675 return this; 676 } 677 678 /** 679 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onreset">onreset</a> attribute. 680 * 681 * @param onreset The new value for this attribute. 682 * @return This object. 683 */ 684 @FluentSetter 685 public HtmlElement onreset(String onreset) { 686 attr("onreset", onreset); 687 return this; 688 } 689 690 /** 691 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onresize">onresize</a> attribute. 692 * 693 * @param onresize The new value for this attribute. 694 * @return This object. 695 */ 696 @FluentSetter 697 public HtmlElement onresize(String onresize) { 698 attr("onresize", onresize); 699 return this; 700 } 701 702 /** 703 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onscroll">onscroll</a> attribute. 704 * 705 * @param onscroll The new value for this attribute. 706 * @return This object. 707 */ 708 @FluentSetter 709 public HtmlElement onscroll(String onscroll) { 710 attr("onscroll", onscroll); 711 return this; 712 } 713 714 /** 715 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onseeked">onseeked</a> attribute. 716 * 717 * @param onseeked The new value for this attribute. 718 * @return This object. 719 */ 720 @FluentSetter 721 public HtmlElement onseeked(String onseeked) { 722 attr("onseeked", onseeked); 723 return this; 724 } 725 726 /** 727 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onseeking">onseeking</a> attribute. 728 * 729 * @param onseeking The new value for this attribute. 730 * @return This object. 731 */ 732 @FluentSetter 733 public HtmlElement onseeking(String onseeking) { 734 attr("onseeking", onseeking); 735 return this; 736 } 737 738 /** 739 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onselect">onselect</a> attribute. 740 * 741 * @param onselect The new value for this attribute. 742 * @return This object. 743 */ 744 @FluentSetter 745 public HtmlElement onselect(String onselect) { 746 attr("onselect", onselect); 747 return this; 748 } 749 750 /** 751 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onshow">onshow</a> attribute. 752 * 753 * @param onshow The new value for this attribute. 754 * @return This object. 755 */ 756 @FluentSetter 757 public HtmlElement onshow(String onshow) { 758 attr("onshow", onshow); 759 return this; 760 } 761 762 /** 763 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onstalled">onstalled</a> attribute. 764 * 765 * @param onstalled The new value for this attribute. 766 * @return This object. 767 */ 768 @FluentSetter 769 public HtmlElement onstalled(String onstalled) { 770 attr("onstalled", onstalled); 771 return this; 772 } 773 774 /** 775 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onsubmit">onsubmit</a> attribute. 776 * 777 * @param onsubmit The new value for this attribute. 778 * @return This object. 779 */ 780 @FluentSetter 781 public HtmlElement onsubmit(String onsubmit) { 782 attr("onsubmit", onsubmit); 783 return this; 784 } 785 786 /** 787 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onsuspend">onsuspend</a> attribute. 788 * 789 * @param onsuspend The new value for this attribute. 790 * @return This object. 791 */ 792 @FluentSetter 793 public HtmlElement onsuspend(String onsuspend) { 794 attr("onsuspend", onsuspend); 795 return this; 796 } 797 798 /** 799 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-ontimeupdate">ontimeupdate</a> 800 * attribute. 801 * 802 * @param ontimeupdate The new value for this attribute. 803 * @return This object. 804 */ 805 @FluentSetter 806 public HtmlElement ontimeupdate(String ontimeupdate) { 807 attr("ontimeupdate", ontimeupdate); 808 return this; 809 } 810 811 /** 812 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-ontoggle">ontoggle</a> attribute. 813 * 814 * @param ontoggle The new value for this attribute. 815 * @return This object. 816 */ 817 @FluentSetter 818 public HtmlElement ontoggle(String ontoggle) { 819 attr("ontoggle", ontoggle); 820 return this; 821 } 822 823 /** 824 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onvolumechange">onvolumechange</a> 825 * attribute. 826 * 827 * @param onvolumechange The new value for this attribute. 828 * @return This object. 829 */ 830 @FluentSetter 831 public HtmlElement onvolumechange(String onvolumechange) { 832 attr("onvolumechange", onvolumechange); 833 return this; 834 } 835 836 /** 837 * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onwaiting">onwaiting</a> attribute. 838 * 839 * @param onwaiting The new value for this attribute. 840 * @return This object. 841 */ 842 @FluentSetter 843 public HtmlElement onwaiting(String onwaiting) { 844 attr("onwaiting", onwaiting); 845 return this; 846 } 847 848 /** 849 * <a class="doclink" href="https://www.w3.org/TR/html5/editing.html#attr-spellcheck">spellcheck</a> attribute. 850 * 851 * @param spellcheck 852 * The new value for this attribute. 853 * Typically a {@link Boolean} or {@link String}. 854 * @return This object. 855 */ 856 @FluentSetter 857 public HtmlElement spellcheck(Object spellcheck) { 858 attr("spellcheck", spellcheck); 859 return this; 860 } 861 862 /** 863 * <a class="doclink" href="https://www.w3.org/TR/html5/dom.html#the-style-attribute">style</a> attribute. 864 * 865 * @param style The new value for this attribute. 866 * @return This object. 867 */ 868 @FluentSetter 869 public HtmlElement style(String style) { 870 attr("style", style); 871 return this; 872 } 873 874 /** 875 * <a class="doclink" href="https://www.w3.org/TR/html5/editing.html#attr-tabindex">tabindex</a> attribute. 876 * 877 * @param tabindex 878 * The new value for this attribute. 879 * Typically a {@link Number} or {@link String}. 880 * @return This object. 881 */ 882 @FluentSetter 883 public HtmlElement tabindex(Object tabindex) { 884 attr("tabindex", tabindex); 885 return this; 886 } 887 888 /** 889 * <a class="doclink" href="https://www.w3.org/TR/html5/dom.html#attr-title">title</a> attribute. 890 * 891 * @param title The new value for this attribute. 892 * @return This object. 893 */ 894 @FluentSetter 895 public HtmlElement title(String title) { 896 attr("title", title); 897 return this; 898 } 899 900 /** 901 * <a class="doclink" href="https://www.w3.org/TR/html5/dom.html#attr-translate">translate</a> attribute. 902 * 903 * @param translate 904 * The new value for this attribute. 905 * Typically a {@link Number} or {@link String}. 906 * @return This object. 907 */ 908 @FluentSetter 909 public HtmlElement translate(Object translate) { 910 attr("translate", translate); 911 return this; 912 } 913 914 /** 915 * If the specified attribute is a boolean, it gets converted to the attribute name if <jk>true</jk> or <jk>null</jk> if <jk>false</jk>. 916 * 917 * @param value The attribute value. 918 * @param attr The attribute name. 919 * @return The deminimized value, or the same value if the value wasn't a boolean. 920 */ 921 protected Object deminimize(Object value, String attr) { 922 if (value instanceof Boolean) { 923 if ((Boolean)value) 924 return attr; 925 return null; 926 } 927 return value; 928 } 929 930 // <FluentSetters> 931 932 // </FluentSetters> 933 934 @Override /* Object */ 935 public String toString() { 936 return HtmlSerializer.DEFAULT_SQ.toString(this); 937 } 938}