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