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 java.net.*; 016import java.net.URI; 017 018import org.apache.juneau.*; 019import org.apache.juneau.annotation.*; 020 021/** 022 * DTO for an HTML <a class="doclink" href="https://www.w3.org/TR/html5/embedded-content-0.html#the-img-element"><img></a> 023 * element. 024 * 025 * <h5 class='section'>See Also:</h5> 026 * <ul class='doctree'> 027 * <li class='link'><a class='doclink' href='../../../../../overview-summary.html#juneau-dto.HTML5'>Overview > juneau-dto > HTML5</a> 028 * </ul> 029 */ 030@Bean(typeName="img") 031public class Img extends HtmlElementVoid { 032 033 /** 034 * <a class="doclink" href="https://www.w3.org/TR/html5/embedded-content-0.html#attr-img-alt">alt</a> attribute. 035 * 036 * <p> 037 * Replacement text for use when images are not available. 038 * 039 * @param alt The new value for this attribute. 040 * @return This object (for method chaining). 041 */ 042 public final Img alt(String alt) { 043 attr("alt", alt); 044 return this; 045 } 046 047 /** 048 * <a class="doclink" href="https://www.w3.org/TR/html5/embedded-content-0.html#attr-img-crossorigin">crossorigin</a> 049 * attribute. 050 * 051 * <p> 052 * How the element handles cross-origin requests. 053 * 054 * @param crossorigin The new value for this attribute. 055 * @return This object (for method chaining). 056 */ 057 public final Img crossorigin(String crossorigin) { 058 attr("crossorigin", crossorigin); 059 return this; 060 } 061 062 /** 063 * <a class="doclink" href="https://www.w3.org/TR/html5/embedded-content-0.html#attr-dim-height">height</a> 064 * attribute. 065 * 066 * <p> 067 * Vertical dimension. 068 * 069 * @param height 070 * The new value for this attribute. 071 * Typically a {@link Number} or {@link String}. 072 * @return This object (for method chaining). 073 */ 074 public final Img height(Object height) { 075 attr("height", height); 076 return this; 077 } 078 079 /** 080 * <a class="doclink" href="https://www.w3.org/TR/html5/embedded-content-0.html#attr-img-ismap">ismap</a> attribute. 081 * 082 * <p> 083 * Whether the image is a server-side image map. 084 * 085 * @param ismap 086 * The new value for this attribute. 087 * Typically a {@link Boolean} or {@link String}. 088 * @return This object (for method chaining). 089 */ 090 public final Img ismap(Object ismap) { 091 attr("ismap", ismap); 092 return this; 093 } 094 095 /** 096 * <a class="doclink" href="https://www.w3.org/TR/html5/embedded-content-0.html#attr-img-src">src</a> attribute. 097 * 098 * <p> 099 * Address of the resource. 100 * 101 * <p> 102 * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}. 103 * Strings must be valid URIs. 104 * 105 * <p> 106 * URIs defined by {@link UriResolver} can be used for values. 107 * 108 * @param src 109 * The new value for this attribute. 110 * Typically a {@link URL} or {@link String}. 111 * @return This object (for method chaining). 112 */ 113 public final Img src(Object src) { 114 attrUri("src", src); 115 return this; 116 } 117 118 /** 119 * <a class="doclink" href="https://www.w3.org/TR/html5/embedded-content-0.html#attr-hyperlink-usemap">usemap</a> 120 * attribute. 121 * 122 * <p> 123 * Name of image map to use. 124 * 125 * @param usemap The new value for this attribute. 126 * @return This object (for method chaining). 127 */ 128 public final Img usemap(String usemap) { 129 attr("usemap", usemap); 130 return this; 131 } 132 133 /** 134 * <a class="doclink" href="https://www.w3.org/TR/html5/embedded-content-0.html#attr-dim-width">width</a> attribute. 135 * 136 * <p> 137 * Horizontal dimension. 138 * 139 * @param width 140 * The new value for this attribute. 141 * Typically a {@link Number} or {@link String}. 142 * @return This object (for method chaining). 143 */ 144 public final Img width(Object width) { 145 attr("width", width); 146 return this; 147 } 148 149 150 //-------------------------------------------------------------------------------- 151 // Overridden methods 152 //-------------------------------------------------------------------------------- 153 154 @Override /* HtmlElement */ 155 public final Img _class(String _class) { 156 super._class(_class); 157 return this; 158 } 159 160 @Override /* HtmlElement */ 161 public final Img id(String id) { 162 super.id(id); 163 return this; 164 } 165 166 @Override /* HtmlElement */ 167 public final Img style(String style) { 168 super.style(style); 169 return this; 170 } 171}