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 java.net.*; 020 021import org.apache.juneau.*; 022import org.apache.juneau.annotation.*; 023 024/** 025 * DTO for an HTML <a class="doclink" href="https://www.w3.org/TR/html5/embedded-content-0.html#the-iframe-element"><iframe></a> 026 * element. 027 * 028 * <p> 029 * The iframe element represents a nested browsing context, embedding another HTML page into the 030 * current page. It is commonly used to embed external content such as videos, maps, or other 031 * web applications. The sandbox attribute can be used to restrict the capabilities of the 032 * embedded content for security purposes. 033 * 034 * <h5 class='section'>Examples:</h5> 035 * <p class='bcode w800'> 036 * <jk>import static</jk> org.apache.juneau.bean.html5.HtmlBuilder.*; 037 * 038 * <jc>// Simple iframe embedding external content</jc> 039 * Iframe <jv>iframe1</jv> = <jsm>iframe</jsm>() 040 * .src(<js>"https://example.com/embed"</js>) 041 * .width(<js>"800"</js>) 042 * .height(<js>"600"</js>); 043 * 044 * <jc>// Iframe with sandbox restrictions</jc> 045 * Iframe <jv>iframe2</jv> = <jsm>iframe</jsm>() 046 * .src(<js>"https://example.com/untrusted"</js>) 047 * .sandbox(<js>"allow-scripts allow-same-origin"</js>) 048 * .width(<js>"400"</js>) 049 * .height(<js>"300"</js>); 050 * 051 * <jc>// Iframe with inline content</jc> 052 * Iframe <jv>iframe3</jv> = <jsm>iframe</jsm>() 053 * .srcdoc(<js>"<h1>Inline Content</h1><p>This content is embedded directly.</p>"</js>) 054 * .width(<js>"500"</js>) 055 * .height(<js>"200"</js>); 056 * 057 * <jc>// Iframe with name for targeting</jc> 058 * Iframe <jv>iframe4</jv> = <jsm>iframe</jsm>() 059 * .name(<js>"contentFrame"</js>) 060 * .src(<js>"https://example.com/content"</js>) 061 * .width(<js>"100%"</js>) 062 * .height(<js>"400"</js>); 063 * </p> 064 * 065 * <p> 066 * The following convenience methods are provided for constructing instances of this bean: 067 * <ul class='javatree'> 068 * <li class='jc'>{@link HtmlBuilder} 069 * <ul class='javatree'> 070 * <li class='jm'>{@link HtmlBuilder#iframe() iframe()} 071 * <li class='jm'>{@link HtmlBuilder#iframe(Object...) iframe(Object...)} 072 * </ul> 073 * </ul> 074 * </p> 075 * 076 * <h5 class='section'>See Also:</h5><ul> 077 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanHtml5">juneau-bean-html5</a> 078 * </ul> 079 */ 080@Bean(typeName = "iframe") 081public class Iframe extends HtmlElementMixed { 082 083 /** 084 * Creates an empty {@link Iframe} element. 085 */ 086 public Iframe() {} 087 088 /** 089 * Creates an {@link Iframe} element with the specified child nodes. 090 * 091 * @param children The child nodes. 092 */ 093 public Iframe(Object...children) { 094 children(children); 095 } 096 097 @Override /* Overridden from HtmlElement */ 098 public Iframe _class(String value) { // NOSONAR - Intentional naming. 099 super._class(value); 100 return this; 101 } 102 103 @Override /* Overridden from HtmlElement */ 104 public Iframe accesskey(String value) { 105 super.accesskey(value); 106 return this; 107 } 108 109 @Override /* Overridden from HtmlElement */ 110 public Iframe attr(String key, Object val) { 111 super.attr(key, val); 112 return this; 113 } 114 115 @Override /* Overridden from HtmlElement */ 116 public Iframe attrUri(String key, Object val) { 117 super.attrUri(key, val); 118 return this; 119 } 120 121 @Override /* Overridden from HtmlElementMixed */ 122 public Iframe child(Object value) { 123 super.child(value); 124 return this; 125 } 126 127 @Override /* Overridden from HtmlElementMixed */ 128 public Iframe children(Object...value) { 129 super.children(value); 130 return this; 131 } 132 133 @Override /* Overridden from HtmlElement */ 134 public Iframe contenteditable(Object value) { 135 super.contenteditable(value); 136 return this; 137 } 138 139 @Override /* Overridden from HtmlElement */ 140 public Iframe dir(String value) { 141 super.dir(value); 142 return this; 143 } 144 145 /** 146 * <a class="doclink" href="https://www.w3.org/TR/html5/embedded-content-0.html#attr-dim-height">height</a> 147 * attribute. 148 * 149 * <p> 150 * Vertical dimension. 151 * 152 * @param value 153 * The new value for this attribute. 154 * Typically a {@link Number} or {@link String}. 155 * @return This object. 156 */ 157 public Iframe height(Object value) { 158 attr("height", value); 159 return this; 160 } 161 162 @Override /* Overridden from HtmlElement */ 163 public Iframe hidden(Object value) { 164 super.hidden(value); 165 return this; 166 } 167 168 @Override /* Overridden from HtmlElement */ 169 public Iframe id(String value) { 170 super.id(value); 171 return this; 172 } 173 174 @Override /* Overridden from HtmlElement */ 175 public Iframe lang(String value) { 176 super.lang(value); 177 return this; 178 } 179 180 /** 181 * <a class="doclink" href="https://www.w3.org/TR/html5/embedded-content-0.html#attr-iframe-name">name</a> attribute. 182 * 183 * <p> 184 * Specifies the name of the iframe. This name can be used as the target for links 185 * and forms, allowing content to be loaded into the iframe. 186 * 187 * <p> 188 * The name should be unique within the document. 189 * 190 * @param value The name of the iframe for targeting. 191 * @return This object. 192 */ 193 public Iframe name(String value) { 194 attr("name", value); 195 return this; 196 } 197 198 @Override /* Overridden from HtmlElement */ 199 public Iframe onabort(String value) { 200 super.onabort(value); 201 return this; 202 } 203 204 @Override /* Overridden from HtmlElement */ 205 public Iframe onblur(String value) { 206 super.onblur(value); 207 return this; 208 } 209 210 @Override /* Overridden from HtmlElement */ 211 public Iframe oncancel(String value) { 212 super.oncancel(value); 213 return this; 214 } 215 216 @Override /* Overridden from HtmlElement */ 217 public Iframe oncanplay(String value) { 218 super.oncanplay(value); 219 return this; 220 } 221 222 @Override /* Overridden from HtmlElement */ 223 public Iframe oncanplaythrough(String value) { 224 super.oncanplaythrough(value); 225 return this; 226 } 227 228 @Override /* Overridden from HtmlElement */ 229 public Iframe onchange(String value) { 230 super.onchange(value); 231 return this; 232 } 233 234 @Override /* Overridden from HtmlElement */ 235 public Iframe onclick(String value) { 236 super.onclick(value); 237 return this; 238 } 239 240 @Override /* Overridden from HtmlElement */ 241 public Iframe oncuechange(String value) { 242 super.oncuechange(value); 243 return this; 244 } 245 246 @Override /* Overridden from HtmlElement */ 247 public Iframe ondblclick(String value) { 248 super.ondblclick(value); 249 return this; 250 } 251 252 @Override /* Overridden from HtmlElement */ 253 public Iframe ondurationchange(String value) { 254 super.ondurationchange(value); 255 return this; 256 } 257 258 @Override /* Overridden from HtmlElement */ 259 public Iframe onemptied(String value) { 260 super.onemptied(value); 261 return this; 262 } 263 264 @Override /* Overridden from HtmlElement */ 265 public Iframe onended(String value) { 266 super.onended(value); 267 return this; 268 } 269 270 @Override /* Overridden from HtmlElement */ 271 public Iframe onerror(String value) { 272 super.onerror(value); 273 return this; 274 } 275 276 @Override /* Overridden from HtmlElement */ 277 public Iframe onfocus(String value) { 278 super.onfocus(value); 279 return this; 280 } 281 282 @Override /* Overridden from HtmlElement */ 283 public Iframe oninput(String value) { 284 super.oninput(value); 285 return this; 286 } 287 288 @Override /* Overridden from HtmlElement */ 289 public Iframe oninvalid(String value) { 290 super.oninvalid(value); 291 return this; 292 } 293 294 @Override /* Overridden from HtmlElement */ 295 public Iframe onkeydown(String value) { 296 super.onkeydown(value); 297 return this; 298 } 299 300 @Override /* Overridden from HtmlElement */ 301 public Iframe onkeypress(String value) { 302 super.onkeypress(value); 303 return this; 304 } 305 306 @Override /* Overridden from HtmlElement */ 307 public Iframe onkeyup(String value) { 308 super.onkeyup(value); 309 return this; 310 } 311 312 @Override /* Overridden from HtmlElement */ 313 public Iframe onload(String value) { 314 super.onload(value); 315 return this; 316 } 317 318 @Override /* Overridden from HtmlElement */ 319 public Iframe onloadeddata(String value) { 320 super.onloadeddata(value); 321 return this; 322 } 323 324 @Override /* Overridden from HtmlElement */ 325 public Iframe onloadedmetadata(String value) { 326 super.onloadedmetadata(value); 327 return this; 328 } 329 330 @Override /* Overridden from HtmlElement */ 331 public Iframe onloadstart(String value) { 332 super.onloadstart(value); 333 return this; 334 } 335 336 @Override /* Overridden from HtmlElement */ 337 public Iframe onmousedown(String value) { 338 super.onmousedown(value); 339 return this; 340 } 341 342 @Override /* Overridden from HtmlElement */ 343 public Iframe onmouseenter(String value) { 344 super.onmouseenter(value); 345 return this; 346 } 347 348 @Override /* Overridden from HtmlElement */ 349 public Iframe onmouseleave(String value) { 350 super.onmouseleave(value); 351 return this; 352 } 353 354 @Override /* Overridden from HtmlElement */ 355 public Iframe onmousemove(String value) { 356 super.onmousemove(value); 357 return this; 358 } 359 360 @Override /* Overridden from HtmlElement */ 361 public Iframe onmouseout(String value) { 362 super.onmouseout(value); 363 return this; 364 } 365 366 @Override /* Overridden from HtmlElement */ 367 public Iframe onmouseover(String value) { 368 super.onmouseover(value); 369 return this; 370 } 371 372 @Override /* Overridden from HtmlElement */ 373 public Iframe onmouseup(String value) { 374 super.onmouseup(value); 375 return this; 376 } 377 378 @Override /* Overridden from HtmlElement */ 379 public Iframe onmousewheel(String value) { 380 super.onmousewheel(value); 381 return this; 382 } 383 384 @Override /* Overridden from HtmlElement */ 385 public Iframe onpause(String value) { 386 super.onpause(value); 387 return this; 388 } 389 390 @Override /* Overridden from HtmlElement */ 391 public Iframe onplay(String value) { 392 super.onplay(value); 393 return this; 394 } 395 396 @Override /* Overridden from HtmlElement */ 397 public Iframe onplaying(String value) { 398 super.onplaying(value); 399 return this; 400 } 401 402 @Override /* Overridden from HtmlElement */ 403 public Iframe onprogress(String value) { 404 super.onprogress(value); 405 return this; 406 } 407 408 @Override /* Overridden from HtmlElement */ 409 public Iframe onratechange(String value) { 410 super.onratechange(value); 411 return this; 412 } 413 414 @Override /* Overridden from HtmlElement */ 415 public Iframe onreset(String value) { 416 super.onreset(value); 417 return this; 418 } 419 420 @Override /* Overridden from HtmlElement */ 421 public Iframe onresize(String value) { 422 super.onresize(value); 423 return this; 424 } 425 426 @Override /* Overridden from HtmlElement */ 427 public Iframe onscroll(String value) { 428 super.onscroll(value); 429 return this; 430 } 431 432 @Override /* Overridden from HtmlElement */ 433 public Iframe onseeked(String value) { 434 super.onseeked(value); 435 return this; 436 } 437 438 @Override /* Overridden from HtmlElement */ 439 public Iframe onseeking(String value) { 440 super.onseeking(value); 441 return this; 442 } 443 444 @Override /* Overridden from HtmlElement */ 445 public Iframe onselect(String value) { 446 super.onselect(value); 447 return this; 448 } 449 450 @Override /* Overridden from HtmlElement */ 451 public Iframe onshow(String value) { 452 super.onshow(value); 453 return this; 454 } 455 456 @Override /* Overridden from HtmlElement */ 457 public Iframe onstalled(String value) { 458 super.onstalled(value); 459 return this; 460 } 461 462 @Override /* Overridden from HtmlElement */ 463 public Iframe onsubmit(String value) { 464 super.onsubmit(value); 465 return this; 466 } 467 468 @Override /* Overridden from HtmlElement */ 469 public Iframe onsuspend(String value) { 470 super.onsuspend(value); 471 return this; 472 } 473 474 @Override /* Overridden from HtmlElement */ 475 public Iframe ontimeupdate(String value) { 476 super.ontimeupdate(value); 477 return this; 478 } 479 480 @Override /* Overridden from HtmlElement */ 481 public Iframe ontoggle(String value) { 482 super.ontoggle(value); 483 return this; 484 } 485 486 @Override /* Overridden from HtmlElement */ 487 public Iframe onvolumechange(String value) { 488 super.onvolumechange(value); 489 return this; 490 } 491 492 @Override /* Overridden from HtmlElement */ 493 public Iframe onwaiting(String value) { 494 super.onwaiting(value); 495 return this; 496 } 497 498 /** 499 * <a class="doclink" href="https://www.w3.org/TR/html5/embedded-content-0.html#attr-iframe-sandbox">sandbox</a> 500 * attribute. 501 * 502 * <p> 503 * Specifies security restrictions for the iframe content. Multiple restrictions can be 504 * specified as a space-separated list. 505 * 506 * <p> 507 * Common values: 508 * <ul> 509 * <li><js>"allow-scripts"</js> - Allow JavaScript execution</li> 510 * <li><js>"allow-same-origin"</js> - Allow same-origin requests</li> 511 * <li><js>"allow-forms"</js> - Allow form submission</li> 512 * <li><js>"allow-popups"</js> - Allow popup windows</li> 513 * <li><js>"allow-top-navigation"</js> - Allow navigation of top-level browsing context</li> 514 * </ul> 515 * 516 * @param value Security restrictions for the iframe content. 517 * @return This object. 518 */ 519 public Iframe sandbox(String value) { 520 attr("sandbox", value); 521 return this; 522 } 523 524 @Override /* Overridden from HtmlElement */ 525 public Iframe spellcheck(Object value) { 526 super.spellcheck(value); 527 return this; 528 } 529 530 /** 531 * <a class="doclink" href="https://www.w3.org/TR/html5/embedded-content-0.html#attr-iframe-src">src</a> attribute. 532 * 533 * <p> 534 * Address of the resource. 535 * 536 * <p> 537 * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}. 538 * Strings must be valid URIs. 539 * 540 * <p> 541 * URIs defined by {@link UriResolver} can be used for values. 542 * 543 * @param value 544 * The new value for this attribute. 545 * Typically a {@link URL} or {@link String}. 546 * @return This object. 547 */ 548 public Iframe src(Object value) { 549 attrUri("src", value); 550 return this; 551 } 552 553 /** 554 * <a class="doclink" href="https://www.w3.org/TR/html5/embedded-content-0.html#attr-iframe-srcdoc">srcdoc</a> 555 * attribute. 556 * 557 * <p> 558 * Specifies the HTML content to be displayed in the iframe. This content is rendered 559 * directly within the iframe without requiring a separate HTTP request. 560 * 561 * <p> 562 * The content should be valid HTML that will be displayed in the iframe. 563 * 564 * @param value The HTML content to display in the iframe. 565 * @return This object. 566 */ 567 public Iframe srcdoc(String value) { 568 attr("srcdoc", value); 569 return this; 570 } 571 572 @Override /* Overridden from HtmlElement */ 573 public Iframe style(String value) { 574 super.style(value); 575 return this; 576 } 577 578 @Override /* Overridden from HtmlElement */ 579 public Iframe tabindex(Object value) { 580 super.tabindex(value); 581 return this; 582 } 583 584 @Override /* Overridden from HtmlElement */ 585 public Iframe title(String value) { 586 super.title(value); 587 return this; 588 } 589 590 @Override /* Overridden from HtmlElement */ 591 public Iframe translate(Object value) { 592 super.translate(value); 593 return this; 594 } 595 596 /** 597 * <a class="doclink" href="https://www.w3.org/TR/html5/embedded-content-0.html#attr-dim-width">width</a> attribute. 598 * 599 * <p> 600 * Horizontal dimension. 601 * 602 * @param value 603 * The new value for this attribute. 604 * Typically a {@link Number} or {@link String}. 605 * @return This object. 606 */ 607 public Iframe width(Object value) { 608 attr("width", value); 609 return this; 610 } 611}