001package Torello.Browser.BrowserAPI;
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.Browser.BrowserEvent;
013import Torello.Browser.JavaScriptAPI.*;
014import Torello.Browser.helper.*;
015
016import Torello.Java.Additional.*;
017import Torello.Java.JSON.*;
018
019import static Torello.Java.JSON.JFlag.*;
020
021import Torello.Java.StrCmpr;
022import Torello.JavaDoc.StaticFunctional;
023import Torello.JavaDoc.JDHeaderBackgroundImg;
024import Torello.JavaDoc.Excuse;
025
026/**
027 * <SPAN CLASS=COPIEDJDK><B><CODE>[No Description Provided by Google]</CODE></B></SPAN>
028 * 
029 * <EMBED CLASS='external-html' DATA-FILE-ID=CODE_GEN_NOTE>
030 */
031@StaticFunctional(Excused={"counter"}, Excuses={Excuse.CONFIGURATION})
032@JDHeaderBackgroundImg(EmbedTagFileID="WOOD_PLANK_NOTE")
033public class Input
034{
035    // ********************************************************************************************
036    // ********************************************************************************************
037    // Class Header Stuff
038    // ********************************************************************************************
039    // ********************************************************************************************
040
041
042    // No Pubic Constructors
043    private Input () { }
044
045    // These two Vector's are used by all the "Methods" exported by this class.  java.lang.reflect
046    // is used to generate the JSON String's.  It saves thousands of lines of Auto-Generated Code.
047    private static final Map<String, Vector<String>>    parameterNames = new HashMap<>();
048    private static final Map<String, Vector<Class<?>>>  parameterTypes = new HashMap<>();
049
050    // Some Methods do not take any parameters - for instance all the "enable()" and "disable()"
051    // I simply could not get ride of RAW-TYPES and UNCHECKED warnings... so there are now,
052    // offically, two empty-vectors.  One for String's, and the other for Classes.
053
054    private static final Vector<String>     EMPTY_VEC_STR = new Vector<>();
055    private static final Vector<Class<?>>   EMPTY_VEC_CLASS = new Vector<>();
056
057    static
058    {
059        for (Method m : Input.class.getMethods())
060        {
061            // This doesn't work!  The parameter names are all "arg0" ... "argN"
062            // It works for java.lang.reflect.Field, BUT NOT java.lang.reflect.Parameter!
063            //
064            // Vector<String> parameterNamesList = new Vector<>(); -- NOPE!
065
066            Vector<Class<?>> parameterTypesList = new Vector<>();
067        
068            for (Parameter p : m.getParameters()) parameterTypesList.add(p.getType());
069
070            parameterTypes.put(
071                m.getName(),
072                (parameterTypesList.size() > 0) ? parameterTypesList : EMPTY_VEC_CLASS
073            );
074        }
075    }
076
077    static
078    {
079        Vector<String> v = null;
080
081        v = new Vector<String>(5);
082        parameterNames.put("dispatchDragEvent", v);
083        Collections.addAll(v, new String[]
084        { "type", "x", "y", "data", "modifiers", });
085
086        v = new Vector<String>(15);
087        parameterNames.put("dispatchKeyEvent", v);
088        Collections.addAll(v, new String[]
089        { "type", "modifiers", "timestamp", "text", "unmodifiedText", "keyIdentifier", "code", "key", "windowsVirtualKeyCode", "nativeVirtualKeyCode", "autoRepeat", "isKeypad", "isSystemKey", "location", "commands", });
090
091        v = new Vector<String>(1);
092        parameterNames.put("insertText", v);
093        Collections.addAll(v, new String[]
094        { "text", });
095
096        v = new Vector<String>(5);
097        parameterNames.put("imeSetComposition", v);
098        Collections.addAll(v, new String[]
099        { "text", "selectionStart", "selectionEnd", "replacementStart", "replacementEnd", });
100
101        v = new Vector<String>(16);
102        parameterNames.put("dispatchMouseEvent", v);
103        Collections.addAll(v, new String[]
104        { "type", "x", "y", "modifiers", "timestamp", "button", "buttons", "clickCount", "force", "tangentialPressure", "tiltX", "tiltY", "twist", "deltaX", "deltaY", "pointerType", });
105
106        v = new Vector<String>(4);
107        parameterNames.put("dispatchTouchEvent", v);
108        Collections.addAll(v, new String[]
109        { "type", "touchPoints", "modifiers", "timestamp", });
110
111        parameterNames.put("cancelDragging", EMPTY_VEC_STR);
112
113        v = new Vector<String>(9);
114        parameterNames.put("emulateTouchFromMouseEvent", v);
115        Collections.addAll(v, new String[]
116        { "type", "x", "y", "button", "timestamp", "deltaX", "deltaY", "modifiers", "clickCount", });
117
118        v = new Vector<String>(1);
119        parameterNames.put("setIgnoreInputEvents", v);
120        Collections.addAll(v, new String[]
121        { "ignore", });
122
123        v = new Vector<String>(1);
124        parameterNames.put("setInterceptDrags", v);
125        Collections.addAll(v, new String[]
126        { "enabled", });
127
128        v = new Vector<String>(5);
129        parameterNames.put("synthesizePinchGesture", v);
130        Collections.addAll(v, new String[]
131        { "x", "y", "scaleFactor", "relativeSpeed", "gestureSourceType", });
132
133        v = new Vector<String>(12);
134        parameterNames.put("synthesizeScrollGesture", v);
135        Collections.addAll(v, new String[]
136        { "x", "y", "xDistance", "yDistance", "xOverscroll", "yOverscroll", "preventFling", "speed", "gestureSourceType", "repeatCount", "repeatDelayMs", "interactionMarkerName", });
137
138        v = new Vector<String>(5);
139        parameterNames.put("synthesizeTapGesture", v);
140        Collections.addAll(v, new String[]
141        { "x", "y", "duration", "tapCount", "gestureSourceType", });
142    }
143
144
145    // ********************************************************************************************
146    // ********************************************************************************************
147    // Types - Static Inner Classes
148    // ********************************************************************************************
149    // ********************************************************************************************
150
151    // public static class TimeSinceEpoch => Number
152    
153    /**
154     * <CODE>[No Description Provided by Google]</CODE>
155     * <BR /><B CLASS=Exp>EXPERIMENTAL</B>
156     */
157    public static final String[] GestureSourceType =
158    { "default", "touch", "mouse", };
159    
160    /** <CODE>[No Description Provided by Google]</CODE> */
161    public static final String[] MouseButton =
162    { "none", "left", "middle", "right", "back", "forward", };
163    
164    /** <CODE>[No Description Provided by Google]</CODE> */
165    public static class TouchPoint
166        extends BaseType
167        implements java.io.Serializable
168    {
169        /** For Object Serialization.  java.io.Serializable */
170        protected static final long serialVersionUID = 1;
171        
172        public boolean[] optionals()
173        { return new boolean[] { false, false, true, true, true, true, true, true, true, true, true, }; }
174        
175        /** X coordinate of the event relative to the main frame's viewport in CSS pixels. */
176        public final Number x;
177        
178        /**
179         * Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to
180         * the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
181         */
182        public final Number y;
183        
184        /**
185         * X radius of the touch area (default: 1.0).
186         * <BR /><B CLASS=Opt>OPTIONAL</B>
187         */
188        public final Number radiusX;
189        
190        /**
191         * Y radius of the touch area (default: 1.0).
192         * <BR /><B CLASS=Opt>OPTIONAL</B>
193         */
194        public final Number radiusY;
195        
196        /**
197         * Rotation angle (default: 0.0).
198         * <BR /><B CLASS=Opt>OPTIONAL</B>
199         */
200        public final Number rotationAngle;
201        
202        /**
203         * Force (default: 1.0).
204         * <BR /><B CLASS=Opt>OPTIONAL</B>
205         */
206        public final Number force;
207        
208        /**
209         * The normalized tangential pressure, which has a range of [-1,1] (default: 0).
210         * <BR /><B CLASS=Opt>OPTIONAL</B>
211        <B CLASS=Exp>EXPERIMENTAL</B>
212         */
213        public final Number tangentialPressure;
214        
215        /**
216         * The plane angle between the Y-Z plane and the plane containing both the stylus axis and the Y axis, in degrees of the range [-90,90], a positive tiltX is to the right (default: 0)
217         * <BR /><B CLASS=Opt>OPTIONAL</B>
218         */
219        public final Number tiltX;
220        
221        /**
222         * The plane angle between the X-Z plane and the plane containing both the stylus axis and the X axis, in degrees of the range [-90,90], a positive tiltY is towards the user (default: 0).
223         * <BR /><B CLASS=Opt>OPTIONAL</B>
224         */
225        public final Number tiltY;
226        
227        /**
228         * The clockwise rotation of a pen stylus around its own major axis, in degrees in the range [0,359] (default: 0).
229         * <BR /><B CLASS=Opt>OPTIONAL</B>
230        <B CLASS=Exp>EXPERIMENTAL</B>
231         */
232        public final Integer twist;
233        
234        /**
235         * Identifier used to track touch sources between events, must be unique within an event.
236         * <BR /><B CLASS=Opt>OPTIONAL</B>
237         */
238        public final Number id;
239        
240        /**
241         * Constructor
242         *
243         * @param x X coordinate of the event relative to the main frame's viewport in CSS pixels.
244         * 
245         * @param y 
246         * Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to
247         * the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
248         * 
249         * @param radiusX X radius of the touch area (default: 1.0).
250         * <BR /><B CLASS=Opt>OPTIONAL</B>
251         * 
252         * @param radiusY Y radius of the touch area (default: 1.0).
253         * <BR /><B CLASS=Opt>OPTIONAL</B>
254         * 
255         * @param rotationAngle Rotation angle (default: 0.0).
256         * <BR /><B CLASS=Opt>OPTIONAL</B>
257         * 
258         * @param force Force (default: 1.0).
259         * <BR /><B CLASS=Opt>OPTIONAL</B>
260         * 
261         * @param tangentialPressure The normalized tangential pressure, which has a range of [-1,1] (default: 0).
262         * <BR /><B CLASS=Opt>OPTIONAL</B><B CLASS=Exp>EXPERIMENTAL</B>
263         * 
264         * @param tiltX The plane angle between the Y-Z plane and the plane containing both the stylus axis and the Y axis, in degrees of the range [-90,90], a positive tiltX is to the right (default: 0)
265         * <BR /><B CLASS=Opt>OPTIONAL</B>
266         * 
267         * @param tiltY The plane angle between the X-Z plane and the plane containing both the stylus axis and the X axis, in degrees of the range [-90,90], a positive tiltY is towards the user (default: 0).
268         * <BR /><B CLASS=Opt>OPTIONAL</B>
269         * 
270         * @param twist The clockwise rotation of a pen stylus around its own major axis, in degrees in the range [0,359] (default: 0).
271         * <BR /><B CLASS=Opt>OPTIONAL</B><B CLASS=Exp>EXPERIMENTAL</B>
272         * 
273         * @param id Identifier used to track touch sources between events, must be unique within an event.
274         * <BR /><B CLASS=Opt>OPTIONAL</B>
275         */
276        public TouchPoint(
277                Number x, Number y, Number radiusX, Number radiusY, Number rotationAngle, 
278                Number force, Number tangentialPressure, Number tiltX, Number tiltY, Integer twist, 
279                Number id
280            )
281        {
282            // Exception-Check(s) to ensure that if any parameters which are not declared as
283            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
284            
285            if (x == null) THROWS.throwNPE("x");
286            if (y == null) THROWS.throwNPE("y");
287            
288            this.x                   = x;
289            this.y                   = y;
290            this.radiusX             = radiusX;
291            this.radiusY             = radiusY;
292            this.rotationAngle       = rotationAngle;
293            this.force               = force;
294            this.tangentialPressure  = tangentialPressure;
295            this.tiltX               = tiltX;
296            this.tiltY               = tiltY;
297            this.twist               = twist;
298            this.id                  = id;
299        }
300        
301        /**
302         * JSON Object Constructor
303         * @param jo A Json-Object having data about an instance of {@code 'TouchPoint'}.
304         */
305        public TouchPoint (JsonObject jo)
306        {
307            this.x                   = ReadNumberJSON.get(jo, "x", false, true);
308            this.y                   = ReadNumberJSON.get(jo, "y", false, true);
309            this.radiusX             = ReadNumberJSON.get(jo, "radiusX", true, false);
310            this.radiusY             = ReadNumberJSON.get(jo, "radiusY", true, false);
311            this.rotationAngle       = ReadNumberJSON.get(jo, "rotationAngle", true, false);
312            this.force               = ReadNumberJSON.get(jo, "force", true, false);
313            this.tangentialPressure  = ReadNumberJSON.get(jo, "tangentialPressure", true, false);
314            this.tiltX               = ReadNumberJSON.get(jo, "tiltX", true, false);
315            this.tiltY               = ReadNumberJSON.get(jo, "tiltY", true, false);
316            this.twist               = ReadBoxedJSON.getInteger(jo, "twist", true);
317            this.id                  = ReadNumberJSON.get(jo, "id", true, false);
318        }
319        
320        
321        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
322        public boolean equals(Object other)
323        {
324            if (this == other)                       return true;
325            if (other == null)                       return false;
326            if (other.getClass() != this.getClass()) return false;
327        
328            TouchPoint o = (TouchPoint) other;
329        
330            return
331                    Objects.equals(this.x, o.x)
332                &&  Objects.equals(this.y, o.y)
333                &&  Objects.equals(this.radiusX, o.radiusX)
334                &&  Objects.equals(this.radiusY, o.radiusY)
335                &&  Objects.equals(this.rotationAngle, o.rotationAngle)
336                &&  Objects.equals(this.force, o.force)
337                &&  Objects.equals(this.tangentialPressure, o.tangentialPressure)
338                &&  Objects.equals(this.tiltX, o.tiltX)
339                &&  Objects.equals(this.tiltY, o.tiltY)
340                &&  Objects.equals(this.twist, o.twist)
341                &&  Objects.equals(this.id, o.id);
342        }
343        
344        /** Generates a Hash-Code for {@code 'this'} instance */
345        public int hashCode()
346        {
347            return
348                    Objects.hashCode(this.x)
349                +   Objects.hashCode(this.y)
350                +   Objects.hashCode(this.radiusX)
351                +   Objects.hashCode(this.radiusY)
352                +   Objects.hashCode(this.rotationAngle)
353                +   Objects.hashCode(this.force)
354                +   Objects.hashCode(this.tangentialPressure)
355                +   Objects.hashCode(this.tiltX)
356                +   Objects.hashCode(this.tiltY)
357                +   Objects.hashCode(this.twist)
358                +   Objects.hashCode(this.id);
359        }
360    }
361    
362    /**
363     * <CODE>[No Description Provided by Google]</CODE>
364     * <BR /><B CLASS=Exp>EXPERIMENTAL</B>
365     */
366    public static class DragDataItem
367        extends BaseType
368        implements java.io.Serializable
369    {
370        /** For Object Serialization.  java.io.Serializable */
371        protected static final long serialVersionUID = 1;
372        
373        public boolean[] optionals()
374        { return new boolean[] { false, false, true, true, }; }
375        
376        /** Mime type of the dragged data. */
377        public final String mimeType;
378        
379        /**
380         * Depending of the value of {@code mimeType}, it contains the dragged link,
381         * text, HTML markup or any other data.
382         */
383        public final String data;
384        
385        /**
386         * Title associated with a link. Only valid when {@code mimeType} == "text/uri-list".
387         * <BR /><B CLASS=Opt>OPTIONAL</B>
388         */
389        public final String title;
390        
391        /**
392         * Stores the base URL for the contained markup. Only valid when {@code mimeType}
393         * == "text/html".
394         * <BR /><B CLASS=Opt>OPTIONAL</B>
395         */
396        public final String baseURL;
397        
398        /**
399         * Constructor
400         *
401         * @param mimeType Mime type of the dragged data.
402         * 
403         * @param data 
404         * Depending of the value of {@code mimeType}, it contains the dragged link,
405         * text, HTML markup or any other data.
406         * 
407         * @param title Title associated with a link. Only valid when {@code mimeType} == "text/uri-list".
408         * <BR /><B CLASS=Opt>OPTIONAL</B>
409         * 
410         * @param baseURL 
411         * Stores the base URL for the contained markup. Only valid when {@code mimeType}
412         * == "text/html".
413         * <BR /><B CLASS=Opt>OPTIONAL</B>
414         */
415        public DragDataItem(String mimeType, String data, String title, String baseURL)
416        {
417            // Exception-Check(s) to ensure that if any parameters which are not declared as
418            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
419            
420            if (mimeType == null) THROWS.throwNPE("mimeType");
421            if (data == null)     THROWS.throwNPE("data");
422            
423            this.mimeType  = mimeType;
424            this.data      = data;
425            this.title     = title;
426            this.baseURL   = baseURL;
427        }
428        
429        /**
430         * JSON Object Constructor
431         * @param jo A Json-Object having data about an instance of {@code 'DragDataItem'}.
432         */
433        public DragDataItem (JsonObject jo)
434        {
435            this.mimeType  = ReadJSON.getString(jo, "mimeType", false, true);
436            this.data      = ReadJSON.getString(jo, "data", false, true);
437            this.title     = ReadJSON.getString(jo, "title", true, false);
438            this.baseURL   = ReadJSON.getString(jo, "baseURL", true, false);
439        }
440        
441        
442        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
443        public boolean equals(Object other)
444        {
445            if (this == other)                       return true;
446            if (other == null)                       return false;
447            if (other.getClass() != this.getClass()) return false;
448        
449            DragDataItem o = (DragDataItem) other;
450        
451            return
452                    Objects.equals(this.mimeType, o.mimeType)
453                &&  Objects.equals(this.data, o.data)
454                &&  Objects.equals(this.title, o.title)
455                &&  Objects.equals(this.baseURL, o.baseURL);
456        }
457        
458        /** Generates a Hash-Code for {@code 'this'} instance */
459        public int hashCode()
460        {
461            return
462                    Objects.hashCode(this.mimeType)
463                +   Objects.hashCode(this.data)
464                +   Objects.hashCode(this.title)
465                +   Objects.hashCode(this.baseURL);
466        }
467    }
468    
469    /**
470     * <CODE>[No Description Provided by Google]</CODE>
471     * <BR /><B CLASS=Exp>EXPERIMENTAL</B>
472     */
473    public static class DragData
474        extends BaseType
475        implements java.io.Serializable
476    {
477        /** For Object Serialization.  java.io.Serializable */
478        protected static final long serialVersionUID = 1;
479        
480        public boolean[] optionals()
481        { return new boolean[] { false, true, false, }; }
482        
483        /** <CODE>[No Description Provided by Google]</CODE> */
484        public final Input.DragDataItem[] items;
485        
486        /**
487         * List of filenames that should be included when dropping
488         * <BR /><B CLASS=Opt>OPTIONAL</B>
489         */
490        public final String[] files;
491        
492        /** Bit field representing allowed drag operations. Copy = 1, Link = 2, Move = 16 */
493        public final int dragOperationsMask;
494        
495        /**
496         * Constructor
497         *
498         * @param items -
499         * 
500         * @param files List of filenames that should be included when dropping
501         * <BR /><B CLASS=Opt>OPTIONAL</B>
502         * 
503         * @param dragOperationsMask Bit field representing allowed drag operations. Copy = 1, Link = 2, Move = 16
504         */
505        public DragData(Input.DragDataItem[] items, String[] files, int dragOperationsMask)
506        {
507            // Exception-Check(s) to ensure that if any parameters which are not declared as
508            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
509            
510            if (items == null) THROWS.throwNPE("items");
511            
512            this.items               = items;
513            this.files               = files;
514            this.dragOperationsMask  = dragOperationsMask;
515        }
516        
517        /**
518         * JSON Object Constructor
519         * @param jo A Json-Object having data about an instance of {@code 'DragData'}.
520         */
521        public DragData (JsonObject jo)
522        {
523            this.items = (jo.getJsonArray("items") == null)
524                ? null
525                : RJArrIntoStream.objArr(jo.getJsonArray("items"), null, 0, Input.DragDataItem.class).toArray(Input.DragDataItem[]::new);
526        
527            this.files = (jo.getJsonArray("files") == null)
528                ? null
529                : RJArrIntoStream.strArr(jo.getJsonArray("files"), null, 0).toArray(String[]::new);
530        
531            this.dragOperationsMask  = ReadPrimJSON.getInt(jo, "dragOperationsMask");
532        }
533        
534        
535        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
536        public boolean equals(Object other)
537        {
538            if (this == other)                       return true;
539            if (other == null)                       return false;
540            if (other.getClass() != this.getClass()) return false;
541        
542            DragData o = (DragData) other;
543        
544            return
545                    Arrays.deepEquals(this.items, o.items)
546                &&  Arrays.deepEquals(this.files, o.files)
547                &&  (this.dragOperationsMask == o.dragOperationsMask);
548        }
549        
550        /** Generates a Hash-Code for {@code 'this'} instance */
551        public int hashCode()
552        {
553            return
554                    Arrays.deepHashCode(this.items)
555                +   Arrays.deepHashCode(this.files)
556                +   this.dragOperationsMask;
557        }
558    }
559    
560    /**
561     * Emitted only when {@code Input.setInterceptDrags} is enabled. Use this data with {@code Input.dispatchDragEvent} to
562     * restore normal drag and drop behavior.
563     * <BR /><B CLASS=Exp>EXPERIMENTAL</B>
564     */
565    public static class dragIntercepted
566        extends BrowserEvent
567        implements java.io.Serializable
568    {
569        /** For Object Serialization.  java.io.Serializable */
570        protected static final long serialVersionUID = 1;
571        
572        public boolean[] optionals()
573        { return new boolean[] { false, }; }
574        
575        /** <CODE>[No Description Provided by Google]</CODE> */
576        public final Input.DragData data;
577        
578        /**
579         * Constructor
580         *
581         * @param data -
582         */
583        public dragIntercepted(Input.DragData data)
584        {
585            super("Input", "dragIntercepted", 1);
586            
587            // Exception-Check(s) to ensure that if any parameters which are not declared as
588            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
589            
590            if (data == null) THROWS.throwNPE("data");
591            
592            this.data  = data;
593        }
594        
595        /**
596         * JSON Object Constructor
597         * @param jo A Json-Object having data about an instance of {@code 'dragIntercepted'}.
598         */
599        public dragIntercepted (JsonObject jo)
600        {
601            super("Input", "dragIntercepted", 1);
602        
603            this.data  = ReadJSON.getObject(jo, "data", Input.DragData.class, false, true);
604        }
605        
606        
607        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
608        public boolean equals(Object other)
609        {
610            if (this == other)                       return true;
611            if (other == null)                       return false;
612            if (other.getClass() != this.getClass()) return false;
613        
614            dragIntercepted o = (dragIntercepted) other;
615        
616            return
617                    Objects.equals(this.data, o.data);
618        }
619        
620        /** Generates a Hash-Code for {@code 'this'} instance */
621        public int hashCode()
622        {
623            return
624                    this.data.hashCode();
625        }
626    }
627    
628    
629    // Counter for keeping the WebSocket Request ID's distinct.
630    private static int counter = 1;
631    
632    /**
633     * Dispatches a drag event into the page.
634     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
635     * 
636     * @param type Type of the drag event.
637     * <BR />Acceptable Values: ["dragEnter", "dragOver", "drop", "dragCancel"]
638     * 
639     * @param x X coordinate of the event relative to the main frame's viewport in CSS pixels.
640     * 
641     * @param y 
642     * Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to
643     * the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
644     * 
645     * @param data -
646     * 
647     * @param modifiers 
648     * Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
649     * (default: 0).
650     * <BR /><B CLASS=Opt>OPTIONAL</B>
651     * 
652     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
653     * {@link Ret0}&gt;</CODE>
654     *
655     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
656     * browser receives the invocation-request.
657     *
658     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
659     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
660     * {@code >} to ensure the Browser Function has run to completion.
661     */
662    public static Script<String, JsonObject, Ret0> dispatchDragEvent
663        (String type, Number x, Number y, Input.DragData data, Integer modifiers)
664    {
665        // Exception-Check(s) to ensure that if any parameters which are not declared as
666        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
667        
668        if (type == null) THROWS.throwNPE("type");
669        if (x == null)    THROWS.throwNPE("x");
670        if (y == null)    THROWS.throwNPE("y");
671        if (data == null) THROWS.throwNPE("data");
672        
673        // Exception-Check(s) to ensure that if any parameters which must adhere to a
674        // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
675        
676        THROWS.checkIAE(
677            "type", type,
678            "dragEnter", "dragOver", "drop", "dragCancel"
679        );
680        
681        final int       webSocketID = 28000000 + counter++;
682        final boolean[] optionals   = { false, false, false, false, true, };
683        
684        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
685        String requestJSON = WriteJSON.get(
686            parameterTypes.get("dispatchDragEvent"),
687            parameterNames.get("dispatchDragEvent"),
688            optionals, webSocketID,
689            "Input.dispatchDragEvent",
690            type, x, y, data, modifiers
691        );
692        
693        // This Remote Command does not have a Return-Value.
694        return new Script<>
695            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
696    }
697    
698    /**
699     * Dispatches a key event to the page.
700     * 
701     * @param type Type of the key event.
702     * <BR />Acceptable Values: ["keyDown", "keyUp", "rawKeyDown", "char"]
703     * 
704     * @param modifiers 
705     * Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
706     * (default: 0).
707     * <BR /><B CLASS=Opt>OPTIONAL</B>
708     * 
709     * @param timestamp Time at which the event occurred.
710     * <BR /><B CLASS=Opt>OPTIONAL</B>
711     * 
712     * @param text 
713     * Text as generated by processing a virtual key code with a keyboard layout. Not needed for
714     * for {@code keyUp} and {@code rawKeyDown} events (default: "")
715     * <BR /><B CLASS=Opt>OPTIONAL</B>
716     * 
717     * @param unmodifiedText 
718     * Text that would have been generated by the keyboard if no modifiers were pressed (except for
719     * shift). Useful for shortcut (accelerator) key handling (default: "").
720     * <BR /><B CLASS=Opt>OPTIONAL</B>
721     * 
722     * @param keyIdentifier Unique key identifier (e.g., 'U+0041') (default: "").
723     * <BR /><B CLASS=Opt>OPTIONAL</B>
724     * 
725     * @param code Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: "").
726     * <BR /><B CLASS=Opt>OPTIONAL</B>
727     * 
728     * @param key 
729     * Unique DOM defined string value describing the meaning of the key in the context of active
730     * modifiers, keyboard layout, etc (e.g., 'AltGr') (default: "").
731     * <BR /><B CLASS=Opt>OPTIONAL</B>
732     * 
733     * @param windowsVirtualKeyCode Windows virtual key code (default: 0).
734     * <BR /><B CLASS=Opt>OPTIONAL</B>
735     * 
736     * @param nativeVirtualKeyCode Native virtual key code (default: 0).
737     * <BR /><B CLASS=Opt>OPTIONAL</B>
738     * 
739     * @param autoRepeat Whether the event was generated from auto repeat (default: false).
740     * <BR /><B CLASS=Opt>OPTIONAL</B>
741     * 
742     * @param isKeypad Whether the event was generated from the keypad (default: false).
743     * <BR /><B CLASS=Opt>OPTIONAL</B>
744     * 
745     * @param isSystemKey Whether the event was a system key event (default: false).
746     * <BR /><B CLASS=Opt>OPTIONAL</B>
747     * 
748     * @param location 
749     * Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default:
750     * 0).
751     * <BR /><B CLASS=Opt>OPTIONAL</B>
752     * 
753     * @param commands 
754     * Editing commands to send with the key event (e.g., 'selectAll') (default: []).
755     * These are related to but not equal the command names used in {@code document.execCommand} and NSStandardKeyBindingResponding.
756     * See https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/editing/commands/editor_command_names.h for valid command names.
757     * <BR /><B CLASS=Opt>OPTIONAL</B><B CLASS=Exp>EXPERIMENTAL</B>
758     * 
759     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
760     * {@link Ret0}&gt;</CODE>
761     *
762     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
763     * browser receives the invocation-request.
764     *
765     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
766     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
767     * {@code >} to ensure the Browser Function has run to completion.
768     */
769    public static Script<String, JsonObject, Ret0> dispatchKeyEvent(
770            String type, Integer modifiers, Number timestamp, String text, String unmodifiedText, 
771            String keyIdentifier, String code, String key, Integer windowsVirtualKeyCode, 
772            Integer nativeVirtualKeyCode, Boolean autoRepeat, Boolean isKeypad, Boolean isSystemKey, 
773            Integer location, String[] commands
774        )
775    {
776        // Exception-Check(s) to ensure that if any parameters which are not declared as
777        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
778        
779        if (type == null) THROWS.throwNPE("type");
780        
781        // Exception-Check(s) to ensure that if any parameters which must adhere to a
782        // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
783        
784        THROWS.checkIAE(
785            "type", type,
786            "keyDown", "keyUp", "rawKeyDown", "char"
787        );
788        
789        final int       webSocketID = 28001000 + counter++;
790        final boolean[] optionals   = { false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, };
791        
792        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
793        String requestJSON = WriteJSON.get(
794            parameterTypes.get("dispatchKeyEvent"),
795            parameterNames.get("dispatchKeyEvent"),
796            optionals, webSocketID,
797            "Input.dispatchKeyEvent",
798            type, modifiers, timestamp, text, unmodifiedText, keyIdentifier, code, key,
799            windowsVirtualKeyCode, nativeVirtualKeyCode, autoRepeat, isKeypad, isSystemKey,
800            location, commands
801        );
802        
803        // This Remote Command does not have a Return-Value.
804        return new Script<>
805            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
806    }
807    
808    /**
809     * This method emulates inserting text that doesn't come from a key press,
810     * for example an emoji keyboard or an IME.
811     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
812     * 
813     * @param text The text to insert.
814     * 
815     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
816     * {@link Ret0}&gt;</CODE>
817     *
818     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
819     * browser receives the invocation-request.
820     *
821     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
822     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
823     * {@code >} to ensure the Browser Function has run to completion.
824     */
825    public static Script<String, JsonObject, Ret0> insertText(String text)
826    {
827        // Exception-Check(s) to ensure that if any parameters which are not declared as
828        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
829        
830        if (text == null) THROWS.throwNPE("text");
831        
832        final int       webSocketID = 28002000 + counter++;
833        final boolean[] optionals   = { false, };
834        
835        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
836        String requestJSON = WriteJSON.get(
837            parameterTypes.get("insertText"),
838            parameterNames.get("insertText"),
839            optionals, webSocketID,
840            "Input.insertText",
841            text
842        );
843        
844        // This Remote Command does not have a Return-Value.
845        return new Script<>
846            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
847    }
848    
849    /**
850     * This method sets the current candidate text for IME.
851     * Use imeCommitComposition to commit the final text.
852     * Use imeSetComposition with empty string as text to cancel composition.
853     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
854     * 
855     * @param text The text to insert
856     * 
857     * @param selectionStart selection start
858     * 
859     * @param selectionEnd selection end
860     * 
861     * @param replacementStart replacement start
862     * <BR /><B CLASS=Opt>OPTIONAL</B>
863     * 
864     * @param replacementEnd replacement end
865     * <BR /><B CLASS=Opt>OPTIONAL</B>
866     * 
867     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
868     * {@link Ret0}&gt;</CODE>
869     *
870     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
871     * browser receives the invocation-request.
872     *
873     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
874     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
875     * {@code >} to ensure the Browser Function has run to completion.
876     */
877    public static Script<String, JsonObject, Ret0> imeSetComposition(
878            String text, int selectionStart, int selectionEnd, Integer replacementStart, 
879            Integer replacementEnd
880        )
881    {
882        // Exception-Check(s) to ensure that if any parameters which are not declared as
883        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
884        
885        if (text == null) THROWS.throwNPE("text");
886        
887        final int       webSocketID = 28003000 + counter++;
888        final boolean[] optionals   = { false, false, false, true, true, };
889        
890        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
891        String requestJSON = WriteJSON.get(
892            parameterTypes.get("imeSetComposition"),
893            parameterNames.get("imeSetComposition"),
894            optionals, webSocketID,
895            "Input.imeSetComposition",
896            text, selectionStart, selectionEnd, replacementStart, replacementEnd
897        );
898        
899        // This Remote Command does not have a Return-Value.
900        return new Script<>
901            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
902    }
903    
904    /**
905     * Dispatches a mouse event to the page.
906     * 
907     * @param type Type of the mouse event.
908     * <BR />Acceptable Values: ["mousePressed", "mouseReleased", "mouseMoved", "mouseWheel"]
909     * 
910     * @param x X coordinate of the event relative to the main frame's viewport in CSS pixels.
911     * 
912     * @param y 
913     * Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to
914     * the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
915     * 
916     * @param modifiers 
917     * Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
918     * (default: 0).
919     * <BR /><B CLASS=Opt>OPTIONAL</B>
920     * 
921     * @param timestamp Time at which the event occurred.
922     * <BR /><B CLASS=Opt>OPTIONAL</B>
923     * 
924     * @param button Mouse button (default: "none").
925     * <BR /><B CLASS=Opt>OPTIONAL</B>
926     * 
927     * @param buttons 
928     * A number indicating which buttons are pressed on the mouse when a mouse event is triggered.
929     * Left=1, Right=2, Middle=4, Back=8, Forward=16, None=0.
930     * <BR /><B CLASS=Opt>OPTIONAL</B>
931     * 
932     * @param clickCount Number of times the mouse button was clicked (default: 0).
933     * <BR /><B CLASS=Opt>OPTIONAL</B>
934     * 
935     * @param force The normalized pressure, which has a range of [0,1] (default: 0).
936     * <BR /><B CLASS=Opt>OPTIONAL</B><B CLASS=Exp>EXPERIMENTAL</B>
937     * 
938     * @param tangentialPressure The normalized tangential pressure, which has a range of [-1,1] (default: 0).
939     * <BR /><B CLASS=Opt>OPTIONAL</B><B CLASS=Exp>EXPERIMENTAL</B>
940     * 
941     * @param tiltX The plane angle between the Y-Z plane and the plane containing both the stylus axis and the Y axis, in degrees of the range [-90,90], a positive tiltX is to the right (default: 0).
942     * <BR /><B CLASS=Opt>OPTIONAL</B>
943     * 
944     * @param tiltY The plane angle between the X-Z plane and the plane containing both the stylus axis and the X axis, in degrees of the range [-90,90], a positive tiltY is towards the user (default: 0).
945     * <BR /><B CLASS=Opt>OPTIONAL</B>
946     * 
947     * @param twist The clockwise rotation of a pen stylus around its own major axis, in degrees in the range [0,359] (default: 0).
948     * <BR /><B CLASS=Opt>OPTIONAL</B><B CLASS=Exp>EXPERIMENTAL</B>
949     * 
950     * @param deltaX X delta in CSS pixels for mouse wheel event (default: 0).
951     * <BR /><B CLASS=Opt>OPTIONAL</B>
952     * 
953     * @param deltaY Y delta in CSS pixels for mouse wheel event (default: 0).
954     * <BR /><B CLASS=Opt>OPTIONAL</B>
955     * 
956     * @param pointerType Pointer type (default: "mouse").
957     * <BR />Acceptable Values: ["mouse", "pen"]
958     * <BR /><B CLASS=Opt>OPTIONAL</B>
959     * 
960     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
961     * {@link Ret0}&gt;</CODE>
962     *
963     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
964     * browser receives the invocation-request.
965     *
966     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
967     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
968     * {@code >} to ensure the Browser Function has run to completion.
969     */
970    public static Script<String, JsonObject, Ret0> dispatchMouseEvent(
971            String type, Number x, Number y, Integer modifiers, Number timestamp, String button, 
972            Integer buttons, Integer clickCount, Number force, Number tangentialPressure, 
973            Number tiltX, Number tiltY, Integer twist, Number deltaX, Number deltaY, 
974            String pointerType
975        )
976    {
977        // Exception-Check(s) to ensure that if any parameters which are not declared as
978        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
979        
980        if (type == null) THROWS.throwNPE("type");
981        if (x == null)    THROWS.throwNPE("x");
982        if (y == null)    THROWS.throwNPE("y");
983        
984        // Exception-Check(s) to ensure that if any parameters which must adhere to a
985        // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
986        
987        THROWS.checkIAE(
988            "type", type,
989            "mousePressed", "mouseReleased", "mouseMoved", "mouseWheel"
990        );
991        THROWS.checkIAE("button", button, "Input.MouseButton", Input.MouseButton);
992        THROWS.checkIAE(
993            "pointerType", pointerType,
994            "mouse", "pen"
995        );
996        
997        final int       webSocketID = 28004000 + counter++;
998        final boolean[] optionals   = { false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, };
999        
1000        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1001        String requestJSON = WriteJSON.get(
1002            parameterTypes.get("dispatchMouseEvent"),
1003            parameterNames.get("dispatchMouseEvent"),
1004            optionals, webSocketID,
1005            "Input.dispatchMouseEvent",
1006            type, x, y, modifiers, timestamp, button, buttons, clickCount, force,
1007            tangentialPressure, tiltX, tiltY, twist, deltaX, deltaY, pointerType
1008        );
1009        
1010        // This Remote Command does not have a Return-Value.
1011        return new Script<>
1012            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
1013    }
1014    
1015    /**
1016     * Dispatches a touch event to the page.
1017     * 
1018     * @param type 
1019     * Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while
1020     * TouchStart and TouchMove must contains at least one.
1021     * <BR />Acceptable Values: ["touchStart", "touchEnd", "touchMove", "touchCancel"]
1022     * 
1023     * @param touchPoints 
1024     * Active touch points on the touch device. One event per any changed point (compared to
1025     * previous touch event in a sequence) is generated, emulating pressing/moving/releasing points
1026     * one by one.
1027     * 
1028     * @param modifiers 
1029     * Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
1030     * (default: 0).
1031     * <BR /><B CLASS=Opt>OPTIONAL</B>
1032     * 
1033     * @param timestamp Time at which the event occurred.
1034     * <BR /><B CLASS=Opt>OPTIONAL</B>
1035     * 
1036     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
1037     * {@link Ret0}&gt;</CODE>
1038     *
1039     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1040     * browser receives the invocation-request.
1041     *
1042     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
1043     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1044     * {@code >} to ensure the Browser Function has run to completion.
1045     */
1046    public static Script<String, JsonObject, Ret0> dispatchTouchEvent
1047        (String type, Input.TouchPoint[] touchPoints, Integer modifiers, Number timestamp)
1048    {
1049        // Exception-Check(s) to ensure that if any parameters which are not declared as
1050        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1051        
1052        if (type == null)        THROWS.throwNPE("type");
1053        if (touchPoints == null) THROWS.throwNPE("touchPoints");
1054        
1055        // Exception-Check(s) to ensure that if any parameters which must adhere to a
1056        // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
1057        
1058        THROWS.checkIAE(
1059            "type", type,
1060            "touchStart", "touchEnd", "touchMove", "touchCancel"
1061        );
1062        
1063        final int       webSocketID = 28005000 + counter++;
1064        final boolean[] optionals   = { false, false, true, true, };
1065        
1066        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1067        String requestJSON = WriteJSON.get(
1068            parameterTypes.get("dispatchTouchEvent"),
1069            parameterNames.get("dispatchTouchEvent"),
1070            optionals, webSocketID,
1071            "Input.dispatchTouchEvent",
1072            type, touchPoints, modifiers, timestamp
1073        );
1074        
1075        // This Remote Command does not have a Return-Value.
1076        return new Script<>
1077            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
1078    }
1079    
1080    /**
1081     * Cancels any active dragging in the page.
1082     * 
1083     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
1084     * {@link Ret0}&gt;</CODE>
1085     *
1086     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1087     * browser receives the invocation-request.
1088     *
1089     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
1090     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1091     * {@code >} to ensure the Browser Function has run to completion.
1092     */
1093    public static Script<String, JsonObject, Ret0> cancelDragging()
1094    {
1095        final int          webSocketID = 28006000 + counter++;
1096        final boolean[]    optionals   = new boolean[0];
1097        
1098        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1099        String requestJSON = WriteJSON.get(
1100            parameterTypes.get("cancelDragging"),
1101            parameterNames.get("cancelDragging"),
1102            optionals, webSocketID,
1103            "Input.cancelDragging"
1104        );
1105        
1106        // This Remote Command does not have a Return-Value.
1107        return new Script<>
1108            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
1109    }
1110    
1111    /**
1112     * Emulates touch event from the mouse event parameters.
1113     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
1114     * 
1115     * @param type Type of the mouse event.
1116     * <BR />Acceptable Values: ["mousePressed", "mouseReleased", "mouseMoved", "mouseWheel"]
1117     * 
1118     * @param x X coordinate of the mouse pointer in DIP.
1119     * 
1120     * @param y Y coordinate of the mouse pointer in DIP.
1121     * 
1122     * @param button Mouse button. Only "none", "left", "right" are supported.
1123     * 
1124     * @param timestamp Time at which the event occurred (default: current time).
1125     * <BR /><B CLASS=Opt>OPTIONAL</B>
1126     * 
1127     * @param deltaX X delta in DIP for mouse wheel event (default: 0).
1128     * <BR /><B CLASS=Opt>OPTIONAL</B>
1129     * 
1130     * @param deltaY Y delta in DIP for mouse wheel event (default: 0).
1131     * <BR /><B CLASS=Opt>OPTIONAL</B>
1132     * 
1133     * @param modifiers 
1134     * Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
1135     * (default: 0).
1136     * <BR /><B CLASS=Opt>OPTIONAL</B>
1137     * 
1138     * @param clickCount Number of times the mouse button was clicked (default: 0).
1139     * <BR /><B CLASS=Opt>OPTIONAL</B>
1140     * 
1141     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
1142     * {@link Ret0}&gt;</CODE>
1143     *
1144     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1145     * browser receives the invocation-request.
1146     *
1147     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
1148     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1149     * {@code >} to ensure the Browser Function has run to completion.
1150     */
1151    public static Script<String, JsonObject, Ret0> emulateTouchFromMouseEvent(
1152            String type, int x, int y, String button, Number timestamp, Number deltaX, 
1153            Number deltaY, Integer modifiers, Integer clickCount
1154        )
1155    {
1156        // Exception-Check(s) to ensure that if any parameters which are not declared as
1157        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1158        
1159        if (type == null)   THROWS.throwNPE("type");
1160        if (button == null) THROWS.throwNPE("button");
1161        
1162        // Exception-Check(s) to ensure that if any parameters which must adhere to a
1163        // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
1164        
1165        THROWS.checkIAE(
1166            "type", type,
1167            "mousePressed", "mouseReleased", "mouseMoved", "mouseWheel"
1168        );
1169        THROWS.checkIAE("button", button, "Input.MouseButton", Input.MouseButton);
1170        
1171        final int       webSocketID = 28007000 + counter++;
1172        final boolean[] optionals   = { false, false, false, false, true, true, true, true, true, };
1173        
1174        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1175        String requestJSON = WriteJSON.get(
1176            parameterTypes.get("emulateTouchFromMouseEvent"),
1177            parameterNames.get("emulateTouchFromMouseEvent"),
1178            optionals, webSocketID,
1179            "Input.emulateTouchFromMouseEvent",
1180            type, x, y, button, timestamp, deltaX, deltaY, modifiers, clickCount
1181        );
1182        
1183        // This Remote Command does not have a Return-Value.
1184        return new Script<>
1185            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
1186    }
1187    
1188    /**
1189     * Ignores input events (useful while auditing page).
1190     * 
1191     * @param ignore Ignores input events processing when set to true.
1192     * 
1193     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
1194     * {@link Ret0}&gt;</CODE>
1195     *
1196     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1197     * browser receives the invocation-request.
1198     *
1199     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
1200     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1201     * {@code >} to ensure the Browser Function has run to completion.
1202     */
1203    public static Script<String, JsonObject, Ret0> setIgnoreInputEvents(boolean ignore)
1204    {
1205        final int       webSocketID = 28008000 + counter++;
1206        final boolean[] optionals   = { false, };
1207        
1208        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1209        String requestJSON = WriteJSON.get(
1210            parameterTypes.get("setIgnoreInputEvents"),
1211            parameterNames.get("setIgnoreInputEvents"),
1212            optionals, webSocketID,
1213            "Input.setIgnoreInputEvents",
1214            ignore
1215        );
1216        
1217        // This Remote Command does not have a Return-Value.
1218        return new Script<>
1219            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
1220    }
1221    
1222    /**
1223     * Prevents default drag and drop behavior and instead emits {@code Input.dragIntercepted} events.
1224     * Drag and drop behavior can be directly controlled via {@code Input.dispatchDragEvent}.
1225     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
1226     * 
1227     * @param enabled -
1228     * 
1229     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
1230     * {@link Ret0}&gt;</CODE>
1231     *
1232     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1233     * browser receives the invocation-request.
1234     *
1235     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
1236     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1237     * {@code >} to ensure the Browser Function has run to completion.
1238     */
1239    public static Script<String, JsonObject, Ret0> setInterceptDrags(boolean enabled)
1240    {
1241        final int       webSocketID = 28009000 + counter++;
1242        final boolean[] optionals   = { false, };
1243        
1244        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1245        String requestJSON = WriteJSON.get(
1246            parameterTypes.get("setInterceptDrags"),
1247            parameterNames.get("setInterceptDrags"),
1248            optionals, webSocketID,
1249            "Input.setInterceptDrags",
1250            enabled
1251        );
1252        
1253        // This Remote Command does not have a Return-Value.
1254        return new Script<>
1255            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
1256    }
1257    
1258    /**
1259     * Synthesizes a pinch gesture over a time period by issuing appropriate touch events.
1260     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
1261     * 
1262     * @param x X coordinate of the start of the gesture in CSS pixels.
1263     * 
1264     * @param y Y coordinate of the start of the gesture in CSS pixels.
1265     * 
1266     * @param scaleFactor Relative scale factor after zooming (&gt;1.0 zooms in, &lt;1.0 zooms out).
1267     * 
1268     * @param relativeSpeed Relative pointer speed in pixels per second (default: 800).
1269     * <BR /><B CLASS=Opt>OPTIONAL</B>
1270     * 
1271     * @param gestureSourceType 
1272     * Which type of input events to be generated (default: 'default', which queries the platform
1273     * for the preferred input type).
1274     * <BR /><B CLASS=Opt>OPTIONAL</B>
1275     * 
1276     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
1277     * {@link Ret0}&gt;</CODE>
1278     *
1279     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1280     * browser receives the invocation-request.
1281     *
1282     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
1283     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1284     * {@code >} to ensure the Browser Function has run to completion.
1285     */
1286    public static Script<String, JsonObject, Ret0> synthesizePinchGesture
1287        (Number x, Number y, Number scaleFactor, Integer relativeSpeed, String gestureSourceType)
1288    {
1289        // Exception-Check(s) to ensure that if any parameters which are not declared as
1290        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1291        
1292        if (x == null)           THROWS.throwNPE("x");
1293        if (y == null)           THROWS.throwNPE("y");
1294        if (scaleFactor == null) THROWS.throwNPE("scaleFactor");
1295        
1296        // Exception-Check(s) to ensure that if any parameters which must adhere to a
1297        // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
1298        
1299        THROWS.checkIAE("gestureSourceType", gestureSourceType, "Input.GestureSourceType", Input.GestureSourceType);
1300        
1301        final int       webSocketID = 28010000 + counter++;
1302        final boolean[] optionals   = { false, false, false, true, true, };
1303        
1304        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1305        String requestJSON = WriteJSON.get(
1306            parameterTypes.get("synthesizePinchGesture"),
1307            parameterNames.get("synthesizePinchGesture"),
1308            optionals, webSocketID,
1309            "Input.synthesizePinchGesture",
1310            x, y, scaleFactor, relativeSpeed, gestureSourceType
1311        );
1312        
1313        // This Remote Command does not have a Return-Value.
1314        return new Script<>
1315            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
1316    }
1317    
1318    /**
1319     * Synthesizes a scroll gesture over a time period by issuing appropriate touch events.
1320     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
1321     * 
1322     * @param x X coordinate of the start of the gesture in CSS pixels.
1323     * 
1324     * @param y Y coordinate of the start of the gesture in CSS pixels.
1325     * 
1326     * @param xDistance The distance to scroll along the X axis (positive to scroll left).
1327     * <BR /><B CLASS=Opt>OPTIONAL</B>
1328     * 
1329     * @param yDistance The distance to scroll along the Y axis (positive to scroll up).
1330     * <BR /><B CLASS=Opt>OPTIONAL</B>
1331     * 
1332     * @param xOverscroll 
1333     * The number of additional pixels to scroll back along the X axis, in addition to the given
1334     * distance.
1335     * <BR /><B CLASS=Opt>OPTIONAL</B>
1336     * 
1337     * @param yOverscroll 
1338     * The number of additional pixels to scroll back along the Y axis, in addition to the given
1339     * distance.
1340     * <BR /><B CLASS=Opt>OPTIONAL</B>
1341     * 
1342     * @param preventFling Prevent fling (default: true).
1343     * <BR /><B CLASS=Opt>OPTIONAL</B>
1344     * 
1345     * @param speed Swipe speed in pixels per second (default: 800).
1346     * <BR /><B CLASS=Opt>OPTIONAL</B>
1347     * 
1348     * @param gestureSourceType 
1349     * Which type of input events to be generated (default: 'default', which queries the platform
1350     * for the preferred input type).
1351     * <BR /><B CLASS=Opt>OPTIONAL</B>
1352     * 
1353     * @param repeatCount The number of times to repeat the gesture (default: 0).
1354     * <BR /><B CLASS=Opt>OPTIONAL</B>
1355     * 
1356     * @param repeatDelayMs The number of milliseconds delay between each repeat. (default: 250).
1357     * <BR /><B CLASS=Opt>OPTIONAL</B>
1358     * 
1359     * @param interactionMarkerName The name of the interaction markers to generate, if not empty (default: "").
1360     * <BR /><B CLASS=Opt>OPTIONAL</B>
1361     * 
1362     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
1363     * {@link Ret0}&gt;</CODE>
1364     *
1365     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1366     * browser receives the invocation-request.
1367     *
1368     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
1369     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1370     * {@code >} to ensure the Browser Function has run to completion.
1371     */
1372    public static Script<String, JsonObject, Ret0> synthesizeScrollGesture(
1373            Number x, Number y, Number xDistance, Number yDistance, Number xOverscroll, 
1374            Number yOverscroll, Boolean preventFling, Integer speed, String gestureSourceType, 
1375            Integer repeatCount, Integer repeatDelayMs, String interactionMarkerName
1376        )
1377    {
1378        // Exception-Check(s) to ensure that if any parameters which are not declared as
1379        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1380        
1381        if (x == null) THROWS.throwNPE("x");
1382        if (y == null) THROWS.throwNPE("y");
1383        
1384        // Exception-Check(s) to ensure that if any parameters which must adhere to a
1385        // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
1386        
1387        THROWS.checkIAE("gestureSourceType", gestureSourceType, "Input.GestureSourceType", Input.GestureSourceType);
1388        
1389        final int       webSocketID = 28011000 + counter++;
1390        final boolean[] optionals   = { false, false, true, true, true, true, true, true, true, true, true, true, };
1391        
1392        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1393        String requestJSON = WriteJSON.get(
1394            parameterTypes.get("synthesizeScrollGesture"),
1395            parameterNames.get("synthesizeScrollGesture"),
1396            optionals, webSocketID,
1397            "Input.synthesizeScrollGesture",
1398            x, y, xDistance, yDistance, xOverscroll, yOverscroll, preventFling, speed,
1399            gestureSourceType, repeatCount, repeatDelayMs, interactionMarkerName
1400        );
1401        
1402        // This Remote Command does not have a Return-Value.
1403        return new Script<>
1404            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
1405    }
1406    
1407    /**
1408     * Synthesizes a tap gesture over a time period by issuing appropriate touch events.
1409     * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B>
1410     * 
1411     * @param x X coordinate of the start of the gesture in CSS pixels.
1412     * 
1413     * @param y Y coordinate of the start of the gesture in CSS pixels.
1414     * 
1415     * @param duration Duration between touchdown and touchup events in ms (default: 50).
1416     * <BR /><B CLASS=Opt>OPTIONAL</B>
1417     * 
1418     * @param tapCount Number of times to perform the tap (e.g. 2 for double tap, default: 1).
1419     * <BR /><B CLASS=Opt>OPTIONAL</B>
1420     * 
1421     * @param gestureSourceType 
1422     * Which type of input events to be generated (default: 'default', which queries the platform
1423     * for the preferred input type).
1424     * <BR /><B CLASS=Opt>OPTIONAL</B>
1425     * 
1426     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
1427     * {@link Ret0}&gt;</CODE>
1428     *
1429     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1430     * browser receives the invocation-request.
1431     *
1432     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
1433     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1434     * {@code >} to ensure the Browser Function has run to completion.
1435     */
1436    public static Script<String, JsonObject, Ret0> synthesizeTapGesture
1437        (Number x, Number y, Integer duration, Integer tapCount, String gestureSourceType)
1438    {
1439        // Exception-Check(s) to ensure that if any parameters which are not declared as
1440        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1441        
1442        if (x == null) THROWS.throwNPE("x");
1443        if (y == null) THROWS.throwNPE("y");
1444        
1445        // Exception-Check(s) to ensure that if any parameters which must adhere to a
1446        // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
1447        
1448        THROWS.checkIAE("gestureSourceType", gestureSourceType, "Input.GestureSourceType", Input.GestureSourceType);
1449        
1450        final int       webSocketID = 28012000 + counter++;
1451        final boolean[] optionals   = { false, false, true, true, true, };
1452        
1453        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1454        String requestJSON = WriteJSON.get(
1455            parameterTypes.get("synthesizeTapGesture"),
1456            parameterNames.get("synthesizeTapGesture"),
1457            optionals, webSocketID,
1458            "Input.synthesizeTapGesture",
1459            x, y, duration, tapCount, gestureSourceType
1460        );
1461        
1462        // This Remote Command does not have a Return-Value.
1463        return new Script<>
1464            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
1465    }
1466    
1467}