001package react4j.dom.proptypes.html; 002 003import javax.annotation.Nonnull; 004import javax.annotation.Nullable; 005import jsinterop.annotations.JsOverlay; 006import jsinterop.annotations.JsPackage; 007import jsinterop.annotations.JsType; 008import react4j.dom.events.DragEventHandler; 009import react4j.dom.events.FocusEventHandler; 010import react4j.dom.events.KeyboardEventHandler; 011import react4j.dom.events.MouseEventHandler; 012import react4j.dom.events.ReactEventHandler; 013import react4j.dom.events.TouchEventHandler; 014 015/** 016 * Props for img elements. Refer to http://www.w3schools.com/tags/tag_img.asp 017 */ 018@JsType( isNative = true, namespace = JsPackage.GLOBAL, name = "Object" ) 019public class ImgProps 020 extends HtmlGlobalFields<ImgProps> 021{ 022 @JsOverlay 023 @Nonnull 024 public final ImgProps alt( String s ) 025 { 026 setAlt( s ); 027 return self(); 028 } 029 030 @JsOverlay 031 @Nonnull 032 public final ImgProps crossOrigin( String s ) 033 { 034 setCrossOrigin( s ); 035 return self(); 036 } 037 038 @JsOverlay 039 @Nonnull 040 public final ImgProps height( int i ) 041 { 042 setHeight( Integer.toString( i ) ); 043 return self(); 044 } 045 046 @JsOverlay 047 @Nonnull 048 public final ImgProps src( String s ) 049 { 050 setSrc( s ); 051 return self(); 052 } 053 054 @JsOverlay 055 @Nonnull 056 public final ImgProps useMap( String s ) 057 { 058 setUseMap( s ); 059 return self(); 060 } 061 062 @JsOverlay 063 @Nonnull 064 public final ImgProps width( int i ) 065 { 066 setWidth( Integer.toString( i ) ); 067 return self(); 068 } 069 070 //Applicable Event Handlers 071 072 // Focus Events 073 @JsOverlay 074 @Nonnull 075 public final ImgProps onBlur( @Nullable final FocusEventHandler handler ) 076 { 077 setOnBlur( handler ); 078 return self(); 079 } 080 081 @JsOverlay 082 @Nonnull 083 public final ImgProps onFocus( @Nullable final FocusEventHandler handler ) 084 { 085 setOnFocus( handler ); 086 return self(); 087 } 088 089 // Image Events 090 @JsOverlay 091 @Nonnull 092 public final ImgProps onLoad( @Nullable final ReactEventHandler handler ) 093 { 094 setOnLoad( handler ); 095 return self(); 096 } 097 098 @JsOverlay 099 @Nonnull 100 public final ImgProps onError( @Nullable final ReactEventHandler handler ) 101 { 102 setOnError( handler ); 103 return self(); 104 } 105 106 // Keyboard Events 107 @JsOverlay 108 @Nonnull 109 public final ImgProps onKeyDown( @Nullable final KeyboardEventHandler handler ) 110 { 111 setOnKeyDown( handler ); 112 return self(); 113 } 114 115 @JsOverlay 116 @Nonnull 117 public final ImgProps onKeyPress( @Nullable final KeyboardEventHandler handler ) 118 { 119 setOnKeyPress( handler ); 120 return self(); 121 } 122 123 @JsOverlay 124 @Nonnull 125 public final ImgProps onKeyUp( @Nullable final KeyboardEventHandler handler ) 126 { 127 setOnKeyUp( handler ); 128 return self(); 129 } 130 131 // Media Events 132 @JsOverlay 133 @Nonnull 134 public final ImgProps onAbort( @Nullable final ReactEventHandler handler ) 135 { 136 setOnAbort( handler ); 137 return self(); 138 } 139 140 @JsOverlay 141 @Nonnull 142 public final ImgProps onCanPlay( @Nullable final ReactEventHandler handler ) 143 { 144 setOnCanPlay( handler ); 145 return self(); 146 } 147 148 @JsOverlay 149 @Nonnull 150 public final ImgProps onCanPlayThrough( @Nullable final ReactEventHandler handler ) 151 { 152 setOnCanPlayThrough( handler ); 153 return self(); 154 } 155 156 @JsOverlay 157 @Nonnull 158 public final ImgProps onDurationChange( @Nullable final ReactEventHandler handler ) 159 { 160 setOnDurationChange( handler ); 161 return self(); 162 } 163 164 @JsOverlay 165 @Nonnull 166 public final ImgProps onEmptied( @Nullable final ReactEventHandler handler ) 167 { 168 setOnEmptied( handler ); 169 return self(); 170 } 171 172 @JsOverlay 173 @Nonnull 174 public final ImgProps onEncrypted( @Nullable final ReactEventHandler handler ) 175 { 176 setOnEncrypted( handler ); 177 return self(); 178 } 179 180 @JsOverlay 181 @Nonnull 182 public final ImgProps onEnded( @Nullable final ReactEventHandler handler ) 183 { 184 setOnEnded( handler ); 185 return self(); 186 } 187 188 @JsOverlay 189 @Nonnull 190 public final ImgProps onLoadedData( @Nullable final ReactEventHandler handler ) 191 { 192 setOnLoadedData( handler ); 193 return self(); 194 } 195 196 @JsOverlay 197 @Nonnull 198 public final ImgProps onLoadedMetadata( @Nullable final ReactEventHandler handler ) 199 { 200 setOnLoadedMetadata( handler ); 201 return self(); 202 } 203 204 @JsOverlay 205 @Nonnull 206 public final ImgProps onLoadStart( @Nullable final ReactEventHandler handler ) 207 { 208 setOnLoadStart( handler ); 209 return self(); 210 } 211 212 @JsOverlay 213 @Nonnull 214 public final ImgProps onPause( @Nullable final ReactEventHandler handler ) 215 { 216 setOnPause( handler ); 217 return self(); 218 } 219 220 @JsOverlay 221 @Nonnull 222 public final ImgProps onPlay( @Nullable final ReactEventHandler handler ) 223 { 224 setOnPlay( handler ); 225 return self(); 226 } 227 228 @JsOverlay 229 @Nonnull 230 public final ImgProps onPlaying( @Nullable final ReactEventHandler handler ) 231 { 232 setOnPlaying( handler ); 233 return self(); 234 } 235 236 @JsOverlay 237 @Nonnull 238 public final ImgProps onProgress( @Nullable final ReactEventHandler handler ) 239 { 240 setOnProgress( handler ); 241 return self(); 242 } 243 244 @JsOverlay 245 @Nonnull 246 public final ImgProps onRateChange( @Nullable final ReactEventHandler handler ) 247 { 248 setOnRateChange( handler ); 249 return self(); 250 } 251 252 @JsOverlay 253 @Nonnull 254 public final ImgProps onSeeked( @Nullable final ReactEventHandler handler ) 255 { 256 setOnSeeked( handler ); 257 return self(); 258 } 259 260 @JsOverlay 261 @Nonnull 262 public final ImgProps onSeeking( @Nullable final ReactEventHandler handler ) 263 { 264 setOnSeeking( handler ); 265 return self(); 266 } 267 268 @JsOverlay 269 @Nonnull 270 public final ImgProps onStalled( @Nullable final ReactEventHandler handler ) 271 { 272 setOnStalled( handler ); 273 return self(); 274 } 275 276 @JsOverlay 277 @Nonnull 278 public final ImgProps onSuspend( @Nullable final ReactEventHandler handler ) 279 { 280 setOnSuspend( handler ); 281 return self(); 282 } 283 284 @JsOverlay 285 @Nonnull 286 public final ImgProps onTimeUpdate( @Nullable final ReactEventHandler handler ) 287 { 288 setOnTimeUpdate( handler ); 289 return self(); 290 } 291 292 @JsOverlay 293 @Nonnull 294 public final ImgProps onVolumeChange( @Nullable final ReactEventHandler handler ) 295 { 296 setOnVolumeChange( handler ); 297 return self(); 298 } 299 300 @JsOverlay 301 @Nonnull 302 public final ImgProps onWaiting( @Nullable final ReactEventHandler handler ) 303 { 304 setOnWaiting( handler ); 305 return self(); 306 } 307 308 // MouseEvents 309 @JsOverlay 310 @Nonnull 311 public final ImgProps onClick( @Nullable final MouseEventHandler handler ) 312 { 313 setOnClick( handler ); 314 return self(); 315 } 316 317 @JsOverlay 318 @Nonnull 319 public final ImgProps onContextMenu( @Nullable final MouseEventHandler handler ) 320 { 321 setOnContextMenu( handler ); 322 return self(); 323 } 324 325 @JsOverlay 326 @Nonnull 327 public final ImgProps onDoubleClick( @Nullable final MouseEventHandler handler ) 328 { 329 setOnDoubleClick( handler ); 330 return self(); 331 } 332 333 @JsOverlay 334 @Nonnull 335 public final ImgProps onDrag( @Nullable final DragEventHandler handler ) 336 { 337 setOnDrag( handler ); 338 return self(); 339 } 340 341 @JsOverlay 342 @Nonnull 343 public final ImgProps onDragEnd( @Nullable final DragEventHandler handler ) 344 { 345 setOnDragEnd( handler ); 346 return self(); 347 } 348 349 @JsOverlay 350 @Nonnull 351 public final ImgProps onDragEnter( @Nullable final DragEventHandler handler ) 352 { 353 setOnDragEnter( handler ); 354 return self(); 355 } 356 357 @JsOverlay 358 @Nonnull 359 public final ImgProps onDragExit( @Nullable final DragEventHandler handler ) 360 { 361 setOnDragExit( handler ); 362 return self(); 363 } 364 365 @JsOverlay 366 @Nonnull 367 public final ImgProps onDragLeave( @Nullable final DragEventHandler handler ) 368 { 369 setOnDragLeave( handler ); 370 return self(); 371 } 372 373 @JsOverlay 374 @Nonnull 375 public final ImgProps onDragOver( @Nullable final DragEventHandler handler ) 376 { 377 setOnDragOver( handler ); 378 return self(); 379 } 380 381 @JsOverlay 382 @Nonnull 383 public final ImgProps onDragStart( @Nullable final DragEventHandler handler ) 384 { 385 setOnDragStart( handler ); 386 return self(); 387 } 388 389 @JsOverlay 390 @Nonnull 391 public final ImgProps onDrop( @Nullable final DragEventHandler handler ) 392 { 393 setOnDrop( handler ); 394 return self(); 395 } 396 397 @JsOverlay 398 @Nonnull 399 public final ImgProps onMouseDown( @Nullable final MouseEventHandler handler ) 400 { 401 setOnMouseDown( handler ); 402 return self(); 403 } 404 405 @JsOverlay 406 @Nonnull 407 public final ImgProps onMouseEnter( @Nullable final MouseEventHandler handler ) 408 { 409 setOnMouseEnter( handler ); 410 return self(); 411 } 412 413 @JsOverlay 414 @Nonnull 415 public final ImgProps onMouseLeave( @Nullable final MouseEventHandler handler ) 416 { 417 setOnMouseLeave( handler ); 418 return self(); 419 } 420 421 @JsOverlay 422 @Nonnull 423 public final ImgProps onMouseMove( @Nullable final MouseEventHandler handler ) 424 { 425 setOnMouseMove( handler ); 426 return self(); 427 } 428 429 @JsOverlay 430 @Nonnull 431 public final ImgProps onMouseOut( @Nullable final MouseEventHandler handler ) 432 { 433 setOnMouseOut( handler ); 434 return self(); 435 } 436 437 @JsOverlay 438 @Nonnull 439 public final ImgProps onMouseOver( @Nullable final MouseEventHandler handler ) 440 { 441 setOnMouseOver( handler ); 442 return self(); 443 } 444 445 @JsOverlay 446 @Nonnull 447 public final ImgProps onMouseUp( @Nullable final MouseEventHandler handler ) 448 { 449 setOnMouseUp( handler ); 450 return self(); 451 } 452 453 // Touch Events 454 @JsOverlay 455 @Nonnull 456 public final ImgProps onTouchCancel( @Nullable final TouchEventHandler handler ) 457 { 458 setOnTouchCancel( handler ); 459 return self(); 460 } 461 462 @JsOverlay 463 @Nonnull 464 public final ImgProps onTouchEnd( @Nullable final TouchEventHandler handler ) 465 { 466 setOnTouchEnd( handler ); 467 return self(); 468 } 469 470 @JsOverlay 471 @Nonnull 472 public final ImgProps onTouchMove( @Nullable final TouchEventHandler handler ) 473 { 474 setOnTouchMove( handler ); 475 return self(); 476 } 477 478 @JsOverlay 479 @Nonnull 480 public final ImgProps onTouchStart( @Nullable final TouchEventHandler handler ) 481 { 482 setOnTouchStart( handler ); 483 return self(); 484 } 485}