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) BRDPC.throwNPE("id"); 214 if (name == null) BRDPC.throwNPE("name"); 215 if (playState == null) BRDPC.throwNPE("playState"); 216 if (playbackRate == null) BRDPC.throwNPE("playbackRate"); 217 if (startTime == null) BRDPC.throwNPE("startTime"); 218 if (currentTime == null) BRDPC.throwNPE("currentTime"); 219 if (type == null) BRDPC.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 BRDPC.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 (other == null) return false; 264 if (other.getClass() != this.getClass()) return false; 265 266 _Animation o = (_Animation) other; 267 268 return 269 Objects.equals(this.id, o.id) 270 && Objects.equals(this.name, o.name) 271 && (this.pausedState == o.pausedState) 272 && Objects.equals(this.playState, o.playState) 273 && Objects.equals(this.playbackRate, o.playbackRate) 274 && Objects.equals(this.startTime, o.startTime) 275 && Objects.equals(this.currentTime, o.currentTime) 276 && Objects.equals(this.type, o.type) 277 && Objects.equals(this.source, o.source) 278 && Objects.equals(this.cssId, o.cssId); 279 } 280 281 /** Generates a Hash-Code for {@code 'this'} instance */ 282 public int hashCode() 283 { 284 return 285 Objects.hashCode(this.id) 286 + Objects.hashCode(this.name) 287 + (this.pausedState ? 1 : 0) 288 + Objects.hashCode(this.playState) 289 + Objects.hashCode(this.playbackRate) 290 + Objects.hashCode(this.startTime) 291 + Objects.hashCode(this.currentTime) 292 + Objects.hashCode(this.type) 293 + this.source.hashCode() 294 + Objects.hashCode(this.cssId); 295 } 296 } 297 298 /** AnimationEffect instance */ 299 public static class AnimationEffect 300 extends BaseType 301 implements java.io.Serializable 302 { 303 /** For Object Serialization. java.io.Serializable */ 304 protected static final long serialVersionUID = 1; 305 306 public boolean[] optionals() 307 { return new boolean[] { false, false, false, false, false, false, false, true, true, false, }; } 308 309 /** <CODE>AnimationEffect</CODE>'s delay. */ 310 public final Number delay; 311 312 /** <CODE>AnimationEffect</CODE>'s end delay. */ 313 public final Number endDelay; 314 315 /** <CODE>AnimationEffect</CODE>'s iteration start. */ 316 public final Number iterationStart; 317 318 /** <CODE>AnimationEffect</CODE>'s iterations. */ 319 public final Number iterations; 320 321 /** <CODE>AnimationEffect</CODE>'s iteration duration. */ 322 public final Number duration; 323 324 /** <CODE>AnimationEffect</CODE>'s playback direction. */ 325 public final String direction; 326 327 /** <CODE>AnimationEffect</CODE>'s fill mode. */ 328 public final String fill; 329 330 /** 331 * <CODE>AnimationEffect</CODE>'s target node. 332 * <BR /> 333 * <BR /><B>OPTIONAL</B> 334 */ 335 public final Integer backendNodeId; 336 337 /** 338 * <CODE>AnimationEffect</CODE>'s keyframes. 339 * <BR /> 340 * <BR /><B>OPTIONAL</B> 341 */ 342 public final Animation.KeyframesRule keyframesRule; 343 344 /** <CODE>AnimationEffect</CODE>'s timing function. */ 345 public final String easing; 346 347 /** 348 * Constructor 349 * 350 * @param delay <CODE>AnimationEffect</CODE>'s delay. 351 * 352 * @param endDelay <CODE>AnimationEffect</CODE>'s end delay. 353 * 354 * @param iterationStart <CODE>AnimationEffect</CODE>'s iteration start. 355 * 356 * @param iterations <CODE>AnimationEffect</CODE>'s iterations. 357 * 358 * @param duration <CODE>AnimationEffect</CODE>'s iteration duration. 359 * 360 * @param direction <CODE>AnimationEffect</CODE>'s playback direction. 361 * 362 * @param fill <CODE>AnimationEffect</CODE>'s fill mode. 363 * 364 * @param backendNodeId <CODE>AnimationEffect</CODE>'s target node. 365 * <BR /><B>OPTIONAL</B> 366 * 367 * @param keyframesRule <CODE>AnimationEffect</CODE>'s keyframes. 368 * <BR /><B>OPTIONAL</B> 369 * 370 * @param easing <CODE>AnimationEffect</CODE>'s timing function. 371 */ 372 public AnimationEffect( 373 Number delay, Number endDelay, Number iterationStart, Number iterations, 374 Number duration, String direction, String fill, Integer backendNodeId, 375 Animation.KeyframesRule keyframesRule, String easing 376 ) 377 { 378 // Exception-Check(s) to ensure that if any parameters which are not declared as 379 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 380 381 if (delay == null) BRDPC.throwNPE("delay"); 382 if (endDelay == null) BRDPC.throwNPE("endDelay"); 383 if (iterationStart == null) BRDPC.throwNPE("iterationStart"); 384 if (iterations == null) BRDPC.throwNPE("iterations"); 385 if (duration == null) BRDPC.throwNPE("duration"); 386 if (direction == null) BRDPC.throwNPE("direction"); 387 if (fill == null) BRDPC.throwNPE("fill"); 388 if (easing == null) BRDPC.throwNPE("easing"); 389 390 this.delay = delay; 391 this.endDelay = endDelay; 392 this.iterationStart = iterationStart; 393 this.iterations = iterations; 394 this.duration = duration; 395 this.direction = direction; 396 this.fill = fill; 397 this.backendNodeId = backendNodeId; 398 this.keyframesRule = keyframesRule; 399 this.easing = easing; 400 } 401 402 /** 403 * JSON Object Constructor 404 * @param jo A Json-Object having data about an instance of {@code 'AnimationEffect'}. 405 */ 406 public AnimationEffect (JsonObject jo) 407 { 408 this.delay = ReadNumberJSON.get(jo, "delay", false, true); 409 this.endDelay = ReadNumberJSON.get(jo, "endDelay", false, true); 410 this.iterationStart = ReadNumberJSON.get(jo, "iterationStart", false, true); 411 this.iterations = ReadNumberJSON.get(jo, "iterations", false, true); 412 this.duration = ReadNumberJSON.get(jo, "duration", false, true); 413 this.direction = ReadJSON.getString(jo, "direction", false, true); 414 this.fill = ReadJSON.getString(jo, "fill", false, true); 415 this.backendNodeId = ReadBoxedJSON.getInteger(jo, "backendNodeId", true); 416 this.keyframesRule = ReadJSON.getObject(jo, "keyframesRule", Animation.KeyframesRule.class, true, false); 417 this.easing = ReadJSON.getString(jo, "easing", false, true); 418 } 419 420 421 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 422 public boolean equals(Object other) 423 { 424 if (other == null) return false; 425 if (other.getClass() != this.getClass()) return false; 426 427 AnimationEffect o = (AnimationEffect) other; 428 429 return 430 Objects.equals(this.delay, o.delay) 431 && Objects.equals(this.endDelay, o.endDelay) 432 && Objects.equals(this.iterationStart, o.iterationStart) 433 && Objects.equals(this.iterations, o.iterations) 434 && Objects.equals(this.duration, o.duration) 435 && Objects.equals(this.direction, o.direction) 436 && Objects.equals(this.fill, o.fill) 437 && Objects.equals(this.backendNodeId, o.backendNodeId) 438 && Objects.equals(this.keyframesRule, o.keyframesRule) 439 && Objects.equals(this.easing, o.easing); 440 } 441 442 /** Generates a Hash-Code for {@code 'this'} instance */ 443 public int hashCode() 444 { 445 return 446 Objects.hashCode(this.delay) 447 + Objects.hashCode(this.endDelay) 448 + Objects.hashCode(this.iterationStart) 449 + Objects.hashCode(this.iterations) 450 + Objects.hashCode(this.duration) 451 + Objects.hashCode(this.direction) 452 + Objects.hashCode(this.fill) 453 + Objects.hashCode(this.backendNodeId) 454 + this.keyframesRule.hashCode() 455 + Objects.hashCode(this.easing); 456 } 457 } 458 459 /** Keyframes Rule */ 460 public static class KeyframesRule 461 extends BaseType 462 implements java.io.Serializable 463 { 464 /** For Object Serialization. java.io.Serializable */ 465 protected static final long serialVersionUID = 1; 466 467 public boolean[] optionals() 468 { return new boolean[] { true, false, }; } 469 470 /** 471 * CSS keyframed animation's name. 472 * <BR /> 473 * <BR /><B>OPTIONAL</B> 474 */ 475 public final String name; 476 477 /** List of animation keyframes. */ 478 public final Animation.KeyframeStyle[] keyframes; 479 480 /** 481 * Constructor 482 * 483 * @param name CSS keyframed animation's name. 484 * <BR /><B>OPTIONAL</B> 485 * 486 * @param keyframes List of animation keyframes. 487 */ 488 public KeyframesRule(String name, Animation.KeyframeStyle[] keyframes) 489 { 490 // Exception-Check(s) to ensure that if any parameters which are not declared as 491 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 492 493 if (keyframes == null) BRDPC.throwNPE("keyframes"); 494 495 this.name = name; 496 this.keyframes = keyframes; 497 } 498 499 /** 500 * JSON Object Constructor 501 * @param jo A Json-Object having data about an instance of {@code 'KeyframesRule'}. 502 */ 503 public KeyframesRule (JsonObject jo) 504 { 505 this.name = ReadJSON.getString(jo, "name", true, false); 506 this.keyframes = (jo.getJsonArray("keyframes") == null) 507 ? null 508 : ReadArrJSON.DimN.objArr(jo.getJsonArray("keyframes"), null, 0, Animation.KeyframeStyle[].class); 509 510 } 511 512 513 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 514 public boolean equals(Object other) 515 { 516 if (other == null) return false; 517 if (other.getClass() != this.getClass()) return false; 518 519 KeyframesRule o = (KeyframesRule) other; 520 521 return 522 Objects.equals(this.name, o.name) 523 && Arrays.deepEquals(this.keyframes, o.keyframes); 524 } 525 526 /** Generates a Hash-Code for {@code 'this'} instance */ 527 public int hashCode() 528 { 529 return 530 Objects.hashCode(this.name) 531 + Arrays.deepHashCode(this.keyframes); 532 } 533 } 534 535 /** Keyframe Style */ 536 public static class KeyframeStyle 537 extends BaseType 538 implements java.io.Serializable 539 { 540 /** For Object Serialization. java.io.Serializable */ 541 protected static final long serialVersionUID = 1; 542 543 public boolean[] optionals() 544 { return new boolean[] { false, false, }; } 545 546 /** Keyframe's time offset. */ 547 public final String offset; 548 549 /** <CODE>AnimationEffect</CODE>'s timing function. */ 550 public final String easing; 551 552 /** 553 * Constructor 554 * 555 * @param offset Keyframe's time offset. 556 * 557 * @param easing <CODE>AnimationEffect</CODE>'s timing function. 558 */ 559 public KeyframeStyle(String offset, String easing) 560 { 561 // Exception-Check(s) to ensure that if any parameters which are not declared as 562 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 563 564 if (offset == null) BRDPC.throwNPE("offset"); 565 if (easing == null) BRDPC.throwNPE("easing"); 566 567 this.offset = offset; 568 this.easing = easing; 569 } 570 571 /** 572 * JSON Object Constructor 573 * @param jo A Json-Object having data about an instance of {@code 'KeyframeStyle'}. 574 */ 575 public KeyframeStyle (JsonObject jo) 576 { 577 this.offset = ReadJSON.getString(jo, "offset", false, true); 578 this.easing = ReadJSON.getString(jo, "easing", false, true); 579 } 580 581 582 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 583 public boolean equals(Object other) 584 { 585 if (other == null) return false; 586 if (other.getClass() != this.getClass()) return false; 587 588 KeyframeStyle o = (KeyframeStyle) other; 589 590 return 591 Objects.equals(this.offset, o.offset) 592 && Objects.equals(this.easing, o.easing); 593 } 594 595 /** Generates a Hash-Code for {@code 'this'} instance */ 596 public int hashCode() 597 { 598 return 599 Objects.hashCode(this.offset) 600 + Objects.hashCode(this.easing); 601 } 602 } 603 604 /** Event for when an animation has been cancelled. */ 605 public static class animationCanceled 606 extends BrowserEvent 607 implements java.io.Serializable 608 { 609 /** For Object Serialization. java.io.Serializable */ 610 protected static final long serialVersionUID = 1; 611 612 public boolean[] optionals() 613 { return new boolean[] { false, }; } 614 615 /** Id of the animation that was cancelled. */ 616 public final String id; 617 618 /** 619 * Constructor 620 * 621 * @param id Id of the animation that was cancelled. 622 */ 623 public animationCanceled(String id) 624 { 625 super("Animation", "animationCanceled", 1); 626 627 // Exception-Check(s) to ensure that if any parameters which are not declared as 628 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 629 630 if (id == null) BRDPC.throwNPE("id"); 631 632 this.id = id; 633 } 634 635 /** 636 * JSON Object Constructor 637 * @param jo A Json-Object having data about an instance of {@code 'animationCanceled'}. 638 */ 639 public animationCanceled (JsonObject jo) 640 { 641 super("Animation", "animationCanceled", 1); 642 643 this.id = ReadJSON.getString(jo, "id", false, true); 644 } 645 646 647 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 648 public boolean equals(Object other) 649 { 650 if (other == null) return false; 651 if (other.getClass() != this.getClass()) return false; 652 653 animationCanceled o = (animationCanceled) other; 654 655 return 656 Objects.equals(this.id, o.id); 657 } 658 659 /** Generates a Hash-Code for {@code 'this'} instance */ 660 public int hashCode() 661 { 662 return 663 Objects.hashCode(this.id); 664 } 665 } 666 667 /** Event for each animation that has been created. */ 668 public static class animationCreated 669 extends BrowserEvent 670 implements java.io.Serializable 671 { 672 /** For Object Serialization. java.io.Serializable */ 673 protected static final long serialVersionUID = 1; 674 675 public boolean[] optionals() 676 { return new boolean[] { false, }; } 677 678 /** Id of the animation that was created. */ 679 public final String id; 680 681 /** 682 * Constructor 683 * 684 * @param id Id of the animation that was created. 685 */ 686 public animationCreated(String id) 687 { 688 super("Animation", "animationCreated", 1); 689 690 // Exception-Check(s) to ensure that if any parameters which are not declared as 691 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 692 693 if (id == null) BRDPC.throwNPE("id"); 694 695 this.id = id; 696 } 697 698 /** 699 * JSON Object Constructor 700 * @param jo A Json-Object having data about an instance of {@code 'animationCreated'}. 701 */ 702 public animationCreated (JsonObject jo) 703 { 704 super("Animation", "animationCreated", 1); 705 706 this.id = ReadJSON.getString(jo, "id", false, true); 707 } 708 709 710 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 711 public boolean equals(Object other) 712 { 713 if (other == null) return false; 714 if (other.getClass() != this.getClass()) return false; 715 716 animationCreated o = (animationCreated) other; 717 718 return 719 Objects.equals(this.id, o.id); 720 } 721 722 /** Generates a Hash-Code for {@code 'this'} instance */ 723 public int hashCode() 724 { 725 return 726 Objects.hashCode(this.id); 727 } 728 } 729 730 /** Event for animation that has been started. */ 731 public static class animationStarted 732 extends BrowserEvent 733 implements java.io.Serializable 734 { 735 /** For Object Serialization. java.io.Serializable */ 736 protected static final long serialVersionUID = 1; 737 738 public boolean[] optionals() 739 { return new boolean[] { false, }; } 740 741 /** Animation that was started. */ 742 public final Animation._Animation animation; 743 744 /** 745 * Constructor 746 * 747 * @param animation Animation that was started. 748 */ 749 public animationStarted(Animation._Animation animation) 750 { 751 super("Animation", "animationStarted", 1); 752 753 // Exception-Check(s) to ensure that if any parameters which are not declared as 754 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 755 756 if (animation == null) BRDPC.throwNPE("animation"); 757 758 this.animation = animation; 759 } 760 761 /** 762 * JSON Object Constructor 763 * @param jo A Json-Object having data about an instance of {@code 'animationStarted'}. 764 */ 765 public animationStarted (JsonObject jo) 766 { 767 super("Animation", "animationStarted", 1); 768 769 this.animation = ReadJSON.getObject(jo, "animation", Animation._Animation.class, false, true); 770 } 771 772 773 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 774 public boolean equals(Object other) 775 { 776 if (other == null) return false; 777 if (other.getClass() != this.getClass()) return false; 778 779 animationStarted o = (animationStarted) other; 780 781 return 782 Objects.equals(this.animation, o.animation); 783 } 784 785 /** Generates a Hash-Code for {@code 'this'} instance */ 786 public int hashCode() 787 { 788 return 789 this.animation.hashCode(); 790 } 791 } 792 793 794 // Counter for keeping the WebSocket Request ID's distinct. 795 private static int counter = 1; 796 797 /** 798 * Disables animation domain notifications. 799 * 800 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 801 * {@link Ret0}></CODE> 802 * 803 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 804 * browser receives the invocation-request. 805 * 806 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 807 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 808 * {@code >} to ensure the Browser Function has run to completion. 809 */ 810 public static Script<String, JsonObject, Ret0> disable() 811 { 812 final int webSocketID = 8000000 + counter++; 813 final boolean[] optionals = new boolean[0]; 814 815 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 816 String requestJSON = WriteJSON.get( 817 parameterTypes.get("disable"), 818 parameterNames.get("disable"), 819 optionals, webSocketID, 820 "Animation.disable" 821 ); 822 823 // This Remote Command does not have a Return-Value. 824 return new Script<> 825 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 826 } 827 828 /** 829 * Enables animation domain notifications. 830 * 831 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 832 * {@link Ret0}></CODE> 833 * 834 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 835 * browser receives the invocation-request. 836 * 837 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 838 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 839 * {@code >} to ensure the Browser Function has run to completion. 840 */ 841 public static Script<String, JsonObject, Ret0> enable() 842 { 843 final int webSocketID = 8001000 + counter++; 844 final boolean[] optionals = new boolean[0]; 845 846 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 847 String requestJSON = WriteJSON.get( 848 parameterTypes.get("enable"), 849 parameterNames.get("enable"), 850 optionals, webSocketID, 851 "Animation.enable" 852 ); 853 854 // This Remote Command does not have a Return-Value. 855 return new Script<> 856 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 857 } 858 859 /** 860 * Returns the current time of the an animation. 861 * 862 * @param id Id of animation. 863 * 864 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 865 * Number></CODE> 866 * 867 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 868 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 869 * Number></CODE> will be returned. 870 * 871 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 872 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 873 * may be retrieved.</I> 874 * 875 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 876 * <BR /><BR /><UL CLASS=JDUL> 877 * <LI><CODE>Number (<B>currentTime</B></CODE>) 878 * <BR />Current time of the page. 879 * </LI> 880 * </UL> */ 881 public static Script<String, JsonObject, Number> getCurrentTime(String id) 882 { 883 // Exception-Check(s) to ensure that if any parameters which are not declared as 884 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 885 886 if (id == null) BRDPC.throwNPE("id"); 887 888 final int webSocketID = 8002000 + counter++; 889 final boolean[] optionals = { false, }; 890 891 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 892 String requestJSON = WriteJSON.get( 893 parameterTypes.get("getCurrentTime"), 894 parameterNames.get("getCurrentTime"), 895 optionals, webSocketID, 896 "Animation.getCurrentTime", 897 id 898 ); 899 900 // 'JSON Binding' ... Converts Browser Response-JSON to 'Number' 901 Function<JsonObject, Number> responseProcessor = (JsonObject jo) -> 902 ReadNumberJSON.get(jo, "currentTime", false, true); 903 904 // Pass the 'defaultSender' to Script-Constructor 905 // The sender that is used can be changed before executing script. 906 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 907 } 908 909 /** 910 * Gets the playback rate of the document timeline. 911 * 912 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 913 * Number></CODE> 914 * 915 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 916 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 917 * Number></CODE> will be returned. 918 * 919 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 920 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 921 * may be retrieved.</I> 922 * 923 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 924 * <BR /><BR /><UL CLASS=JDUL> 925 * <LI><CODE>Number (<B>playbackRate</B></CODE>) 926 * <BR />Playback rate for animations on page. 927 * </LI> 928 * </UL> */ 929 public static Script<String, JsonObject, Number> getPlaybackRate() 930 { 931 final int webSocketID = 8003000 + counter++; 932 final boolean[] optionals = new boolean[0]; 933 934 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 935 String requestJSON = WriteJSON.get( 936 parameterTypes.get("getPlaybackRate"), 937 parameterNames.get("getPlaybackRate"), 938 optionals, webSocketID, 939 "Animation.getPlaybackRate" 940 ); 941 942 // 'JSON Binding' ... Converts Browser Response-JSON to 'Number' 943 Function<JsonObject, Number> responseProcessor = (JsonObject jo) -> 944 ReadNumberJSON.get(jo, "playbackRate", false, true); 945 946 // Pass the 'defaultSender' to Script-Constructor 947 // The sender that is used can be changed before executing script. 948 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 949 } 950 951 /** 952 * Releases a set of animations to no longer be manipulated. 953 * 954 * @param animations List of animation ids to seek. 955 * 956 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 957 * {@link Ret0}></CODE> 958 * 959 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 960 * browser receives the invocation-request. 961 * 962 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 963 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 964 * {@code >} to ensure the Browser Function has run to completion. 965 */ 966 public static Script<String, JsonObject, Ret0> releaseAnimations(String[] animations) 967 { 968 // Exception-Check(s) to ensure that if any parameters which are not declared as 969 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 970 971 if (animations == null) BRDPC.throwNPE("animations"); 972 973 final int webSocketID = 8004000 + counter++; 974 final boolean[] optionals = { false, }; 975 976 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 977 String requestJSON = WriteJSON.get( 978 parameterTypes.get("releaseAnimations"), 979 parameterNames.get("releaseAnimations"), 980 optionals, webSocketID, 981 "Animation.releaseAnimations", 982 (Object) animations 983 ); 984 985 // This Remote Command does not have a Return-Value. 986 return new Script<> 987 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 988 } 989 990 /** 991 * Gets the remote object of the Animation. 992 * 993 * @param animationId Animation id. 994 * 995 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 996 * {@link RunTime.RemoteObject}></CODE> 997 * 998 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 999 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 1000 * {@link RunTime.RemoteObject}></CODE> will be returned. 1001 * 1002 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 1003 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 1004 * may be retrieved.</I> 1005 * 1006 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 1007 * <BR /><BR /><UL CLASS=JDUL> 1008 * <LI><CODE>{@link RunTime.RemoteObject} (<B>remoteObject</B></CODE>) 1009 * <BR />Corresponding remote object. 1010 * </LI> 1011 * </UL> */ 1012 public static Script<String, JsonObject, RunTime.RemoteObject> resolveAnimation 1013 (String animationId) 1014 { 1015 // Exception-Check(s) to ensure that if any parameters which are not declared as 1016 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1017 1018 if (animationId == null) BRDPC.throwNPE("animationId"); 1019 1020 final int webSocketID = 8005000 + counter++; 1021 final boolean[] optionals = { false, }; 1022 1023 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1024 String requestJSON = WriteJSON.get( 1025 parameterTypes.get("resolveAnimation"), 1026 parameterNames.get("resolveAnimation"), 1027 optionals, webSocketID, 1028 "Animation.resolveAnimation", 1029 animationId 1030 ); 1031 1032 // 'JSON Binding' ... Converts Browser Response-JSON to 'RunTime.RemoteObject' 1033 Function<JsonObject, RunTime.RemoteObject> responseProcessor = (JsonObject jo) -> 1034 ReadJSON.getObject(jo, "remoteObject", RunTime.RemoteObject.class, false, true); 1035 1036 // Pass the 'defaultSender' to Script-Constructor 1037 // The sender that is used can be changed before executing script. 1038 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 1039 } 1040 1041 /** 1042 * Seek a set of animations to a particular time within each animation. 1043 * 1044 * @param animations List of animation ids to seek. 1045 * 1046 * @param currentTime Set the current time of each animation. 1047 * 1048 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1049 * {@link Ret0}></CODE> 1050 * 1051 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1052 * browser receives the invocation-request. 1053 * 1054 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1055 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1056 * {@code >} to ensure the Browser Function has run to completion. 1057 */ 1058 public static Script<String, JsonObject, Ret0> seekAnimations 1059 (String[] animations, Number currentTime) 1060 { 1061 // Exception-Check(s) to ensure that if any parameters which are not declared as 1062 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1063 1064 if (animations == null) BRDPC.throwNPE("animations"); 1065 if (currentTime == null) BRDPC.throwNPE("currentTime"); 1066 1067 final int webSocketID = 8006000 + counter++; 1068 final boolean[] optionals = { false, false, }; 1069 1070 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1071 String requestJSON = WriteJSON.get( 1072 parameterTypes.get("seekAnimations"), 1073 parameterNames.get("seekAnimations"), 1074 optionals, webSocketID, 1075 "Animation.seekAnimations", 1076 animations, currentTime 1077 ); 1078 1079 // This Remote Command does not have a Return-Value. 1080 return new Script<> 1081 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 1082 } 1083 1084 /** 1085 * Sets the paused state of a set of animations. 1086 * 1087 * @param animations Animations to set the pause state of. 1088 * 1089 * @param paused Paused state to set to. 1090 * 1091 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1092 * {@link Ret0}></CODE> 1093 * 1094 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1095 * browser receives the invocation-request. 1096 * 1097 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1098 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1099 * {@code >} to ensure the Browser Function has run to completion. 1100 */ 1101 public static Script<String, JsonObject, Ret0> setPaused 1102 (String[] animations, boolean paused) 1103 { 1104 // Exception-Check(s) to ensure that if any parameters which are not declared as 1105 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1106 1107 if (animations == null) BRDPC.throwNPE("animations"); 1108 1109 final int webSocketID = 8007000 + counter++; 1110 final boolean[] optionals = { false, false, }; 1111 1112 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1113 String requestJSON = WriteJSON.get( 1114 parameterTypes.get("setPaused"), 1115 parameterNames.get("setPaused"), 1116 optionals, webSocketID, 1117 "Animation.setPaused", 1118 animations, paused 1119 ); 1120 1121 // This Remote Command does not have a Return-Value. 1122 return new Script<> 1123 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 1124 } 1125 1126 /** 1127 * Sets the playback rate of the document timeline. 1128 * 1129 * @param playbackRate Playback rate for animations on page 1130 * 1131 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1132 * {@link Ret0}></CODE> 1133 * 1134 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1135 * browser receives the invocation-request. 1136 * 1137 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1138 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1139 * {@code >} to ensure the Browser Function has run to completion. 1140 */ 1141 public static Script<String, JsonObject, Ret0> setPlaybackRate(Number playbackRate) 1142 { 1143 // Exception-Check(s) to ensure that if any parameters which are not declared as 1144 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1145 1146 if (playbackRate == null) BRDPC.throwNPE("playbackRate"); 1147 1148 final int webSocketID = 8008000 + counter++; 1149 final boolean[] optionals = { false, }; 1150 1151 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1152 String requestJSON = WriteJSON.get( 1153 parameterTypes.get("setPlaybackRate"), 1154 parameterNames.get("setPlaybackRate"), 1155 optionals, webSocketID, 1156 "Animation.setPlaybackRate", 1157 playbackRate 1158 ); 1159 1160 // This Remote Command does not have a Return-Value. 1161 return new Script<> 1162 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 1163 } 1164 1165 /** 1166 * Sets the timing of an animation node. 1167 * 1168 * @param animationId Animation id. 1169 * 1170 * @param duration Duration of the animation. 1171 * 1172 * @param delay Delay of the animation. 1173 * 1174 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1175 * {@link Ret0}></CODE> 1176 * 1177 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1178 * browser receives the invocation-request. 1179 * 1180 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1181 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1182 * {@code >} to ensure the Browser Function has run to completion. 1183 */ 1184 public static Script<String, JsonObject, Ret0> setTiming 1185 (String animationId, Number duration, Number delay) 1186 { 1187 // Exception-Check(s) to ensure that if any parameters which are not declared as 1188 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1189 1190 if (animationId == null) BRDPC.throwNPE("animationId"); 1191 if (duration == null) BRDPC.throwNPE("duration"); 1192 if (delay == null) BRDPC.throwNPE("delay"); 1193 1194 final int webSocketID = 8009000 + counter++; 1195 final boolean[] optionals = { false, false, false, }; 1196 1197 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1198 String requestJSON = WriteJSON.get( 1199 parameterTypes.get("setTiming"), 1200 parameterNames.get("setTiming"), 1201 optionals, webSocketID, 1202 "Animation.setTiming", 1203 animationId, duration, delay 1204 ); 1205 1206 // This Remote Command does not have a Return-Value. 1207 return new Script<> 1208 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 1209 } 1210 1211}