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