001package Torello.Browser; 002 003import java.util.*; 004import javax.json.*; 005import javax.json.stream.*; 006import java.io.*; 007 008import java.lang.reflect.Method; 009import java.lang.reflect.Parameter; 010import java.util.function.Function; 011 012import Torello.Java.Additional.*; 013import Torello.Java.JSON.*; 014 015import static Torello.Java.JSON.JFlag.*; 016 017import Torello.Java.StrCmpr; 018import Torello.JavaDoc.StaticFunctional; 019import Torello.JavaDoc.JDHeaderBackgroundImg; 020import Torello.JavaDoc.Excuse; 021 022/** 023 * <SPAN CLASS=COPIEDJDK><B><CODE>[No Description Provided by Google]</CODE></B></SPAN> 024 * 025 * <EMBED CLASS='external-html' DATA-FILE-ID=CODE_GEN_NOTE> 026 */ 027@StaticFunctional(Excused={"counter"}, Excuses={Excuse.CONFIGURATION}) 028@JDHeaderBackgroundImg(EmbedTagFileID="WOOD_PLANK_NOTE") 029public class Animation 030{ 031 // ******************************************************************************************** 032 // ******************************************************************************************** 033 // Class Header Stuff 034 // ******************************************************************************************** 035 // ******************************************************************************************** 036 037 038 // No Pubic Constructors 039 private Animation () { } 040 041 // These two Vector's are used by all the "Methods" exported by this class. java.lang.reflect 042 // is used to generate the JSON String's. It saves thousands of lines of Auto-Generated Code. 043 private static final Map<String, Vector<String>> parameterNames = new HashMap<>(); 044 private static final Map<String, Vector<Class<?>>> parameterTypes = new HashMap<>(); 045 046 // Some Methods do not take any parameters - for instance all the "enable()" and "disable()" 047 // I simply could not get ride of RAW-TYPES and UNCHECKED warnings... so there are now, 048 // offically, two empty-vectors. One for String's, and the other for Classes. 049 050 private static final Vector<String> EMPTY_VEC_STR = new Vector<>(); 051 private static final Vector<Class<?>> EMPTY_VEC_CLASS = new Vector<>(); 052 053 static 054 { 055 for (Method m : Animation.class.getMethods()) 056 { 057 // This doesn't work! The parameter names are all "arg0" ... "argN" 058 // It works for java.lang.reflect.Field, BUT NOT java.lang.reflect.Parameter! 059 // 060 // Vector<String> parameterNamesList = new Vector<>(); -- NOPE! 061 062 Vector<Class<?>> parameterTypesList = new Vector<>(); 063 064 for (Parameter p : m.getParameters()) parameterTypesList.add(p.getType()); 065 066 parameterTypes.put( 067 m.getName(), 068 (parameterTypesList.size() > 0) ? parameterTypesList : EMPTY_VEC_CLASS 069 ); 070 } 071 } 072 073 static 074 { 075 Vector<String> v = null; 076 077 parameterNames.put("disable", EMPTY_VEC_STR); 078 079 parameterNames.put("enable", EMPTY_VEC_STR); 080 081 v = new Vector<String>(1); 082 parameterNames.put("getCurrentTime", v); 083 Collections.addAll(v, new String[] 084 { "id", }); 085 086 parameterNames.put("getPlaybackRate", EMPTY_VEC_STR); 087 088 v = new Vector<String>(1); 089 parameterNames.put("releaseAnimations", v); 090 Collections.addAll(v, new String[] 091 { "animations", }); 092 093 v = new Vector<String>(1); 094 parameterNames.put("resolveAnimation", v); 095 Collections.addAll(v, new String[] 096 { "animationId", }); 097 098 v = new Vector<String>(2); 099 parameterNames.put("seekAnimations", v); 100 Collections.addAll(v, new String[] 101 { "animations", "currentTime", }); 102 103 v = new Vector<String>(2); 104 parameterNames.put("setPaused", v); 105 Collections.addAll(v, new String[] 106 { "animations", "paused", }); 107 108 v = new Vector<String>(1); 109 parameterNames.put("setPlaybackRate", v); 110 Collections.addAll(v, new String[] 111 { "playbackRate", }); 112 113 v = new Vector<String>(3); 114 parameterNames.put("setTiming", v); 115 Collections.addAll(v, new String[] 116 { "animationId", "duration", "delay", }); 117 } 118 119 120 // ******************************************************************************************** 121 // ******************************************************************************************** 122 // Types - Static Inner Classes 123 // ******************************************************************************************** 124 // ******************************************************************************************** 125 126 /** Animation instance. */ 127 public static class _Animation 128 extends BaseType 129 implements java.io.Serializable 130 { 131 /** For Object Serialization. java.io.Serializable */ 132 protected static final long serialVersionUID = 1; 133 134 public boolean[] optionals() 135 { return new boolean[] { false, false, false, false, false, false, false, false, true, true, }; } 136 137 /** <CODE>Animation</CODE>'s id. */ 138 public final String id; 139 140 /** <CODE>Animation</CODE>'s name. */ 141 public final String name; 142 143 /** <CODE>Animation</CODE>'s internal paused state. */ 144 public final boolean pausedState; 145 146 /** <CODE>Animation</CODE>'s play state. */ 147 public final String playState; 148 149 /** <CODE>Animation</CODE>'s playback rate. */ 150 public final Number playbackRate; 151 152 /** <CODE>Animation</CODE>'s start time. */ 153 public final Number startTime; 154 155 /** <CODE>Animation</CODE>'s current time. */ 156 public final Number currentTime; 157 158 /** Animation type of <CODE>Animation</CODE>. */ 159 public final String type; 160 161 /** 162 * <CODE>Animation</CODE>'s source animation node. 163 * <BR /> 164 * <BR /><B>OPTIONAL</B> 165 */ 166 public final Animation.AnimationEffect source; 167 168 /** 169 * A unique ID for <CODE>Animation</CODE> representing the sources that triggered this CSS 170 * animation/transition. 171 * <BR /> 172 * <BR /><B>OPTIONAL</B> 173 */ 174 public final String cssId; 175 176 /** 177 * Constructor 178 * 179 * @param id <CODE>Animation</CODE>'s id. 180 * 181 * @param name <CODE>Animation</CODE>'s name. 182 * 183 * @param pausedState <CODE>Animation</CODE>'s internal paused state. 184 * 185 * @param playState <CODE>Animation</CODE>'s play state. 186 * 187 * @param playbackRate <CODE>Animation</CODE>'s playback rate. 188 * 189 * @param startTime <CODE>Animation</CODE>'s start time. 190 * 191 * @param currentTime <CODE>Animation</CODE>'s current time. 192 * 193 * @param type Animation type of <CODE>Animation</CODE>. 194 * <BR />Acceptable Values: ["CSSTransition", "CSSAnimation", "WebAnimation"] 195 * 196 * @param source <CODE>Animation</CODE>'s source animation node. 197 * <BR /><B>OPTIONAL</B> 198 * 199 * @param cssId 200 * A unique ID for <CODE>Animation</CODE> representing the sources that triggered this CSS 201 * animation/transition. 202 * <BR /><B>OPTIONAL</B> 203 */ 204 public _Animation( 205 String id, String name, boolean pausedState, String playState, Number playbackRate, 206 Number startTime, Number currentTime, String type, Animation.AnimationEffect source, 207 String cssId 208 ) 209 { 210 // Exception-Check(s) to ensure that if any parameters which are not declared as 211 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 212 213 if (id == null) THROWS.throwNPE("id"); 214 if (name == null) THROWS.throwNPE("name"); 215 if (playState == null) THROWS.throwNPE("playState"); 216 if (playbackRate == null) THROWS.throwNPE("playbackRate"); 217 if (startTime == null) THROWS.throwNPE("startTime"); 218 if (currentTime == null) THROWS.throwNPE("currentTime"); 219 if (type == null) THROWS.throwNPE("type"); 220 221 // Exception-Check(s) to ensure that if any parameters which must adhere to a 222 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 223 224 THROWS.checkIAE( 225 "type", type, 226 "CSSTransition", "CSSAnimation", "WebAnimation" 227 ); 228 229 this.id = id; 230 this.name = name; 231 this.pausedState = pausedState; 232 this.playState = playState; 233 this.playbackRate = playbackRate; 234 this.startTime = startTime; 235 this.currentTime = currentTime; 236 this.type = type; 237 this.source = source; 238 this.cssId = cssId; 239 } 240 241 /** 242 * JSON Object Constructor 243 * @param jo A Json-Object having data about an instance of {@code 'Animation'}. 244 */ 245 public _Animation (JsonObject jo) 246 { 247 this.id = ReadJSON.getString(jo, "id", false, true); 248 this.name = ReadJSON.getString(jo, "name", false, true); 249 this.pausedState = ReadPrimJSON.getBoolean(jo, "pausedState"); 250 this.playState = ReadJSON.getString(jo, "playState", false, true); 251 this.playbackRate = ReadNumberJSON.get(jo, "playbackRate", false, true); 252 this.startTime = ReadNumberJSON.get(jo, "startTime", false, true); 253 this.currentTime = ReadNumberJSON.get(jo, "currentTime", false, true); 254 this.type = ReadJSON.getString(jo, "type", false, true); 255 this.source = ReadJSON.getObject(jo, "source", Animation.AnimationEffect.class, true, false); 256 this.cssId = ReadJSON.getString(jo, "cssId", true, false); 257 } 258 259 260 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 261 public boolean equals(Object other) 262 { 263 if (this == other) return true; 264 if (other == null) return false; 265 if (other.getClass() != this.getClass()) return false; 266 267 _Animation o = (_Animation) other; 268 269 return 270 Objects.equals(this.id, o.id) 271 && Objects.equals(this.name, o.name) 272 && (this.pausedState == o.pausedState) 273 && Objects.equals(this.playState, o.playState) 274 && Objects.equals(this.playbackRate, o.playbackRate) 275 && Objects.equals(this.startTime, o.startTime) 276 && Objects.equals(this.currentTime, o.currentTime) 277 && Objects.equals(this.type, o.type) 278 && Objects.equals(this.source, o.source) 279 && Objects.equals(this.cssId, o.cssId); 280 } 281 282 /** Generates a Hash-Code for {@code 'this'} instance */ 283 public int hashCode() 284 { 285 return 286 Objects.hashCode(this.id) 287 + Objects.hashCode(this.name) 288 + (this.pausedState ? 1 : 0) 289 + Objects.hashCode(this.playState) 290 + Objects.hashCode(this.playbackRate) 291 + Objects.hashCode(this.startTime) 292 + Objects.hashCode(this.currentTime) 293 + Objects.hashCode(this.type) 294 + this.source.hashCode() 295 + Objects.hashCode(this.cssId); 296 } 297 } 298 299 /** AnimationEffect instance */ 300 public static class AnimationEffect 301 extends BaseType 302 implements java.io.Serializable 303 { 304 /** For Object Serialization. java.io.Serializable */ 305 protected static final long serialVersionUID = 1; 306 307 public boolean[] optionals() 308 { return new boolean[] { false, false, false, false, false, false, false, true, true, false, }; } 309 310 /** <CODE>AnimationEffect</CODE>'s delay. */ 311 public final Number delay; 312 313 /** <CODE>AnimationEffect</CODE>'s end delay. */ 314 public final Number endDelay; 315 316 /** <CODE>AnimationEffect</CODE>'s iteration start. */ 317 public final Number iterationStart; 318 319 /** <CODE>AnimationEffect</CODE>'s iterations. */ 320 public final Number iterations; 321 322 /** <CODE>AnimationEffect</CODE>'s iteration duration. */ 323 public final Number duration; 324 325 /** <CODE>AnimationEffect</CODE>'s playback direction. */ 326 public final String direction; 327 328 /** <CODE>AnimationEffect</CODE>'s fill mode. */ 329 public final String fill; 330 331 /** 332 * <CODE>AnimationEffect</CODE>'s target node. 333 * <BR /> 334 * <BR /><B>OPTIONAL</B> 335 */ 336 public final Integer backendNodeId; 337 338 /** 339 * <CODE>AnimationEffect</CODE>'s keyframes. 340 * <BR /> 341 * <BR /><B>OPTIONAL</B> 342 */ 343 public final Animation.KeyframesRule keyframesRule; 344 345 /** <CODE>AnimationEffect</CODE>'s timing function. */ 346 public final String easing; 347 348 /** 349 * Constructor 350 * 351 * @param delay <CODE>AnimationEffect</CODE>'s delay. 352 * 353 * @param endDelay <CODE>AnimationEffect</CODE>'s end delay. 354 * 355 * @param iterationStart <CODE>AnimationEffect</CODE>'s iteration start. 356 * 357 * @param iterations <CODE>AnimationEffect</CODE>'s iterations. 358 * 359 * @param duration <CODE>AnimationEffect</CODE>'s iteration duration. 360 * 361 * @param direction <CODE>AnimationEffect</CODE>'s playback direction. 362 * 363 * @param fill <CODE>AnimationEffect</CODE>'s fill mode. 364 * 365 * @param backendNodeId <CODE>AnimationEffect</CODE>'s target node. 366 * <BR /><B>OPTIONAL</B> 367 * 368 * @param keyframesRule <CODE>AnimationEffect</CODE>'s keyframes. 369 * <BR /><B>OPTIONAL</B> 370 * 371 * @param easing <CODE>AnimationEffect</CODE>'s timing function. 372 */ 373 public AnimationEffect( 374 Number delay, Number endDelay, Number iterationStart, Number iterations, 375 Number duration, String direction, String fill, Integer backendNodeId, 376 Animation.KeyframesRule keyframesRule, String easing 377 ) 378 { 379 // Exception-Check(s) to ensure that if any parameters which are not declared as 380 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 381 382 if (delay == null) THROWS.throwNPE("delay"); 383 if (endDelay == null) THROWS.throwNPE("endDelay"); 384 if (iterationStart == null) THROWS.throwNPE("iterationStart"); 385 if (iterations == null) THROWS.throwNPE("iterations"); 386 if (duration == null) THROWS.throwNPE("duration"); 387 if (direction == null) THROWS.throwNPE("direction"); 388 if (fill == null) THROWS.throwNPE("fill"); 389 if (easing == null) THROWS.throwNPE("easing"); 390 391 this.delay = delay; 392 this.endDelay = endDelay; 393 this.iterationStart = iterationStart; 394 this.iterations = iterations; 395 this.duration = duration; 396 this.direction = direction; 397 this.fill = fill; 398 this.backendNodeId = backendNodeId; 399 this.keyframesRule = keyframesRule; 400 this.easing = easing; 401 } 402 403 /** 404 * JSON Object Constructor 405 * @param jo A Json-Object having data about an instance of {@code 'AnimationEffect'}. 406 */ 407 public AnimationEffect (JsonObject jo) 408 { 409 this.delay = ReadNumberJSON.get(jo, "delay", false, true); 410 this.endDelay = ReadNumberJSON.get(jo, "endDelay", false, true); 411 this.iterationStart = ReadNumberJSON.get(jo, "iterationStart", false, true); 412 this.iterations = ReadNumberJSON.get(jo, "iterations", false, true); 413 this.duration = ReadNumberJSON.get(jo, "duration", false, true); 414 this.direction = ReadJSON.getString(jo, "direction", false, true); 415 this.fill = ReadJSON.getString(jo, "fill", false, true); 416 this.backendNodeId = ReadBoxedJSON.getInteger(jo, "backendNodeId", true); 417 this.keyframesRule = ReadJSON.getObject(jo, "keyframesRule", Animation.KeyframesRule.class, true, false); 418 this.easing = ReadJSON.getString(jo, "easing", false, true); 419 } 420 421 422 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 423 public boolean equals(Object other) 424 { 425 if (this == other) return true; 426 if (other == null) return false; 427 if (other.getClass() != this.getClass()) return false; 428 429 AnimationEffect o = (AnimationEffect) other; 430 431 return 432 Objects.equals(this.delay, o.delay) 433 && Objects.equals(this.endDelay, o.endDelay) 434 && Objects.equals(this.iterationStart, o.iterationStart) 435 && Objects.equals(this.iterations, o.iterations) 436 && Objects.equals(this.duration, o.duration) 437 && Objects.equals(this.direction, o.direction) 438 && Objects.equals(this.fill, o.fill) 439 && Objects.equals(this.backendNodeId, o.backendNodeId) 440 && Objects.equals(this.keyframesRule, o.keyframesRule) 441 && Objects.equals(this.easing, o.easing); 442 } 443 444 /** Generates a Hash-Code for {@code 'this'} instance */ 445 public int hashCode() 446 { 447 return 448 Objects.hashCode(this.delay) 449 + Objects.hashCode(this.endDelay) 450 + Objects.hashCode(this.iterationStart) 451 + Objects.hashCode(this.iterations) 452 + Objects.hashCode(this.duration) 453 + Objects.hashCode(this.direction) 454 + Objects.hashCode(this.fill) 455 + Objects.hashCode(this.backendNodeId) 456 + this.keyframesRule.hashCode() 457 + Objects.hashCode(this.easing); 458 } 459 } 460 461 /** Keyframes Rule */ 462 public static class KeyframesRule 463 extends BaseType 464 implements java.io.Serializable 465 { 466 /** For Object Serialization. java.io.Serializable */ 467 protected static final long serialVersionUID = 1; 468 469 public boolean[] optionals() 470 { return new boolean[] { true, false, }; } 471 472 /** 473 * CSS keyframed animation's name. 474 * <BR /> 475 * <BR /><B>OPTIONAL</B> 476 */ 477 public final String name; 478 479 /** List of animation keyframes. */ 480 public final Animation.KeyframeStyle[] keyframes; 481 482 /** 483 * Constructor 484 * 485 * @param name CSS keyframed animation's name. 486 * <BR /><B>OPTIONAL</B> 487 * 488 * @param keyframes List of animation keyframes. 489 */ 490 public KeyframesRule(String name, Animation.KeyframeStyle[] keyframes) 491 { 492 // Exception-Check(s) to ensure that if any parameters which are not declared as 493 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 494 495 if (keyframes == null) THROWS.throwNPE("keyframes"); 496 497 this.name = name; 498 this.keyframes = keyframes; 499 } 500 501 /** 502 * JSON Object Constructor 503 * @param jo A Json-Object having data about an instance of {@code 'KeyframesRule'}. 504 */ 505 public KeyframesRule (JsonObject jo) 506 { 507 this.name = ReadJSON.getString(jo, "name", true, false); 508 this.keyframes = (jo.getJsonArray("keyframes") == null) 509 ? null 510 : RJArrIntoStream.objArr(jo.getJsonArray("keyframes"), null, 0, Animation.KeyframeStyle.class).toArray(Animation.KeyframeStyle[]::new); 511 512 } 513 514 515 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 516 public boolean equals(Object other) 517 { 518 if (this == other) return true; 519 if (other == null) return false; 520 if (other.getClass() != this.getClass()) return false; 521 522 KeyframesRule o = (KeyframesRule) other; 523 524 return 525 Objects.equals(this.name, o.name) 526 && Arrays.deepEquals(this.keyframes, o.keyframes); 527 } 528 529 /** Generates a Hash-Code for {@code 'this'} instance */ 530 public int hashCode() 531 { 532 return 533 Objects.hashCode(this.name) 534 + Arrays.deepHashCode(this.keyframes); 535 } 536 } 537 538 /** Keyframe Style */ 539 public static class KeyframeStyle 540 extends BaseType 541 implements java.io.Serializable 542 { 543 /** For Object Serialization. java.io.Serializable */ 544 protected static final long serialVersionUID = 1; 545 546 public boolean[] optionals() 547 { return new boolean[] { false, false, }; } 548 549 /** Keyframe's time offset. */ 550 public final String offset; 551 552 /** <CODE>AnimationEffect</CODE>'s timing function. */ 553 public final String easing; 554 555 /** 556 * Constructor 557 * 558 * @param offset Keyframe's time offset. 559 * 560 * @param easing <CODE>AnimationEffect</CODE>'s timing function. 561 */ 562 public KeyframeStyle(String offset, String easing) 563 { 564 // Exception-Check(s) to ensure that if any parameters which are not declared as 565 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 566 567 if (offset == null) THROWS.throwNPE("offset"); 568 if (easing == null) THROWS.throwNPE("easing"); 569 570 this.offset = offset; 571 this.easing = easing; 572 } 573 574 /** 575 * JSON Object Constructor 576 * @param jo A Json-Object having data about an instance of {@code 'KeyframeStyle'}. 577 */ 578 public KeyframeStyle (JsonObject jo) 579 { 580 this.offset = ReadJSON.getString(jo, "offset", false, true); 581 this.easing = ReadJSON.getString(jo, "easing", false, true); 582 } 583 584 585 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 586 public boolean equals(Object other) 587 { 588 if (this == other) return true; 589 if (other == null) return false; 590 if (other.getClass() != this.getClass()) return false; 591 592 KeyframeStyle o = (KeyframeStyle) other; 593 594 return 595 Objects.equals(this.offset, o.offset) 596 && Objects.equals(this.easing, o.easing); 597 } 598 599 /** Generates a Hash-Code for {@code 'this'} instance */ 600 public int hashCode() 601 { 602 return 603 Objects.hashCode(this.offset) 604 + Objects.hashCode(this.easing); 605 } 606 } 607 608 /** Event for when an animation has been cancelled. */ 609 public static class animationCanceled 610 extends BrowserEvent 611 implements java.io.Serializable 612 { 613 /** For Object Serialization. java.io.Serializable */ 614 protected static final long serialVersionUID = 1; 615 616 public boolean[] optionals() 617 { return new boolean[] { false, }; } 618 619 /** Id of the animation that was cancelled. */ 620 public final String id; 621 622 /** 623 * Constructor 624 * 625 * @param id Id of the animation that was cancelled. 626 */ 627 public animationCanceled(String id) 628 { 629 super("Animation", "animationCanceled", 1); 630 631 // Exception-Check(s) to ensure that if any parameters which are not declared as 632 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 633 634 if (id == null) THROWS.throwNPE("id"); 635 636 this.id = id; 637 } 638 639 /** 640 * JSON Object Constructor 641 * @param jo A Json-Object having data about an instance of {@code 'animationCanceled'}. 642 */ 643 public animationCanceled (JsonObject jo) 644 { 645 super("Animation", "animationCanceled", 1); 646 647 this.id = ReadJSON.getString(jo, "id", false, true); 648 } 649 650 651 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 652 public boolean equals(Object other) 653 { 654 if (this == other) return true; 655 if (other == null) return false; 656 if (other.getClass() != this.getClass()) return false; 657 658 animationCanceled o = (animationCanceled) other; 659 660 return 661 Objects.equals(this.id, o.id); 662 } 663 664 /** Generates a Hash-Code for {@code 'this'} instance */ 665 public int hashCode() 666 { 667 return 668 Objects.hashCode(this.id); 669 } 670 } 671 672 /** Event for each animation that has been created. */ 673 public static class animationCreated 674 extends BrowserEvent 675 implements java.io.Serializable 676 { 677 /** For Object Serialization. java.io.Serializable */ 678 protected static final long serialVersionUID = 1; 679 680 public boolean[] optionals() 681 { return new boolean[] { false, }; } 682 683 /** Id of the animation that was created. */ 684 public final String id; 685 686 /** 687 * Constructor 688 * 689 * @param id Id of the animation that was created. 690 */ 691 public animationCreated(String id) 692 { 693 super("Animation", "animationCreated", 1); 694 695 // Exception-Check(s) to ensure that if any parameters which are not declared as 696 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 697 698 if (id == null) THROWS.throwNPE("id"); 699 700 this.id = id; 701 } 702 703 /** 704 * JSON Object Constructor 705 * @param jo A Json-Object having data about an instance of {@code 'animationCreated'}. 706 */ 707 public animationCreated (JsonObject jo) 708 { 709 super("Animation", "animationCreated", 1); 710 711 this.id = ReadJSON.getString(jo, "id", false, true); 712 } 713 714 715 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 716 public boolean equals(Object other) 717 { 718 if (this == other) return true; 719 if (other == null) return false; 720 if (other.getClass() != this.getClass()) return false; 721 722 animationCreated o = (animationCreated) other; 723 724 return 725 Objects.equals(this.id, o.id); 726 } 727 728 /** Generates a Hash-Code for {@code 'this'} instance */ 729 public int hashCode() 730 { 731 return 732 Objects.hashCode(this.id); 733 } 734 } 735 736 /** Event for animation that has been started. */ 737 public static class animationStarted 738 extends BrowserEvent 739 implements java.io.Serializable 740 { 741 /** For Object Serialization. java.io.Serializable */ 742 protected static final long serialVersionUID = 1; 743 744 public boolean[] optionals() 745 { return new boolean[] { false, }; } 746 747 /** Animation that was started. */ 748 public final Animation._Animation animation; 749 750 /** 751 * Constructor 752 * 753 * @param animation Animation that was started. 754 */ 755 public animationStarted(Animation._Animation animation) 756 { 757 super("Animation", "animationStarted", 1); 758 759 // Exception-Check(s) to ensure that if any parameters which are not declared as 760 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 761 762 if (animation == null) THROWS.throwNPE("animation"); 763 764 this.animation = animation; 765 } 766 767 /** 768 * JSON Object Constructor 769 * @param jo A Json-Object having data about an instance of {@code 'animationStarted'}. 770 */ 771 public animationStarted (JsonObject jo) 772 { 773 super("Animation", "animationStarted", 1); 774 775 this.animation = ReadJSON.getObject(jo, "animation", Animation._Animation.class, false, true); 776 } 777 778 779 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 780 public boolean equals(Object other) 781 { 782 if (this == other) return true; 783 if (other == null) return false; 784 if (other.getClass() != this.getClass()) return false; 785 786 animationStarted o = (animationStarted) other; 787 788 return 789 Objects.equals(this.animation, o.animation); 790 } 791 792 /** Generates a Hash-Code for {@code 'this'} instance */ 793 public int hashCode() 794 { 795 return 796 this.animation.hashCode(); 797 } 798 } 799 800 801 // Counter for keeping the WebSocket Request ID's distinct. 802 private static int counter = 1; 803 804 /** 805 * Disables animation domain notifications. 806 * 807 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 808 * {@link Ret0}></CODE> 809 * 810 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 811 * browser receives the invocation-request. 812 * 813 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 814 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 815 * {@code >} to ensure the Browser Function has run to completion. 816 */ 817 public static Script<String, JsonObject, Ret0> disable() 818 { 819 final int webSocketID = 8000000 + counter++; 820 final boolean[] optionals = new boolean[0]; 821 822 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 823 String requestJSON = WriteJSON.get( 824 parameterTypes.get("disable"), 825 parameterNames.get("disable"), 826 optionals, webSocketID, 827 "Animation.disable" 828 ); 829 830 // This Remote Command does not have a Return-Value. 831 return new Script<> 832 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 833 } 834 835 /** 836 * Enables animation domain notifications. 837 * 838 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 839 * {@link Ret0}></CODE> 840 * 841 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 842 * browser receives the invocation-request. 843 * 844 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 845 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 846 * {@code >} to ensure the Browser Function has run to completion. 847 */ 848 public static Script<String, JsonObject, Ret0> enable() 849 { 850 final int webSocketID = 8001000 + counter++; 851 final boolean[] optionals = new boolean[0]; 852 853 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 854 String requestJSON = WriteJSON.get( 855 parameterTypes.get("enable"), 856 parameterNames.get("enable"), 857 optionals, webSocketID, 858 "Animation.enable" 859 ); 860 861 // This Remote Command does not have a Return-Value. 862 return new Script<> 863 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 864 } 865 866 /** 867 * Returns the current time of the an animation. 868 * 869 * @param id Id of animation. 870 * 871 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 872 * Number></CODE> 873 * 874 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 875 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 876 * Number></CODE> will be returned. 877 * 878 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 879 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 880 * may be retrieved.</I> 881 * 882 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 883 * <BR /><BR /><UL CLASS=JDUL> 884 * <LI><CODE>Number (<B>currentTime</B></CODE>) 885 * <BR />Current time of the page. 886 * </LI> 887 * </UL> */ 888 public static Script<String, JsonObject, Number> getCurrentTime(String id) 889 { 890 // Exception-Check(s) to ensure that if any parameters which are not declared as 891 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 892 893 if (id == null) THROWS.throwNPE("id"); 894 895 final int webSocketID = 8002000 + counter++; 896 final boolean[] optionals = { false, }; 897 898 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 899 String requestJSON = WriteJSON.get( 900 parameterTypes.get("getCurrentTime"), 901 parameterNames.get("getCurrentTime"), 902 optionals, webSocketID, 903 "Animation.getCurrentTime", 904 id 905 ); 906 907 // 'JSON Binding' ... Converts Browser Response-JSON to 'Number' 908 Function<JsonObject, Number> responseProcessor = (JsonObject jo) -> 909 ReadNumberJSON.get(jo, "currentTime", false, true); 910 911 return new Script<>(webSocketID, requestJSON, responseProcessor); 912 } 913 914 /** 915 * Gets the playback rate of the document timeline. 916 * 917 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 918 * Number></CODE> 919 * 920 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 921 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 922 * Number></CODE> will be returned. 923 * 924 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 925 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 926 * may be retrieved.</I> 927 * 928 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 929 * <BR /><BR /><UL CLASS=JDUL> 930 * <LI><CODE>Number (<B>playbackRate</B></CODE>) 931 * <BR />Playback rate for animations on page. 932 * </LI> 933 * </UL> */ 934 public static Script<String, JsonObject, Number> getPlaybackRate() 935 { 936 final int webSocketID = 8003000 + counter++; 937 final boolean[] optionals = new boolean[0]; 938 939 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 940 String requestJSON = WriteJSON.get( 941 parameterTypes.get("getPlaybackRate"), 942 parameterNames.get("getPlaybackRate"), 943 optionals, webSocketID, 944 "Animation.getPlaybackRate" 945 ); 946 947 // 'JSON Binding' ... Converts Browser Response-JSON to 'Number' 948 Function<JsonObject, Number> responseProcessor = (JsonObject jo) -> 949 ReadNumberJSON.get(jo, "playbackRate", false, true); 950 951 return new Script<>(webSocketID, requestJSON, responseProcessor); 952 } 953 954 /** 955 * Releases a set of animations to no longer be manipulated. 956 * 957 * @param animations List of animation ids to seek. 958 * 959 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 960 * {@link Ret0}></CODE> 961 * 962 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 963 * browser receives the invocation-request. 964 * 965 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 966 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 967 * {@code >} to ensure the Browser Function has run to completion. 968 */ 969 public static Script<String, JsonObject, Ret0> releaseAnimations(String[] animations) 970 { 971 // Exception-Check(s) to ensure that if any parameters which are not declared as 972 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 973 974 if (animations == null) THROWS.throwNPE("animations"); 975 976 final int webSocketID = 8004000 + counter++; 977 final boolean[] optionals = { false, }; 978 979 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 980 String requestJSON = WriteJSON.get( 981 parameterTypes.get("releaseAnimations"), 982 parameterNames.get("releaseAnimations"), 983 optionals, webSocketID, 984 "Animation.releaseAnimations", 985 (Object) animations 986 ); 987 988 // This Remote Command does not have a Return-Value. 989 return new Script<> 990 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 991 } 992 993 /** 994 * Gets the remote object of the Animation. 995 * 996 * @param animationId Animation id. 997 * 998 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 999 * {@link RunTime.RemoteObject}></CODE> 1000 * 1001 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 1002 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 1003 * {@link RunTime.RemoteObject}></CODE> will be returned. 1004 * 1005 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 1006 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 1007 * may be retrieved.</I> 1008 * 1009 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 1010 * <BR /><BR /><UL CLASS=JDUL> 1011 * <LI><CODE>{@link RunTime.RemoteObject} (<B>remoteObject</B></CODE>) 1012 * <BR />Corresponding remote object. 1013 * </LI> 1014 * </UL> */ 1015 public static Script<String, JsonObject, RunTime.RemoteObject> resolveAnimation 1016 (String animationId) 1017 { 1018 // Exception-Check(s) to ensure that if any parameters which are not declared as 1019 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1020 1021 if (animationId == null) THROWS.throwNPE("animationId"); 1022 1023 final int webSocketID = 8005000 + counter++; 1024 final boolean[] optionals = { false, }; 1025 1026 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1027 String requestJSON = WriteJSON.get( 1028 parameterTypes.get("resolveAnimation"), 1029 parameterNames.get("resolveAnimation"), 1030 optionals, webSocketID, 1031 "Animation.resolveAnimation", 1032 animationId 1033 ); 1034 1035 // 'JSON Binding' ... Converts Browser Response-JSON to 'RunTime.RemoteObject' 1036 Function<JsonObject, RunTime.RemoteObject> responseProcessor = (JsonObject jo) -> 1037 ReadJSON.getObject(jo, "remoteObject", RunTime.RemoteObject.class, false, true); 1038 1039 return new Script<>(webSocketID, requestJSON, responseProcessor); 1040 } 1041 1042 /** 1043 * Seek a set of animations to a particular time within each animation. 1044 * 1045 * @param animations List of animation ids to seek. 1046 * 1047 * @param currentTime Set the current time of each animation. 1048 * 1049 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1050 * {@link Ret0}></CODE> 1051 * 1052 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1053 * browser receives the invocation-request. 1054 * 1055 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1056 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1057 * {@code >} to ensure the Browser Function has run to completion. 1058 */ 1059 public static Script<String, JsonObject, Ret0> seekAnimations 1060 (String[] animations, Number currentTime) 1061 { 1062 // Exception-Check(s) to ensure that if any parameters which are not declared as 1063 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1064 1065 if (animations == null) THROWS.throwNPE("animations"); 1066 if (currentTime == null) THROWS.throwNPE("currentTime"); 1067 1068 final int webSocketID = 8006000 + counter++; 1069 final boolean[] optionals = { false, false, }; 1070 1071 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1072 String requestJSON = WriteJSON.get( 1073 parameterTypes.get("seekAnimations"), 1074 parameterNames.get("seekAnimations"), 1075 optionals, webSocketID, 1076 "Animation.seekAnimations", 1077 animations, currentTime 1078 ); 1079 1080 // This Remote Command does not have a Return-Value. 1081 return new Script<> 1082 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 1083 } 1084 1085 /** 1086 * Sets the paused state of a set of animations. 1087 * 1088 * @param animations Animations to set the pause state of. 1089 * 1090 * @param paused Paused state to set to. 1091 * 1092 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1093 * {@link Ret0}></CODE> 1094 * 1095 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1096 * browser receives the invocation-request. 1097 * 1098 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1099 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1100 * {@code >} to ensure the Browser Function has run to completion. 1101 */ 1102 public static Script<String, JsonObject, Ret0> setPaused 1103 (String[] animations, boolean paused) 1104 { 1105 // Exception-Check(s) to ensure that if any parameters which are not declared as 1106 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1107 1108 if (animations == null) THROWS.throwNPE("animations"); 1109 1110 final int webSocketID = 8007000 + counter++; 1111 final boolean[] optionals = { false, false, }; 1112 1113 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1114 String requestJSON = WriteJSON.get( 1115 parameterTypes.get("setPaused"), 1116 parameterNames.get("setPaused"), 1117 optionals, webSocketID, 1118 "Animation.setPaused", 1119 animations, paused 1120 ); 1121 1122 // This Remote Command does not have a Return-Value. 1123 return new Script<> 1124 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 1125 } 1126 1127 /** 1128 * Sets the playback rate of the document timeline. 1129 * 1130 * @param playbackRate Playback rate for animations on page 1131 * 1132 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1133 * {@link Ret0}></CODE> 1134 * 1135 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1136 * browser receives the invocation-request. 1137 * 1138 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1139 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1140 * {@code >} to ensure the Browser Function has run to completion. 1141 */ 1142 public static Script<String, JsonObject, Ret0> setPlaybackRate(Number playbackRate) 1143 { 1144 // Exception-Check(s) to ensure that if any parameters which are not declared as 1145 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1146 1147 if (playbackRate == null) THROWS.throwNPE("playbackRate"); 1148 1149 final int webSocketID = 8008000 + counter++; 1150 final boolean[] optionals = { false, }; 1151 1152 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1153 String requestJSON = WriteJSON.get( 1154 parameterTypes.get("setPlaybackRate"), 1155 parameterNames.get("setPlaybackRate"), 1156 optionals, webSocketID, 1157 "Animation.setPlaybackRate", 1158 playbackRate 1159 ); 1160 1161 // This Remote Command does not have a Return-Value. 1162 return new Script<> 1163 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 1164 } 1165 1166 /** 1167 * Sets the timing of an animation node. 1168 * 1169 * @param animationId Animation id. 1170 * 1171 * @param duration Duration of the animation. 1172 * 1173 * @param delay Delay of the animation. 1174 * 1175 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1176 * {@link Ret0}></CODE> 1177 * 1178 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1179 * browser receives the invocation-request. 1180 * 1181 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1182 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1183 * {@code >} to ensure the Browser Function has run to completion. 1184 */ 1185 public static Script<String, JsonObject, Ret0> setTiming 1186 (String animationId, Number duration, Number delay) 1187 { 1188 // Exception-Check(s) to ensure that if any parameters which are not declared as 1189 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1190 1191 if (animationId == null) THROWS.throwNPE("animationId"); 1192 if (duration == null) THROWS.throwNPE("duration"); 1193 if (delay == null) THROWS.throwNPE("delay"); 1194 1195 final int webSocketID = 8009000 + counter++; 1196 final boolean[] optionals = { false, false, false, }; 1197 1198 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1199 String requestJSON = WriteJSON.get( 1200 parameterTypes.get("setTiming"), 1201 parameterNames.get("setTiming"), 1202 optionals, webSocketID, 1203 "Animation.setTiming", 1204 animationId, duration, delay 1205 ); 1206 1207 // This Remote Command does not have a Return-Value. 1208 return new Script<> 1209 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 1210 } 1211 1212}