From 1ca1161a68030565a37319ec6275556dfcd1a1af Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sat, 18 Dec 2021 19:03:52 -0800 Subject: [PATCH] GUACAMOLE-986: Update documentation of all parameters/returns to specify non-nullable and/or primitive types where appropriate. --- .../main/webapp/modules/ArrayBufferReader.js | 7 +- .../main/webapp/modules/ArrayBufferWriter.js | 19 +- .../src/main/webapp/modules/AudioPlayer.js | 43 +- .../src/main/webapp/modules/AudioRecorder.js | 57 +- .../src/main/webapp/modules/BlobReader.js | 23 +- .../src/main/webapp/modules/BlobWriter.js | 28 +- .../src/main/webapp/modules/Client.js | 217 +++-- .../src/main/webapp/modules/DataURIReader.js | 11 +- .../src/main/webapp/modules/Display.js | 759 ++++++++++++------ .../src/main/webapp/modules/Event.js | 42 +- .../src/main/webapp/modules/InputSink.js | 7 +- .../src/main/webapp/modules/InputStream.js | 23 +- .../src/main/webapp/modules/IntegerPool.js | 11 +- .../src/main/webapp/modules/JSONReader.js | 12 +- .../src/main/webapp/modules/Keyboard.js | 163 ++-- .../src/main/webapp/modules/Layer.js | 434 +++++++--- .../src/main/webapp/modules/Mouse.js | 140 ++-- .../src/main/webapp/modules/Object.js | 38 +- .../main/webapp/modules/OnScreenKeyboard.js | 122 +-- .../src/main/webapp/modules/OutputStream.js | 17 +- .../src/main/webapp/modules/Parser.js | 11 +- .../src/main/webapp/modules/Position.js | 20 +- .../src/main/webapp/modules/RawAudioFormat.js | 10 +- .../main/webapp/modules/SessionRecording.js | 96 +-- .../src/main/webapp/modules/Status.js | 66 +- .../src/main/webapp/modules/StringReader.js | 23 +- .../src/main/webapp/modules/StringWriter.js | 35 +- .../src/main/webapp/modules/Touch.js | 34 +- .../src/main/webapp/modules/Tunnel.js | 127 +-- .../src/main/webapp/modules/Version.js | 2 +- .../src/main/webapp/modules/VideoPlayer.js | 12 +- .../src/test/javascript/EventSpec.js | 4 +- 32 files changed, 1636 insertions(+), 977 deletions(-) diff --git a/guacamole-common-js/src/main/webapp/modules/ArrayBufferReader.js b/guacamole-common-js/src/main/webapp/modules/ArrayBufferReader.js index acb6bc4c7..2d542a6dd 100644 --- a/guacamole-common-js/src/main/webapp/modules/ArrayBufferReader.js +++ b/guacamole-common-js/src/main/webapp/modules/ArrayBufferReader.js @@ -25,8 +25,8 @@ var Guacamole = Guacamole || {}; * overwrite any installed event handlers on the given Guacamole.InputStream. * * @constructor - * @param {Guacamole.InputStream} stream The stream that data will be read - * from. + * @param {!Guacamole.InputStream} stream + * The stream that data will be read from. */ Guacamole.ArrayBufferReader = function(stream) { @@ -63,7 +63,8 @@ Guacamole.ArrayBufferReader = function(stream) { * Fired once for every blob of data received. * * @event - * @param {ArrayBuffer} buffer The data packet received. + * @param {!ArrayBuffer} buffer + * The data packet received. */ this.ondata = null; diff --git a/guacamole-common-js/src/main/webapp/modules/ArrayBufferWriter.js b/guacamole-common-js/src/main/webapp/modules/ArrayBufferWriter.js index 3b0f366c2..2aada142c 100644 --- a/guacamole-common-js/src/main/webapp/modules/ArrayBufferWriter.js +++ b/guacamole-common-js/src/main/webapp/modules/ArrayBufferWriter.js @@ -24,14 +24,16 @@ var Guacamole = Guacamole || {}; * binary data, supplied as ArrayBuffers. * * @constructor - * @param {Guacamole.OutputStream} stream The stream that data will be written - * to. + * @param {!Guacamole.OutputStream} stream + * The stream that data will be written to. */ Guacamole.ArrayBufferWriter = function(stream) { /** * Reference to this Guacamole.StringWriter. + * * @private + * @type {!Guacamole.ArrayBufferWriter} */ var guac_writer = this; @@ -46,7 +48,8 @@ Guacamole.ArrayBufferWriter = function(stream) { * be small enough to fit into a single blob instruction. * * @private - * @param {Uint8Array} bytes The data to send. + * @param {!Uint8Array} bytes + * The data to send. */ function __send_blob(bytes) { @@ -70,7 +73,7 @@ Guacamole.ArrayBufferWriter = function(stream) { * 8192 bytes, and the contents of blobs will be base64-encoded, this value * should only be increased with extreme caution. * - * @type {Number} + * @type {!number} * @default {@link Guacamole.ArrayBufferWriter.DEFAULT_BLOB_LENGTH} */ this.blobLength = Guacamole.ArrayBufferWriter.DEFAULT_BLOB_LENGTH; @@ -78,7 +81,8 @@ Guacamole.ArrayBufferWriter = function(stream) { /** * Sends the given data. * - * @param {ArrayBuffer|TypedArray} data The data to send. + * @param {!(ArrayBuffer|TypedArray)} data + * The data to send. */ this.sendData = function(data) { @@ -107,7 +111,8 @@ Guacamole.ArrayBufferWriter = function(stream) { /** * Fired for received data, if acknowledged by the server. * @event - * @param {Guacamole.Status} status The status of the operation. + * @param {!Guacamole.Status} status + * The status of the operation. */ this.onack = null; @@ -118,6 +123,6 @@ Guacamole.ArrayBufferWriter = function(stream) { * instances. * * @constant - * @type {Number} + * @type {!number} */ Guacamole.ArrayBufferWriter.DEFAULT_BLOB_LENGTH = 6048; diff --git a/guacamole-common-js/src/main/webapp/modules/AudioPlayer.js b/guacamole-common-js/src/main/webapp/modules/AudioPlayer.js index 0097355f9..af8d279e3 100644 --- a/guacamole-common-js/src/main/webapp/modules/AudioPlayer.js +++ b/guacamole-common-js/src/main/webapp/modules/AudioPlayer.js @@ -46,10 +46,10 @@ Guacamole.AudioPlayer = function AudioPlayer() { * implementation of Guacamole.AudioPlayer, and thus will be properly handled * by Guacamole.AudioPlayer.getInstance(). * - * @param {String} mimetype + * @param {!string} mimetype * The mimetype to check. * - * @returns {Boolean} + * @returns {!boolean} * true if the given mimetype is supported by any built-in * Guacamole.AudioPlayer, false otherwise. */ @@ -68,7 +68,7 @@ Guacamole.AudioPlayer.isSupportedType = function isSupportedType(mimetype) { * additional parameters. Something like "audio/L8;rate=44100" would be valid, * however (see https://tools.ietf.org/html/rfc4856). * - * @returns {String[]} + * @returns {!string[]} * A list of all mimetypes supported by any built-in Guacamole.AudioPlayer, * excluding any parameters. */ @@ -83,10 +83,10 @@ Guacamole.AudioPlayer.getSupportedTypes = function getSupportedTypes() { * audio format. If support for the given audio format is not available, null * is returned. * - * @param {Guacamole.InputStream} stream + * @param {!Guacamole.InputStream} stream * The Guacamole.InputStream to read audio data from. * - * @param {String} mimetype + * @param {!string} mimetype * The mimetype of the audio data in the provided stream. * * @return {Guacamole.AudioPlayer} @@ -112,10 +112,10 @@ Guacamole.AudioPlayer.getInstance = function getInstance(stream, mimetype) { * * @constructor * @augments Guacamole.AudioPlayer - * @param {Guacamole.InputStream} stream + * @param {!Guacamole.InputStream} stream * The Guacamole.InputStream to read audio data from. * - * @param {String} mimetype + * @param {!string} mimetype * The mimetype of the audio data in the provided stream, which must be a * "audio/L8" or "audio/L16" mimetype with necessary parameters, such as: * "audio/L16;rate=44100,channels=2". @@ -146,7 +146,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) { * resolution. * * @private - * @type {Number} + * @type {!number} */ var nextPacketTime = context.currentTime; @@ -155,7 +155,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) { * provided with this Guacamole.RawAudioPlayer was created. * * @private - * @type {Guacamole.ArrayBufferReader} + * @type {!Guacamole.ArrayBufferReader} */ var reader = new Guacamole.ArrayBufferReader(stream); @@ -167,7 +167,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) { * * @private * @constant - * @type {Number} + * @type {!number} */ var MIN_SPLIT_SIZE = 0.02; @@ -177,7 +177,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) { * roughly one third of a second. * * @private - * @type {Number} + * @type {!number} */ var maxLatency = 0.3; @@ -197,7 +197,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) { * sample, and will be 128 for 8-bit audio and 32768 for 16-bit audio. * * @private - * @type {Number} + * @type {!number} */ var maxSampleValue = (format.bytesPerSample === 1) ? 128 : 32768; @@ -209,7 +209,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) { * no further modifications can be made to that packet. * * @private - * @type {SampleArray[]} + * @type {!SampleArray[]} */ var packetQueue = []; @@ -218,7 +218,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) { * containing the concatenation of those packets. * * @private - * @param {SampleArray[]} packets + * @param {!SampleArray[]} packets * The array of audio packets to concatenate. * * @returns {SampleArray} @@ -258,7 +258,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) { * the originally-provided audio packet is returned. * * @private - * @param {SampleArray} data + * @param {!SampleArray} data * The audio packet to split. * * @returns {!SampleArray[]} @@ -326,7 +326,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) { * conversions will be performed automatically internally. * * @private - * @param {ArrayBuffer} data + * @param {!ArrayBuffer} data * A raw packet of audio data that should be pushed onto the audio * playback queue. */ @@ -343,7 +343,8 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) { * @private * @returns {SampleArray} * A packet of audio data pulled from the beginning of the playback - * queue. + * queue. If there is no audio currently in the playback queue, this + * will be null. */ var shiftAudioPacket = function shiftAudioPacket() { @@ -367,7 +368,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) { * into isolated planes of channel-specific data. * * @private - * @param {SampleArray} data + * @param {!SampleArray} data * The raw audio packet that should be converted into a Web Audio API * AudioBuffer. * @@ -460,10 +461,10 @@ Guacamole.RawAudioPlayer.prototype = new Guacamole.AudioPlayer(); * Determines whether the given mimetype is supported by * Guacamole.RawAudioPlayer. * - * @param {String} mimetype + * @param {!string} mimetype * The mimetype to check. * - * @returns {boolean} + * @returns {!boolean} * true if the given mimetype is supported by Guacamole.RawAudioPlayer, * false otherwise. */ @@ -485,7 +486,7 @@ Guacamole.RawAudioPlayer.isSupportedType = function isSupportedType(mimetype) { * additional parameters. Something like "audio/L8;rate=44100" would be valid, * however (see https://tools.ietf.org/html/rfc4856). * - * @returns {string[]} + * @returns {!string[]} * A list of all mimetypes supported by Guacamole.RawAudioPlayer, excluding * any parameters. If the necessary JavaScript APIs for playing raw audio * are absent, this list will be empty. diff --git a/guacamole-common-js/src/main/webapp/modules/AudioRecorder.js b/guacamole-common-js/src/main/webapp/modules/AudioRecorder.js index 2f28ee6c9..89d2dbe71 100644 --- a/guacamole-common-js/src/main/webapp/modules/AudioRecorder.js +++ b/guacamole-common-js/src/main/webapp/modules/AudioRecorder.js @@ -57,10 +57,10 @@ Guacamole.AudioRecorder = function AudioRecorder() { * implementation of Guacamole.AudioRecorder, and thus will be properly handled * by Guacamole.AudioRecorder.getInstance(). * - * @param {String} mimetype + * @param {!string} mimetype * The mimetype to check. * - * @returns {Boolean} + * @returns {!boolean} * true if the given mimetype is supported by any built-in * Guacamole.AudioRecorder, false otherwise. */ @@ -79,7 +79,7 @@ Guacamole.AudioRecorder.isSupportedType = function isSupportedType(mimetype) { * additional parameters. Something like "audio/L8;rate=44100" would be valid, * however (see https://tools.ietf.org/html/rfc4856). * - * @returns {String[]} + * @returns {!string[]} * A list of all mimetypes supported by any built-in * Guacamole.AudioRecorder, excluding any parameters. */ @@ -94,10 +94,10 @@ Guacamole.AudioRecorder.getSupportedTypes = function getSupportedTypes() { * given audio format. If support for the given audio format is not available, * null is returned. * - * @param {Guacamole.OutputStream} stream + * @param {!Guacamole.OutputStream} stream * The Guacamole.OutputStream to send audio data through. * - * @param {String} mimetype + * @param {!string} mimetype * The mimetype of the audio data to be sent along the provided stream. * * @return {Guacamole.AudioRecorder} @@ -123,10 +123,10 @@ Guacamole.AudioRecorder.getInstance = function getInstance(stream, mimetype) { * * @constructor * @augments Guacamole.AudioRecorder - * @param {Guacamole.OutputStream} stream + * @param {!Guacamole.OutputStream} stream * The Guacamole.OutputStream to write audio data to. * - * @param {String} mimetype + * @param {!string} mimetype * The mimetype of the audio data to send along the provided stream, which * must be a "audio/L8" or "audio/L16" mimetype with necessary parameters, * such as: "audio/L16;rate=44100,channels=2". @@ -137,7 +137,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) { * Reference to this RawAudioRecorder. * * @private - * @type {Guacamole.RawAudioRecorder} + * @type {!Guacamole.RawAudioRecorder} */ var recorder = this; @@ -149,7 +149,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) { * * @private * @constant - * @type {Number} + * @type {!number} */ var BUFFER_SIZE = 2048; @@ -160,7 +160,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) { * * @private * @contant - * @type Number + * @type {!number} */ var LANCZOS_WINDOW_SIZE = 3; @@ -201,7 +201,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) { * provided when this Guacamole.RawAudioRecorder was created. * * @private - * @type {Guacamole.ArrayBufferWriter} + * @type {!Guacamole.ArrayBufferWriter} */ var writer = new Guacamole.ArrayBufferWriter(stream); @@ -221,7 +221,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) { * and will be 128 for 8-bit audio and 32768 for 16-bit audio. * * @private - * @type {Number} + * @type {!number} */ var maxSampleValue = (format.bytesPerSample === 1) ? 128 : 32768; @@ -230,7 +230,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) { * over the life of this audio recorder. * * @private - * @type {Number} + * @type {!number} */ var readSamples = 0; @@ -239,7 +239,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) { * connection over the life of this audio recorder. * * @private - * @type {Number} + * @type {!number} */ var writtenSamples = 0; @@ -247,7 +247,8 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) { * The audio stream provided by the browser, if allowed. If no stream has * yet been received, this will be null. * - * @type MediaStream + * @private + * @type {MediaStream} */ var mediaStream = null; @@ -275,10 +276,10 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) { * See: https://en.wikipedia.org/wiki/Sinc_function * * @private - * @param {Number} x + * @param {!number} x * The point at which the normalized sinc function should be computed. * - * @returns {number} + * @returns {!number} * The value of the normalized sinc function at x. */ var sinc = function sinc(x) { @@ -298,14 +299,14 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) { * size. See: https://en.wikipedia.org/wiki/Lanczos_resampling * * @private - * @param {Number} x + * @param {!number} x * The point at which the value of the Lanczos kernel should be * computed. * - * @param {Number} a + * @param {!number} a * The window size to use for the Lanczos kernel. * - * @returns {number} + * @returns {!number} * The value of the Lanczos kernel at the given point for the given * window size. */ @@ -327,16 +328,16 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) { * be derived through interpolating nearby samples. * * @private - * @param {Float32Array} audioData + * @param {!Float32Array} audioData * An array of audio data, as returned by AudioBuffer.getChannelData(). * - * @param {Number} t + * @param {!number} t * The relative location within the waveform from which the value * should be retrieved, represented as a floating point number between * 0 and 1 inclusive, where 0 represents the earliest point in time and * 1 represents the latest. * - * @returns {number} + * @returns {!number} * The value of the waveform at the given location. */ var interpolateSample = function getValueAt(audioData, t) { @@ -367,7 +368,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) { * split into isolated planes of channel-specific data. * * @private - * @param {AudioBuffer} audioBuffer + * @param {!AudioBuffer} audioBuffer * The Web Audio API AudioBuffer that should be converted to a raw * audio packet. * @@ -416,7 +417,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) { * audio stream (successful start of recording). * * @private - * @param {MediaStream} stream + * @param {!MediaStream} stream * A MediaStream which provides access to audio data read from the * user's local audio input device. */ @@ -558,10 +559,10 @@ Guacamole.RawAudioRecorder.prototype = new Guacamole.AudioRecorder(); * Determines whether the given mimetype is supported by * Guacamole.RawAudioRecorder. * - * @param {String} mimetype + * @param {!string} mimetype * The mimetype to check. * - * @returns {boolean} + * @returns {!boolean} * true if the given mimetype is supported by Guacamole.RawAudioRecorder, * false otherwise. */ @@ -583,7 +584,7 @@ Guacamole.RawAudioRecorder.isSupportedType = function isSupportedType(mimetype) * additional parameters. Something like "audio/L8;rate=44100" would be valid, * however (see https://tools.ietf.org/html/rfc4856). * - * @returns {string[]} + * @returns {!string[]} * A list of all mimetypes supported by Guacamole.RawAudioRecorder, * excluding any parameters. If the necessary JavaScript APIs for recording * raw audio are absent, this list will be empty. diff --git a/guacamole-common-js/src/main/webapp/modules/BlobReader.js b/guacamole-common-js/src/main/webapp/modules/BlobReader.js index bb97ec8fc..03a2e32f1 100644 --- a/guacamole-common-js/src/main/webapp/modules/BlobReader.js +++ b/guacamole-common-js/src/main/webapp/modules/BlobReader.js @@ -26,21 +26,27 @@ var Guacamole = Guacamole || {}; * given Guacamole.InputStream. * * @constructor - * @param {Guacamole.InputStream} stream The stream that data will be read - * from. - * @param {String} mimetype The mimetype of the blob being built. + * @param {!Guacamole.InputStream} stream + * The stream that data will be read from. + * + * @param {!string} mimetype + * The mimetype of the blob being built. */ Guacamole.BlobReader = function(stream, mimetype) { /** * Reference to this Guacamole.InputStream. + * * @private + * @type {!Guacamole.BlobReader} */ var guac_reader = this; /** * The length of this Guacamole.InputStream in bytes. + * * @private + * @type {!number} */ var length = 0; @@ -97,7 +103,9 @@ Guacamole.BlobReader = function(stream, mimetype) { /** * Returns the current length of this Guacamole.InputStream, in bytes. - * @return {Number} The current length of this Guacamole.InputStream. + * + * @return {!number} + * The current length of this Guacamole.InputStream. */ this.getLength = function() { return length; @@ -105,7 +113,9 @@ Guacamole.BlobReader = function(stream, mimetype) { /** * Returns the contents of this Guacamole.BlobReader as a Blob. - * @return {Blob} The contents of this Guacamole.BlobReader. + * + * @return {!Blob} + * The contents of this Guacamole.BlobReader. */ this.getBlob = function() { return blob_builder.getBlob(); @@ -115,7 +125,8 @@ Guacamole.BlobReader = function(stream, mimetype) { * Fired once for every blob of data received. * * @event - * @param {Number} length The number of bytes received. + * @param {!number} length + * The number of bytes received. */ this.onprogress = null; diff --git a/guacamole-common-js/src/main/webapp/modules/BlobWriter.js b/guacamole-common-js/src/main/webapp/modules/BlobWriter.js index 08213fdce..177f705ff 100644 --- a/guacamole-common-js/src/main/webapp/modules/BlobWriter.js +++ b/guacamole-common-js/src/main/webapp/modules/BlobWriter.js @@ -24,7 +24,7 @@ var Guacamole = Guacamole || {}; * contents of provided Blob objects. * * @constructor - * @param {Guacamole.OutputStream} stream + * @param {!Guacamole.OutputStream} stream * The stream that data will be written to. */ Guacamole.BlobWriter = function BlobWriter(stream) { @@ -33,7 +33,7 @@ Guacamole.BlobWriter = function BlobWriter(stream) { * Reference to this Guacamole.BlobWriter. * * @private - * @type {Guacamole.BlobWriter} + * @type {!Guacamole.BlobWriter} */ var guacWriter = this; @@ -42,7 +42,7 @@ Guacamole.BlobWriter = function BlobWriter(stream) { * provided file data. * * @private - * @type {Guacamole.ArrayBufferWriter} + * @type {!Guacamole.ArrayBufferWriter} */ var arrayBufferWriter = new Guacamole.ArrayBufferWriter(stream); @@ -58,13 +58,13 @@ Guacamole.BlobWriter = function BlobWriter(stream) { * length. * * @private - * @param {Blob} blob + * @param {!Blob} blob * The Blob to slice. * - * @param {Number} start + * @param {!number} start * The starting offset of the slice, in bytes, inclusive. * - * @param {Number} end + * @param {!number} end * The ending offset of the slice, in bytes, exclusive. * * @returns {!Blob} @@ -102,7 +102,7 @@ Guacamole.BlobWriter = function BlobWriter(stream) { /** * Sends the contents of the given blob over the underlying stream. * - * @param {Blob} blob + * @param {!Blob} blob * The blob to send. */ this.sendBlob = function sendBlob(blob) { @@ -196,7 +196,7 @@ Guacamole.BlobWriter = function BlobWriter(stream) { * Fired for received data, if acknowledged by the server. * * @event - * @param {Guacamole.Status} status + * @param {!Guacamole.Status} status * The status of the operation. */ this.onack = null; @@ -207,13 +207,13 @@ Guacamole.BlobWriter = function BlobWriter(stream) { * the given blob will cease, but the stream will remain open. * * @event - * @param {Blob} blob + * @param {!Blob} blob * The blob that was being read when the error occurred. * - * @param {Number} offset + * @param {!number} offset * The offset of the failed read attempt within the blob, in bytes. * - * @param {DOMError} error + * @param {!DOMError} error * The error that occurred. */ this.onerror = null; @@ -223,10 +223,10 @@ Guacamole.BlobWriter = function BlobWriter(stream) { * via [sendBlob()]{@link Guacamole.BlobWriter#sendBlob}. * * @event - * @param {Blob} blob + * @param {!Blob} blob * The blob that is being read. * - * @param {Number} offset + * @param {!number} offset * The offset of the read that just succeeded. */ this.onprogress = null; @@ -237,7 +237,7 @@ Guacamole.BlobWriter = function BlobWriter(stream) { * sent. * * @event - * @param {Blob} blob + * @param {!Blob} blob * The blob that was sent. */ this.oncomplete = null; diff --git a/guacamole-common-js/src/main/webapp/modules/Client.js b/guacamole-common-js/src/main/webapp/modules/Client.js index 7aee174c4..e83f8ffd5 100644 --- a/guacamole-common-js/src/main/webapp/modules/Client.js +++ b/guacamole-common-js/src/main/webapp/modules/Client.js @@ -25,8 +25,8 @@ var Guacamole = Guacamole || {}; * provided tunnel, updating its display using one or more canvas elements. * * @constructor - * @param {Guacamole.Tunnel} tunnel The tunnel to use to send and receive - * Guacamole instructions. + * @param {!Guacamole.Tunnel} tunnel + * The tunnel to use to send and receive Guacamole instructions. */ Guacamole.Client = function(tunnel) { @@ -46,7 +46,9 @@ Guacamole.Client = function(tunnel) { /** * Translation from Guacamole protocol line caps to Layer line caps. + * * @private + * @type {!Object.} */ var lineCap = { 0: "butt", @@ -56,7 +58,9 @@ Guacamole.Client = function(tunnel) { /** * Translation from Guacamole protocol line caps to Layer line caps. + * * @private + * @type {!Object.} */ var lineJoin = { 0: "bevel", @@ -68,7 +72,7 @@ Guacamole.Client = function(tunnel) { * The underlying Guacamole display. * * @private - * @type {Guacamole.Display} + * @type {!Guacamole.Display} */ var display = new Guacamole.Display(); @@ -76,7 +80,7 @@ Guacamole.Client = function(tunnel) { * All available layers and buffers * * @private - * @type {Object.} + * @type {!Object.} */ var layers = {}; @@ -85,7 +89,7 @@ Guacamole.Client = function(tunnel) { * be empty, but audio players may be allocated by the server upon request. * * @private - * @type {Object.} + * @type {!Object.} */ var audioPlayers = {}; @@ -94,7 +98,7 @@ Guacamole.Client = function(tunnel) { * be empty, but video players may be allocated by the server upon request. * * @private - * @type {Object.} + * @type {!Object.} */ var videoPlayers = {}; @@ -109,7 +113,7 @@ Guacamole.Client = function(tunnel) { * Guacamole server. * * @private - * @type {Guacamole.Object[]} + * @type {!Guacamole.Object[]} */ var objects = []; @@ -138,7 +142,7 @@ Guacamole.Client = function(tunnel) { * effectively an independent, compressed snapshot of protocol and display * state. Invoking this function implicitly flushes the display. * - * @param {function} callback + * @param {!function} callback * Callback which should be invoked once the state object is ready. The * state object will be passed to the callback as the sole parameter. * This callback may be invoked immediately, or later as the display @@ -207,7 +211,7 @@ Guacamole.Client = function(tunnel) { * object from a prior call to exportState(). The Guacamole.Client instance * used to export that state need not be the same as this instance. * - * @param {Object} state + * @param {!object} state * An opaque representation of Guacamole.Client state from a prior call * to exportState(). * @@ -280,8 +284,8 @@ Guacamole.Client = function(tunnel) { * contains an Element which can be added to the DOM, causing the * display to become visible. * - * @return {Guacamole.Display} The underlying display of this - * Guacamole.Client. + * @return {!Guacamole.Display} + * The underlying display of this Guacamole.Client. */ this.getDisplay = function() { return display; @@ -290,8 +294,11 @@ Guacamole.Client = function(tunnel) { /** * Sends the current size of the screen. * - * @param {Number} width The width of the screen. - * @param {Number} height The height of the screen. + * @param {!number} width + * The width of the screen. + * + * @param {!number} height + * The height of the screen. */ this.sendSize = function(width, height) { @@ -307,9 +314,11 @@ Guacamole.Client = function(tunnel) { * Sends a key event having the given properties as if the user * pressed or released a key. * - * @param {Boolean} pressed Whether the key is pressed (true) or released - * (false). - * @param {Number} keysym The keysym of the key being pressed or released. + * @param {!boolean} pressed + * Whether the key is pressed (true) or released (false). + * + * @param {!number} keysym + * The keysym of the key being pressed or released. */ this.sendKeyEvent = function(pressed, keysym) { // Do not send requests if not connected @@ -323,10 +332,10 @@ Guacamole.Client = function(tunnel) { * Sends a mouse event having the properties provided by the given mouse * state. * - * @param {Guacamole.Mouse.State} mouseState + * @param {!Guacamole.Mouse.State} mouseState * The state of the mouse to send in the mouse event. * - * @param {Boolean} [applyDisplayScale=false] + * @param {boolean} [applyDisplayScale=false] * Whether the provided mouse state uses local display units, rather * than remote display units, and should be scaled to match the * {@link Guacamole.Display}. @@ -368,10 +377,10 @@ Guacamole.Client = function(tunnel) { * Sends a touch event having the properties provided by the given touch * state. * - * @param {Guacamole.Touch.State} touchState + * @param {!Guacamole.Touch.State} touchState * The state of the touch contact to send in the touch event. * - * @param {Boolean} [applyDisplayScale=false] + * @param {boolean} [applyDisplayScale=false] * Whether the provided touch state uses local display units, rather * than remote display units, and should be scaled to match the * {@link Guacamole.Display}. @@ -426,7 +435,7 @@ Guacamole.Client = function(tunnel) { * mimetype will be sent along the returned stream. The instruction * necessary to create this stream will automatically be sent. * - * @param {String} mimetype + * @param {!string} mimetype * The mimetype of the audio data that will be sent along the returned * stream. * @@ -447,9 +456,14 @@ Guacamole.Client = function(tunnel) { * filename. The instruction necessary to create this stream will * automatically be sent. * - * @param {String} mimetype The mimetype of the file being sent. - * @param {String} filename The filename of the file being sent. - * @return {!Guacamole.OutputStream} The created file stream. + * @param {!string} mimetype + * The mimetype of the file being sent. + * + * @param {!string} filename + * The filename of the file being sent. + * + * @return {!Guacamole.OutputStream} + * The created file stream. */ this.createFileStream = function(mimetype, filename) { @@ -464,9 +478,14 @@ Guacamole.Client = function(tunnel) { * Opens a new pipe for writing, having the given name and mimetype. The * instruction necessary to create this stream will automatically be sent. * - * @param {String} mimetype The mimetype of the data being sent. - * @param {String} name The name of the pipe. - * @return {!Guacamole.OutputStream} The created file stream. + * @param {!string} mimetype + * The mimetype of the data being sent. + * + * @param {!string} name + * The name of the pipe. + * + * @return {!Guacamole.OutputStream} + * The created file stream. */ this.createPipeStream = function(mimetype, name) { @@ -481,9 +500,14 @@ Guacamole.Client = function(tunnel) { * Opens a new clipboard object for writing, having the given mimetype. The * instruction necessary to create this stream will automatically be sent. * - * @param {String} mimetype The mimetype of the data being sent. - * @param {String} name The name of the pipe. - * @return {!Guacamole.OutputStream} The created file stream. + * @param {!string} mimetype + * The mimetype of the data being sent. + * + * @param {!string} name + * The name of the pipe. + * + * @return {!Guacamole.OutputStream} + * The created file stream. */ this.createClipboardStream = function(mimetype) { @@ -501,13 +525,13 @@ Guacamole.Client = function(tunnel) { * of the following stream. The instruction necessary to create this stream * will automatically be sent. * - * @param {String} mimetype + * @param {!string} mimetype * The mimetype of the data being sent. * - * @param {String} name + * @param {!string} name * The name of the connection parameter to attempt to update. * - * @return {Guacamole.OutputStream} + * @return {!Guacamole.OutputStream} * The created argument value stream. */ this.createArgumentValueStream = function createArgumentValueStream(mimetype, name) { @@ -525,14 +549,14 @@ Guacamole.Client = function(tunnel) { * dictated by the object itself. The instruction necessary to create this * stream will automatically be sent. * - * @param {Number} index + * @param {!number} index * The index of the object for which the output stream is being * created. * - * @param {String} mimetype + * @param {!string} mimetype * The mimetype of the data which will be sent to the output stream. * - * @param {String} name + * @param {!string} name * The defined name of an output stream within the given object. * * @returns {!Guacamole.OutputStream} @@ -552,11 +576,11 @@ Guacamole.Client = function(tunnel) { * Requests read access to the input stream having the given name. If * successful, a new input stream will be created. * - * @param {Number} index + * @param {!number} index * The index of the object from which the input stream is being * requested. * - * @param {String} name + * @param {!string} name * The name of the input stream to request. */ this.requestObjectInputStream = function requestObjectInputStream(index, name) { @@ -571,11 +595,14 @@ Guacamole.Client = function(tunnel) { /** * Acknowledge receipt of a blob on the stream with the given index. * - * @param {Number} index The index of the stream associated with the - * received blob. - * @param {String} message A human-readable message describing the error - * or status. - * @param {Number} code The error code, if any, or 0 for success. + * @param {!number} index + * The index of the stream associated with the received blob. + * + * @param {!string} message + * A human-readable message describing the error or status. + * + * @param {!number} code + * The error code, if any, or 0 for success. */ this.sendAck = function(index, message, code) { @@ -589,8 +616,11 @@ Guacamole.Client = function(tunnel) { /** * Given the index of a file, writes a blob of data to that file. * - * @param {Number} index The index of the file to write to. - * @param {String} data Base64-encoded data to write to the file. + * @param {!number} index + * The index of the file to write to. + * + * @param {!string} data + * Base64-encoded data to write to the file. */ this.sendBlob = function(index, data) { @@ -607,7 +637,7 @@ Guacamole.Client = function(tunnel) { * stream is closed, and the index will be made available for reuse in * future streams. * - * @param {Number} index + * @param {!number} index * The index of the stream to end. */ this.endStream = function(index) { @@ -631,7 +661,8 @@ Guacamole.Client = function(tunnel) { * Fired whenever the state of this Guacamole.Client changes. * * @event - * @param {Number} state The new state of the client. + * @param {!number} state + * The new state of the client. */ this.onstatechange = null; @@ -639,7 +670,8 @@ Guacamole.Client = function(tunnel) { * Fired when the remote client sends a name update. * * @event - * @param {String} name The new name of this client. + * @param {!string} name + * The new name of this client. */ this.onname = null; @@ -648,8 +680,8 @@ Guacamole.Client = function(tunnel) { * is being closed. * * @event - * @param {Guacamole.Status} status A status object which describes the - * error. + * @param {!Guacamole.Status} status + * A status object which describes the error. */ this.onerror = null; @@ -658,10 +690,10 @@ Guacamole.Client = function(tunnel) { * handler will contain its own event handlers for received data. * * @event - * @param {Guacamole.InputStream} stream + * @param {!Guacamole.InputStream} stream * The stream that will receive audio data from the server. * - * @param {String} mimetype + * @param {!string} mimetype * The mimetype of the audio data which will be received. * * @return {Guacamole.AudioPlayer} @@ -677,15 +709,15 @@ Guacamole.Client = function(tunnel) { * handler will contain its own event handlers for received data. * * @event - * @param {Guacamole.InputStream} stream + * @param {!Guacamole.InputStream} stream * The stream that will receive video data from the server. * - * @param {Guacamole.Display.VisibleLayer} layer + * @param {!Guacamole.Display.VisibleLayer} layer * The destination layer on which the received video data should be * played. It is the responsibility of the Guacamole.VideoPlayer * implementation to play the received data within this layer. * - * @param {String} mimetype + * @param {!string} mimetype * The mimetype of the video data which will be received. * * @return {Guacamole.VideoPlayer} @@ -701,10 +733,10 @@ Guacamole.Client = function(tunnel) { * multi-touch support provided by a particular display layer. * * @event - * @param {Guacamole.Display.VisibleLayer} layer + * @param {!Guacamole.Display.VisibleLayer} layer * The layer whose multi-touch support level is being declared. * - * @param {Number} touches + * @param {!number} touches * The maximum number of simultaneous touches supported by the given * layer, where 0 indicates that touch events are not supported at all. */ @@ -715,14 +747,14 @@ Guacamole.Client = function(tunnel) { * by the server. * * @event - * @param {Guacamole.InputStream} stream + * @param {!Guacamole.InputStream} stream * The stream that will receive connection parameter data from the * server. * - * @param {String} mimetype + * @param {!string} mimetype * The mimetype of the data which will be received. * - * @param {String} name + * @param {!string} name * The name of the connection parameter whose value is being exposed. */ this.onargv = null; @@ -731,9 +763,11 @@ Guacamole.Client = function(tunnel) { * Fired when the clipboard of the remote client is changing. * * @event - * @param {Guacamole.InputStream} stream The stream that will receive - * clipboard data from the server. - * @param {String} mimetype The mimetype of the data which will be received. + * @param {!Guacamole.InputStream} stream + * The stream that will receive clipboard data from the server. + * + * @param {!string} mimetype + * The mimetype of the data which will be received. */ this.onclipboard = null; @@ -742,10 +776,14 @@ Guacamole.Client = function(tunnel) { * handler will contain its own event handlers for received data. * * @event - * @param {Guacamole.InputStream} stream The stream that will receive data - * from the server. - * @param {String} mimetype The mimetype of the file received. - * @param {String} filename The name of the file received. + * @param {!Guacamole.InputStream} stream + * The stream that will receive data from the server. + * + * @param {!string} mimetype + * The mimetype of the file received. + * + * @param {!string} filename + * The name of the file received. */ this.onfile = null; @@ -755,10 +793,10 @@ Guacamole.Client = function(tunnel) { * requesting and handling data. * * @event - * @param {Guacamole.Object} object + * @param {!Guacamole.Object} object * The created filesystem object. * - * @param {String} name + * @param {!string} name * The name of the filesystem. */ this.onfilesystem = null; @@ -768,10 +806,14 @@ Guacamole.Client = function(tunnel) { * handler will contain its own event handlers for received data; * * @event - * @param {Guacamole.InputStream} stream The stream that will receive data - * from the server. - * @param {String} mimetype The mimetype of the data which will be received. - * @param {String} name The name of the pipe. + * @param {!Guacamole.InputStream} stream + * The stream that will receive data from the server. + * + * @param {!string} mimetype + * The mimetype of the data which will be received. + * + * @param {!string} name + * The name of the pipe. */ this.onpipe = null; @@ -781,7 +823,7 @@ Guacamole.Client = function(tunnel) { * continue, such as user credentials. * * @event - * @param {String[]} parameters + * @param {!string[]} parameters * The names of the connection parameters that are required to be * provided for the connection to continue. */ @@ -793,8 +835,8 @@ Guacamole.Client = function(tunnel) { * has sent any results. * * @event - * @param {Number} timestamp The timestamp associated with the sync - * instruction. + * @param {!number} timestamp + * The timestamp associated with the sync instruction. */ this.onsync = null; @@ -804,10 +846,10 @@ Guacamole.Client = function(tunnel) { * the default layer, and negative indices refer to buffers. * * @private - * @param {Number} index + * @param {!number} index * The index of the layer to retrieve. * - * @return {Guacamole.Display.VisibleLayer|Guacamole.Layer} + * @return {!(Guacamole.Display.VisibleLayer|Guacamole.Layer)} * The layer having the given index. */ var getLayer = function getLayer(index) { @@ -838,10 +880,10 @@ Guacamole.Client = function(tunnel) { * Positive indices refer to visible layers, an index of zero refers to the * default layer, and negative indices refer to buffers. * - * @param {Guacamole.Display.VisibleLayer|Guacamole.Layer} layer + * @param {!(Guacamole.Display.VisibleLayer|Guacamole.Layer)} layer * The layer whose index should be determined. * - * @returns {Number} + * @returns {number} * The index of the given layer, or null if no such layer is associated * with this client. */ @@ -880,7 +922,9 @@ Guacamole.Client = function(tunnel) { /** * Handlers for all defined layer properties. + * * @private + * @type {!Object.} */ var layerPropertyHandlers = { @@ -901,7 +945,9 @@ Guacamole.Client = function(tunnel) { /** * Handlers for all instruction opcodes receivable by a Guacamole protocol * client. + * * @private + * @type {!Object.} */ var instructionHandlers = { @@ -1629,9 +1675,12 @@ Guacamole.Client = function(tunnel) { * Connects the underlying tunnel of this Guacamole.Client, passing the * given arbitrary data to the tunnel during the connection process. * - * @param data Arbitrary connection data to be sent to the underlying - * tunnel during the connection process. - * @throws {Guacamole.Status} If an error occurs during connection. + * @param {string} data + * Arbitrary connection data to be sent to the underlying tunnel during + * the connection process. + * + * @throws {!Guacamole.Status} + * If an error occurs during connection. */ this.connect = function(data) { @@ -1657,7 +1706,9 @@ Guacamole.Client = function(tunnel) { /** * Map of all Guacamole binary raster operations to transfer functions. + * * @private + * @type {!Object.} */ Guacamole.Client.DefaultTransferFunction = { diff --git a/guacamole-common-js/src/main/webapp/modules/DataURIReader.js b/guacamole-common-js/src/main/webapp/modules/DataURIReader.js index 779a7e9fa..e95f79a31 100644 --- a/guacamole-common-js/src/main/webapp/modules/DataURIReader.js +++ b/guacamole-common-js/src/main/webapp/modules/DataURIReader.js @@ -26,14 +26,19 @@ var Guacamole = Guacamole || {}; * given Guacamole.InputStream. * * @constructor - * @param {Guacamole.InputStream} stream + * @param {!Guacamole.InputStream} stream * The stream that data will be read from. + * + * @param {!string} mimetype + * The mimetype of the data being received. */ Guacamole.DataURIReader = function(stream, mimetype) { /** * Reference to this Guacamole.DataURIReader. + * * @private + * @type {!Guacamole.DataURIReader} */ var guac_reader = this; @@ -41,7 +46,7 @@ Guacamole.DataURIReader = function(stream, mimetype) { * Current data URI. * * @private - * @type {String} + * @type {!string} */ var uri = 'data:' + mimetype + ';base64,'; @@ -66,7 +71,7 @@ Guacamole.DataURIReader = function(stream, mimetype) { * Returns the data URI of all data received through the underlying stream * thus far. * - * @returns {String} + * @returns {!string} * The data URI of all data received through the underlying stream thus * far. */ diff --git a/guacamole-common-js/src/main/webapp/modules/Display.js b/guacamole-common-js/src/main/webapp/modules/Display.js index 31c22aaa5..cd8435b82 100644 --- a/guacamole-common-js/src/main/webapp/modules/Display.js +++ b/guacamole-common-js/src/main/webapp/modules/Display.js @@ -79,7 +79,7 @@ Guacamole.Display = function() { * the relative location within the image of the mouse cursor at which * each click occurs. * - * @type {Number} + * @type {!number} */ this.cursorHotspotX = 0; @@ -88,7 +88,7 @@ Guacamole.Display = function() { * the relative location within the image of the mouse cursor at which * each click occurs. * - * @type {Number} + * @type {!number} */ this.cursorHotspotY = 0; @@ -98,7 +98,7 @@ Guacamole.Display = function() { * the location of the cursor image within the Guacamole display, as * last set by moveCursor(). * - * @type {Number} + * @type {!number} */ this.cursorX = 0; @@ -108,7 +108,7 @@ Guacamole.Display = function() { * the location of the cursor image within the Guacamole display, as * last set by moveCursor(). * - * @type {Number} + * @type {!number} */ this.cursorY = 0; @@ -117,8 +117,11 @@ Guacamole.Display = function() { * is resized. * * @event - * @param {Number} width The new width of the Guacamole display. - * @param {Number} height The new height of the Guacamole display. + * @param {!number} width + * The new width of the Guacamole display. + * + * @param {!number} height + * The new height of the Guacamole display. */ this.onresize = null; @@ -128,9 +131,14 @@ Guacamole.Display = function() { * the default use of a software cursor layer. * * @event - * @param {HTMLCanvasElement} canvas The cursor image. - * @param {Number} x The X-coordinate of the cursor hotspot. - * @param {Number} y The Y-coordinate of the cursor hotspot. + * @param {!HTMLCanvasElement} canvas + * The cursor image. + * + * @param {!number} x + * The X-coordinate of the cursor hotspot. + * + * @param {!number} y + * The Y-coordinate of the cursor hotspot. */ this.oncursor = null; @@ -139,16 +147,18 @@ Guacamole.Display = function() { * tasks added at the end of the queue and old tasks removed from the * front of the queue (FIFO). These tasks will eventually be grouped * into a Frame. + * * @private - * @type {Task[]} + * @type {!Task[]} */ var tasks = []; /** * The queue of all frames. Each frame is a pairing of an array of tasks * and a callback which must be called when the frame is rendered. + * * @private - * @type {Frame[]} + * @type {!Frame[]} */ var frames = []; @@ -183,10 +193,11 @@ Guacamole.Display = function() { * * @private * @constructor - * @param {function} callback The function to call when this frame is - * rendered. - * @param {Task[]} tasks The set of tasks which must be executed to render - * this frame. + * @param {function} [callback] + * The function to call when this frame is rendered. + * + * @param {!Task[]} tasks + * The set of tasks which must be executed to render this frame. */ function Frame(callback, tasks) { @@ -194,8 +205,8 @@ Guacamole.Display = function() { * Returns whether this frame is ready to be rendered. This function * returns true if and only if ALL underlying tasks are unblocked. * - * @returns {boolean} true if all underlying tasks are unblocked, - * false otherwise. + * @returns {!boolean} + * true if all underlying tasks are unblocked, false otherwise. */ this.isReady = function() { @@ -237,12 +248,20 @@ Guacamole.Display = function() { * * @constructor * @private - * @param {function} taskHandler The function to call when this task - * runs, if any. - * @param {boolean} blocked Whether this task should start blocked. + * @param {function} [taskHandler] + * The function to call when this task runs, if any. + * + * @param {boolean} [blocked] + * Whether this task should start blocked. */ function Task(taskHandler, blocked) { - + + /** + * Reference to this Task. + * + * @private + * @type {!Guacamole.Display.Task} + */ var task = this; /** @@ -280,10 +299,14 @@ Guacamole.Display = function() { * render (and no tasks within will execute) until all tasks are unblocked. * * @private - * @param {function} handler The function to call when possible, if any. - * @param {boolean} blocked Whether the task should start blocked. - * @returns {!Task} The Task created and added to the queue for future - * running. + * @param {function} [handler] + * The function to call when possible, if any. + * + * @param {boolean} [blocked] + * Whether the task should start blocked. + * + * @returns {!Task} + * The Task created and added to the queue for future running. */ function scheduleTask(handler, blocked) { var task = new Task(handler, blocked); @@ -294,7 +317,8 @@ Guacamole.Display = function() { /** * Returns the element which contains the Guacamole display. * - * @return {!Element} The element containing the Guacamole display. + * @return {!Element} + * The element containing the Guacamole display. */ this.getElement = function() { return bounds; @@ -303,7 +327,8 @@ Guacamole.Display = function() { /** * Returns the width of this display. * - * @return {Number} The width of this display; + * @return {!number} + * The width of this display; */ this.getWidth = function() { return displayWidth; @@ -312,7 +337,8 @@ Guacamole.Display = function() { /** * Returns the height of this display. * - * @return {Number} The height of this display; + * @return {!number} + * The height of this display; */ this.getHeight = function() { return displayHeight; @@ -324,7 +350,8 @@ Guacamole.Display = function() { * this layer, but the default layer cannot be removed and is the absolute * ancestor of all other layers. * - * @return {!Guacamole.Display.VisibleLayer} The default layer. + * @return {!Guacamole.Display.VisibleLayer} + * The default layer. */ this.getDefaultLayer = function() { return default_layer; @@ -335,7 +362,8 @@ Guacamole.Display = function() { * a layer for the image of the mouse cursor. This layer is a special case * and exists above all other layers, similar to the hardware mouse cursor. * - * @return {!Guacamole.Display.VisibleLayer} The cursor layer. + * @return {!Guacamole.Display.VisibleLayer} + * The cursor layer. */ this.getCursorLayer = function() { return cursor; @@ -346,7 +374,8 @@ Guacamole.Display = function() { * layer, but can be moved to be a child of any other layer. Layers returned * by this function are visible. * - * @return {!Guacamole.Display.VisibleLayer} The newly-created layer. + * @return {!Guacamole.Display.VisibleLayer} + * The newly-created layer. */ this.createLayer = function() { var layer = new Guacamole.Display.VisibleLayer(displayWidth, displayHeight); @@ -359,7 +388,8 @@ Guacamole.Display = function() { * are implemented in the same manner as layers, but do not provide the * same nesting semantics. * - * @return {!Guacamole.Layer} The newly-created buffer. + * @return {!Guacamole.Layer} + * The newly-created buffer. */ this.createBuffer = function() { var buffer = new Guacamole.Layer(0, 0); @@ -372,9 +402,9 @@ Guacamole.Display = function() { * frame is not ready, the flush will wait until all required tasks are * unblocked. * - * @param {function} callback The function to call when this frame is - * flushed. This may happen immediately, or - * later when blocked tasks become unblocked. + * @param {function} [callback] + * The function to call when this frame is flushed. This may happen + * immediately, or later when blocked tasks become unblocked. */ this.flush = function(callback) { @@ -391,21 +421,31 @@ Guacamole.Display = function() { * Sets the hotspot and image of the mouse cursor displayed within the * Guacamole display. * - * @param {Number} hotspotX The X coordinate of the cursor hotspot. - * @param {Number} hotspotY The Y coordinate of the cursor hotspot. - * @param {Guacamole.Layer} layer The source layer containing the data which - * should be used as the mouse cursor image. - * @param {Number} srcx The X coordinate of the upper-left corner of the - * rectangle within the source layer's coordinate - * space to copy data from. - * @param {Number} srcy The Y coordinate of the upper-left corner of the - * rectangle within the source layer's coordinate - * space to copy data from. - * @param {Number} srcw The width of the rectangle within the source layer's - * coordinate space to copy data from. - * @param {Number} srch The height of the rectangle within the source - * layer's coordinate space to copy data from. - + * @param {!number} hotspotX + * The X coordinate of the cursor hotspot. + * + * @param {!number} hotspotY + * The Y coordinate of the cursor hotspot. + * + * @param {!Guacamole.Layer} layer + * The source layer containing the data which should be used as the + * mouse cursor image. + * + * @param {!number} srcx + * The X coordinate of the upper-left corner of the rectangle within + * the source layer's coordinate space to copy data from. + * + * @param {!number} srcy + * The Y coordinate of the upper-left corner of the rectangle within + * the source layer's coordinate space to copy data from. + * + * @param {!number} srcw + * The width of the rectangle within the source layer's coordinate + * space to copy data from. + * + * @param {!number} srch + * The height of the rectangle within the source layer's coordinate + * space to copy data from. */ this.setCursor = function(hotspotX, hotspotY, layer, srcx, srcy, srcw, srch) { scheduleTask(function __display_set_cursor() { @@ -433,7 +473,8 @@ Guacamole.Display = function() { * from the hardware cursor in that it is built into the Guacamole.Display, * and relies on its own Guacamole layer to render. * - * @param {Boolean} [shown=true] Whether to show the software cursor. + * @param {boolean} [shown=true] + * Whether to show the software cursor. */ this.showCursor = function(shown) { @@ -457,8 +498,11 @@ Guacamole.Display = function() { * sake of responsiveness, this function performs its action immediately. * Cursor motion is not maintained within atomic frames. * - * @param {Number} x The X coordinate to move the cursor to. - * @param {Number} y The Y coordinate to move the cursor to. + * @param {!number} x + * The X coordinate to move the cursor to. + * + * @param {!number} y + * The Y coordinate to move the cursor to. */ this.moveCursor = function(x, y) { @@ -477,9 +521,14 @@ Guacamole.Display = function() { * Resizing is only attempted if the new size provided is actually different * from the current size. * - * @param {Guacamole.Layer} layer The layer to resize. - * @param {Number} width The new width. - * @param {Number} height The new height. + * @param {!Guacamole.Layer} layer + * The layer to resize. + * + * @param {!number} width + * The new width. + * + * @param {!number} height + * The new height. */ this.resize = function(layer, width, height) { scheduleTask(function __display_resize() { @@ -512,16 +561,16 @@ Guacamole.Display = function() { * Draws the specified image at the given coordinates. The image specified * must already be loaded. * - * @param {Guacamole.Layer} layer + * @param {!Guacamole.Layer} layer * The layer to draw upon. * - * @param {Number} x + * @param {!number} x * The destination X coordinate. * - * @param {Number} y + * @param {!number} y * The destination Y coordinate. * - * @param {CanvasImageSource} image + * @param {!CanvasImageSource} image * The image to draw. Note that this not a URL. */ this.drawImage = function(layer, x, y, image) { @@ -535,16 +584,16 @@ Guacamole.Display = function() { * coordinates. The Blob specified must already be populated with image * data. * - * @param {Guacamole.Layer} layer + * @param {!Guacamole.Layer} layer * The layer to draw upon. * - * @param {Number} x + * @param {!number} x * The destination X coordinate. * - * @param {Number} y + * @param {!number} y * The destination Y coordinate. * - * @param {Blob} blob + * @param {!Blob} blob * The Blob containing the image data to draw. */ this.drawBlob = function(layer, x, y, blob) { @@ -606,19 +655,19 @@ Guacamole.Display = function() { * given image stream, and should be preferred for received streams except * where manual decoding of the stream is unavoidable. * - * @param {Guacamole.Layer} layer + * @param {!Guacamole.Layer} layer * The layer to draw upon. * - * @param {Number} x + * @param {!number} x * The destination X coordinate. * - * @param {Number} y + * @param {!number} y * The destination Y coordinate. * - * @param {Guacamole.InputStream} stream + * @param {!Guacamole.InputStream} stream * The stream along which image data will be received. * - * @param {String} mimetype + * @param {!string} mimetype * The mimetype of the image within the stream. */ this.drawStream = function drawStream(layer, x, y, stream, mimetype) { @@ -648,10 +697,17 @@ Guacamole.Display = function() { * will be loaded automatically, and this and any future operations will * wait for the image to finish loading. * - * @param {Guacamole.Layer} layer The layer to draw upon. - * @param {Number} x The destination X coordinate. - * @param {Number} y The destination Y coordinate. - * @param {String} url The URL of the image to draw. + * @param {!Guacamole.Layer} layer + * The layer to draw upon. + * + * @param {!number} x + * The destination X coordinate. + * + * @param {!number} y + * The destination Y coordinate. + * + * @param {!string} url + * The URL of the image to draw. */ this.draw = function(layer, x, y, url) { @@ -676,10 +732,17 @@ Guacamole.Display = function() { * wait for the video to finish loading. Future operations will not be * executed until the video finishes playing. * - * @param {Guacamole.Layer} layer The layer to draw upon. - * @param {String} mimetype The mimetype of the video to play. - * @param {Number} duration The duration of the video in milliseconds. - * @param {String} url The URL of the video to play. + * @param {!Guacamole.Layer} layer + * The layer to draw upon. + * + * @param {!string} mimetype + * The mimetype of the video to play. + * + * @param {!number} duration + * The duration of the video in milliseconds. + * + * @param {!string} url + * The URL of the video to play. */ this.play = function(layer, mimetype, duration, url) { @@ -709,23 +772,37 @@ Guacamole.Display = function() { * Transfer a rectangle of image data from one Layer to this Layer using the * specified transfer function. * - * @param {Guacamole.Layer} srcLayer The Layer to copy image data from. - * @param {Number} srcx The X coordinate of the upper-left corner of the - * rectangle within the source Layer's coordinate - * space to copy data from. - * @param {Number} srcy The Y coordinate of the upper-left corner of the - * rectangle within the source Layer's coordinate - * space to copy data from. - * @param {Number} srcw The width of the rectangle within the source Layer's - * coordinate space to copy data from. - * @param {Number} srch The height of the rectangle within the source - * Layer's coordinate space to copy data from. - * @param {Guacamole.Layer} dstLayer The layer to draw upon. - * @param {Number} x The destination X coordinate. - * @param {Number} y The destination Y coordinate. - * @param {Function} transferFunction The transfer function to use to - * transfer data from source to - * destination. + * @param {!Guacamole.Layer} srcLayer + * The Layer to copy image data from. + * + * @param {!number} srcx + * The X coordinate of the upper-left corner of the rectangle within + * the source Layer's coordinate space to copy data from. + * + * @param {!number} srcy + * The Y coordinate of the upper-left corner of the rectangle within + * the source Layer's coordinate space to copy data from. + * + * @param {!number} srcw + * The width of the rectangle within the source Layer's coordinate + * space to copy data from. + * + * @param {!number} srch + * The height of the rectangle within the source Layer's coordinate + * space to copy data from. + * + * @param {!Guacamole.Layer} dstLayer + * The layer to draw upon. + * + * @param {!number} x + * The destination X coordinate. + * + * @param {!number} y + * The destination Y coordinate. + * + * @param {!function} transferFunction + * The transfer function to use to transfer data from source to + * destination. */ this.transfer = function(srcLayer, srcx, srcy, srcw, srch, dstLayer, x, y, transferFunction) { scheduleTask(function __display_transfer() { @@ -737,20 +814,33 @@ Guacamole.Display = function() { * Put a rectangle of image data from one Layer to this Layer directly * without performing any alpha blending. Simply copy the data. * - * @param {Guacamole.Layer} srcLayer The Layer to copy image data from. - * @param {Number} srcx The X coordinate of the upper-left corner of the - * rectangle within the source Layer's coordinate - * space to copy data from. - * @param {Number} srcy The Y coordinate of the upper-left corner of the - * rectangle within the source Layer's coordinate - * space to copy data from. - * @param {Number} srcw The width of the rectangle within the source Layer's - * coordinate space to copy data from. - * @param {Number} srch The height of the rectangle within the source - * Layer's coordinate space to copy data from. - * @param {Guacamole.Layer} dstLayer The layer to draw upon. - * @param {Number} x The destination X coordinate. - * @param {Number} y The destination Y coordinate. + * @param {!Guacamole.Layer} srcLayer + * The Layer to copy image data from. + * + * @param {!number} srcx + * The X coordinate of the upper-left corner of the rectangle within + * the source Layer's coordinate space to copy data from. + * + * @param {!number} srcy + * The Y coordinate of the upper-left corner of the rectangle within + * the source Layer's coordinate space to copy data from. + * + * @param {!number} srcw + * The width of the rectangle within the source Layer's coordinate + * space to copy data from. + * + * @param {!number} srch + * The height of the rectangle within the source Layer's coordinate + * space to copy data from. + * + * @param {!Guacamole.Layer} dstLayer + * The layer to draw upon. + * + * @param {!number} x + * The destination X coordinate. + * + * @param {!number} y + * The destination Y coordinate. */ this.put = function(srcLayer, srcx, srcy, srcw, srch, dstLayer, x, y) { scheduleTask(function __display_put() { @@ -765,20 +855,32 @@ Guacamole.Display = function() { * function was called are complete. This operation will not alter the * size of the source Layer even if its autosize property is set to true. * - * @param {Guacamole.Layer} srcLayer The Layer to copy image data from. - * @param {Number} srcx The X coordinate of the upper-left corner of the - * rectangle within the source Layer's coordinate - * space to copy data from. - * @param {Number} srcy The Y coordinate of the upper-left corner of the - * rectangle within the source Layer's coordinate - * space to copy data from. - * @param {Number} srcw The width of the rectangle within the source Layer's - * coordinate space to copy data from. - * @param {Number} srch The height of the rectangle within the source - * Layer's coordinate space to copy data from. - * @param {Guacamole.Layer} dstLayer The layer to draw upon. - * @param {Number} x The destination X coordinate. - * @param {Number} y The destination Y coordinate. + * @param {!Guacamole.Layer} srcLayer + * The Layer to copy image data from. + * + * @param {!number} srcx + * The X coordinate of the upper-left corner of the rectangle within + * the source Layer's coordinate space to copy data from. + * + * @param {!number} srcy + * The Y coordinate of the upper-left corner of the rectangle within + * the source Layer's coordinate space to copy data from. + * + * @param {!number} srcw + * The width of the rectangle within the source Layer's coordinate + * space to copy data from. + * + * @param {!number} srch + * The height of the rectangle within the source Layer's coordinate space to copy data from. + * + * @param {!Guacamole.Layer} dstLayer + * The layer to draw upon. + * + * @param {!number} x + * The destination X coordinate. + * + * @param {!number} y + * The destination Y coordinate. */ this.copy = function(srcLayer, srcx, srcy, srcw, srch, dstLayer, x, y) { scheduleTask(function __display_copy() { @@ -789,9 +891,14 @@ Guacamole.Display = function() { /** * Starts a new path at the specified point. * - * @param {Guacamole.Layer} layer The layer to draw upon. - * @param {Number} x The X coordinate of the point to draw. - * @param {Number} y The Y coordinate of the point to draw. + * @param {!Guacamole.Layer} layer + * The layer to draw upon. + * + * @param {!number} x + * The X coordinate of the point to draw. + * + * @param {!number} y + * The Y coordinate of the point to draw. */ this.moveTo = function(layer, x, y) { scheduleTask(function __display_moveTo() { @@ -802,9 +909,14 @@ Guacamole.Display = function() { /** * Add the specified line to the current path. * - * @param {Guacamole.Layer} layer The layer to draw upon. - * @param {Number} x The X coordinate of the endpoint of the line to draw. - * @param {Number} y The Y coordinate of the endpoint of the line to draw. + * @param {!Guacamole.Layer} layer + * The layer to draw upon. + * + * @param {!number} x + * The X coordinate of the endpoint of the line to draw. + * + * @param {!number} y + * The Y coordinate of the endpoint of the line to draw. */ this.lineTo = function(layer, x, y) { scheduleTask(function __display_lineTo() { @@ -814,17 +926,29 @@ Guacamole.Display = function() { /** * Add the specified arc to the current path. - * - * @param {Guacamole.Layer} layer The layer to draw upon. - * @param {Number} x The X coordinate of the center of the circle which - * will contain the arc. - * @param {Number} y The Y coordinate of the center of the circle which - * will contain the arc. - * @param {Number} radius The radius of the circle. - * @param {Number} startAngle The starting angle of the arc, in radians. - * @param {Number} endAngle The ending angle of the arc, in radians. - * @param {Boolean} negative Whether the arc should be drawn in order of - * decreasing angle. + * + * @param {!Guacamole.Layer} layer + * The layer to draw upon. + * + * @param {!number} x + * The X coordinate of the center of the circle which will contain the + * arc. + * + * @param {!number} y + * The Y coordinate of the center of the circle which will contain the + * arc. + * + * @param {!number} radius + * The radius of the circle. + * + * @param {!number} startAngle + * The starting angle of the arc, in radians. + * + * @param {!number} endAngle + * The ending angle of the arc, in radians. + * + * @param {!boolean} negative + * Whether the arc should be drawn in order of decreasing angle. */ this.arc = function(layer, x, y, radius, startAngle, endAngle, negative) { scheduleTask(function __display_arc() { @@ -834,14 +958,27 @@ Guacamole.Display = function() { /** * Starts a new path at the specified point. - * - * @param {Guacamole.Layer} layer The layer to draw upon. - * @param {Number} cp1x The X coordinate of the first control point. - * @param {Number} cp1y The Y coordinate of the first control point. - * @param {Number} cp2x The X coordinate of the second control point. - * @param {Number} cp2y The Y coordinate of the second control point. - * @param {Number} x The X coordinate of the endpoint of the curve. - * @param {Number} y The Y coordinate of the endpoint of the curve. + * + * @param {!Guacamole.Layer} layer + * The layer to draw upon. + * + * @param {!number} cp1x + * The X coordinate of the first control point. + * + * @param {!number} cp1y + * The Y coordinate of the first control point. + * + * @param {!number} cp2x + * The X coordinate of the second control point. + * + * @param {!number} cp2y + * The Y coordinate of the second control point. + * + * @param {!number} x + * The X coordinate of the endpoint of the curve. + * + * @param {!number} y + * The Y coordinate of the endpoint of the curve. */ this.curveTo = function(layer, cp1x, cp1y, cp2x, cp2y, x, y) { scheduleTask(function __display_curveTo() { @@ -853,7 +990,8 @@ Guacamole.Display = function() { * Closes the current path by connecting the end point with the start * point (if any) with a straight line. * - * @param {Guacamole.Layer} layer The layer to draw upon. + * @param {!Guacamole.Layer} layer + * The layer to draw upon. */ this.close = function(layer) { scheduleTask(function __display_close() { @@ -863,14 +1001,21 @@ Guacamole.Display = function() { /** * Add the specified rectangle to the current path. - * - * @param {Guacamole.Layer} layer The layer to draw upon. - * @param {Number} x The X coordinate of the upper-left corner of the - * rectangle to draw. - * @param {Number} y The Y coordinate of the upper-left corner of the - * rectangle to draw. - * @param {Number} w The width of the rectangle to draw. - * @param {Number} h The height of the rectangle to draw. + * + * @param {!Guacamole.Layer} layer + * The layer to draw upon. + * + * @param {!number} x + * The X coordinate of the upper-left corner of the rectangle to draw. + * + * @param {!number} y + * The Y coordinate of the upper-left corner of the rectangle to draw. + * + * @param {!number} w + * The width of the rectangle to draw. + * + * @param {!number} h + * The height of the rectangle to draw. */ this.rect = function(layer, x, y, w, h) { scheduleTask(function __display_rect() { @@ -884,7 +1029,8 @@ Guacamole.Display = function() { * for other operations (such as fillColor()) but a new path will be started * once a path drawing operation (path() or rect()) is used. * - * @param {Guacamole.Layer} layer The layer to affect. + * @param {!Guacamole.Layer} layer + * The layer to affect. */ this.clip = function(layer) { scheduleTask(function __display_clip() { @@ -897,17 +1043,30 @@ Guacamole.Display = function() { * is implicitly closed. The current path can continue to be reused * for other operations (such as clip()) but a new path will be started * once a path drawing operation (path() or rect()) is used. - * - * @param {Guacamole.Layer} layer The layer to draw upon. - * @param {String} cap The line cap style. Can be "round", "square", - * or "butt". - * @param {String} join The line join style. Can be "round", "bevel", - * or "miter". - * @param {Number} thickness The line thickness in pixels. - * @param {Number} r The red component of the color to fill. - * @param {Number} g The green component of the color to fill. - * @param {Number} b The blue component of the color to fill. - * @param {Number} a The alpha component of the color to fill. + * + * @param {!Guacamole.Layer} layer + * The layer to draw upon. + * + * @param {!string} cap + * The line cap style. Can be "round", "square", or "butt". + * + * @param {!string} join + * The line join style. Can be "round", "bevel", or "miter". + * + * @param {!number} thickness + * The line thickness in pixels. + * + * @param {!number} r + * The red component of the color to fill. + * + * @param {!number} g + * The green component of the color to fill. + * + * @param {!number} b + * The blue component of the color to fill. + * + * @param {!number} a + * The alpha component of the color to fill. */ this.strokeColor = function(layer, cap, join, thickness, r, g, b, a) { scheduleTask(function __display_strokeColor() { @@ -921,11 +1080,20 @@ Guacamole.Display = function() { * for other operations (such as clip()) but a new path will be started * once a path drawing operation (path() or rect()) is used. * - * @param {Guacamole.Layer} layer The layer to draw upon. - * @param {Number} r The red component of the color to fill. - * @param {Number} g The green component of the color to fill. - * @param {Number} b The blue component of the color to fill. - * @param {Number} a The alpha component of the color to fill. + * @param {!Guacamole.Layer} layer + * The layer to draw upon. + * + * @param {!number} r + * The red component of the color to fill. + * + * @param {!number} g + * The green component of the color to fill. + * + * @param {!number} b + * The blue component of the color to fill. + * + * @param {!number} a + * The alpha component of the color to fill. */ this.fillColor = function(layer, r, g, b, a) { scheduleTask(function __display_fillColor() { @@ -940,14 +1108,20 @@ Guacamole.Display = function() { * for other operations (such as clip()) but a new path will be started * once a path drawing operation (path() or rect()) is used. * - * @param {Guacamole.Layer} layer The layer to draw upon. - * @param {String} cap The line cap style. Can be "round", "square", - * or "butt". - * @param {String} join The line join style. Can be "round", "bevel", - * or "miter". - * @param {Number} thickness The line thickness in pixels. - * @param {Guacamole.Layer} srcLayer The layer to use as a repeating pattern - * within the stroke. + * @param {!Guacamole.Layer} layer + * The layer to draw upon. + * + * @param {!string} cap + * The line cap style. Can be "round", "square", or "butt". + * + * @param {!string} join + * The line join style. Can be "round", "bevel", or "miter". + * + * @param {!number} thickness + * The line thickness in pixels. + * + * @param {!Guacamole.Layer} srcLayer + * The layer to use as a repeating pattern within the stroke. */ this.strokeLayer = function(layer, cap, join, thickness, srcLayer) { scheduleTask(function __display_strokeLayer() { @@ -962,9 +1136,11 @@ Guacamole.Display = function() { * for other operations (such as clip()) but a new path will be started * once a path drawing operation (path() or rect()) is used. * - * @param {Guacamole.Layer} layer The layer to draw upon. - * @param {Guacamole.Layer} srcLayer The layer to use as a repeating pattern - * within the fill. + * @param {!Guacamole.Layer} layer + * The layer to draw upon. + * + * @param {!Guacamole.Layer} srcLayer + * The layer to use as a repeating pattern within the fill. */ this.fillLayer = function(layer, srcLayer) { scheduleTask(function __display_fillLayer() { @@ -975,7 +1151,8 @@ Guacamole.Display = function() { /** * Push current layer state onto stack. * - * @param {Guacamole.Layer} layer The layer to draw upon. + * @param {!Guacamole.Layer} layer + * The layer to draw upon. */ this.push = function(layer) { scheduleTask(function __display_push() { @@ -986,7 +1163,8 @@ Guacamole.Display = function() { /** * Pop layer state off stack. * - * @param {Guacamole.Layer} layer The layer to draw upon. + * @param {!Guacamole.Layer} layer + * The layer to draw upon. */ this.pop = function(layer) { scheduleTask(function __display_pop() { @@ -998,7 +1176,8 @@ Guacamole.Display = function() { * Reset the layer, clearing the stack, the current path, and any transform * matrix. * - * @param {Guacamole.Layer} layer The layer to draw upon. + * @param {!Guacamole.Layer} layer + * The layer to draw upon. */ this.reset = function(layer) { scheduleTask(function __display_reset() { @@ -1009,14 +1188,27 @@ Guacamole.Display = function() { /** * Sets the given affine transform (defined with six values from the * transform's matrix). - * - * @param {Guacamole.Layer} layer The layer to modify. - * @param {Number} a The first value in the affine transform's matrix. - * @param {Number} b The second value in the affine transform's matrix. - * @param {Number} c The third value in the affine transform's matrix. - * @param {Number} d The fourth value in the affine transform's matrix. - * @param {Number} e The fifth value in the affine transform's matrix. - * @param {Number} f The sixth value in the affine transform's matrix. + * + * @param {!Guacamole.Layer} layer + * The layer to modify. + * + * @param {!number} a + * The first value in the affine transform's matrix. + * + * @param {!number} b + * The second value in the affine transform's matrix. + * + * @param {!number} c + * The third value in the affine transform's matrix. + * + * @param {!number} d + * The fourth value in the affine transform's matrix. + * + * @param {!number} e + * The fifth value in the affine transform's matrix. + * + * @param {!number} f + * The sixth value in the affine transform's matrix. */ this.setTransform = function(layer, a, b, c, d, e, f) { scheduleTask(function __display_setTransform() { @@ -1027,14 +1219,28 @@ Guacamole.Display = function() { /** * Applies the given affine transform (defined with six values from the * transform's matrix). - * - * @param {Guacamole.Layer} layer The layer to modify. - * @param {Number} a The first value in the affine transform's matrix. - * @param {Number} b The second value in the affine transform's matrix. - * @param {Number} c The third value in the affine transform's matrix. - * @param {Number} d The fourth value in the affine transform's matrix. - * @param {Number} e The fifth value in the affine transform's matrix. - * @param {Number} f The sixth value in the affine transform's matrix. + * + * @param {!Guacamole.Layer} layer + * The layer to modify. + * + * @param {!number} a + * The first value in the affine transform's matrix. + * + * @param {!number} b + * The second value in the affine transform's matrix. + * + * @param {!number} c + * The third value in the affine transform's matrix. + * + * @param {!number} d + * The fourth value in the affine transform's matrix. + * + * @param {!number} e + * The fifth value in the affine transform's matrix. + * + * @param {!number} f + * The sixth value in the affine transform's matrix. + * */ this.transform = function(layer, a, b, c, d, e, f) { scheduleTask(function __display_transform() { @@ -1051,9 +1257,11 @@ Guacamole.Display = function() { * destination where source transparent, and destination where source * opaque. * - * @param {Guacamole.Layer} layer The layer to modify. - * @param {Number} mask The channel mask for future operations on this - * Layer. + * @param {!Guacamole.Layer} layer + * The layer to modify. + * + * @param {!number} mask + * The channel mask for future operations on this Layer. */ this.setChannelMask = function(layer, mask) { scheduleTask(function __display_setChannelMask() { @@ -1067,9 +1275,11 @@ Guacamole.Display = function() { * width. If this ratio is exceeded, the miter will not be drawn for that * joint of the path. * - * @param {Guacamole.Layer} layer The layer to modify. - * @param {Number} limit The miter limit for stroke operations using the - * miter join. + * @param {!Guacamole.Layer} layer + * The layer to modify. + * + * @param {!number} limit + * The miter limit for stroke operations using the miter join. */ this.setMiterLimit = function(layer, limit) { scheduleTask(function __display_setMiterLimit() { @@ -1081,7 +1291,7 @@ Guacamole.Display = function() { * Removes the given layer container entirely, such that it is no longer * contained within its parent layer, if any. * - * @param {Guacamole.Display.VisibleLayer} layer + * @param {!Guacamole.Display.VisibleLayer} layer * The layer being removed from its parent. */ this.dispose = function dispose(layer) { @@ -1094,25 +1304,25 @@ Guacamole.Display = function() { * Applies the given affine transform (defined with six values from the * transform's matrix) to the given layer. * - * @param {Guacamole.Display.VisibleLayer} layer + * @param {!Guacamole.Display.VisibleLayer} layer * The layer being distorted. * - * @param {Number} a + * @param {!number} a * The first value in the affine transform's matrix. * - * @param {Number} b + * @param {!number} b * The second value in the affine transform's matrix. * - * @param {Number} c + * @param {!number} c * The third value in the affine transform's matrix. * - * @param {Number} d + * @param {!number} d * The fourth value in the affine transform's matrix. * - * @param {Number} e + * @param {!number} e * The fifth value in the affine transform's matrix. * - * @param {Number} f + * @param {!number} f * The sixth value in the affine transform's matrix. */ this.distort = function distort(layer, a, b, c, d, e, f) { @@ -1126,19 +1336,19 @@ Guacamole.Display = function() { * coordinate, sets the Z stacking order, and reparents the layer * to the given parent layer. * - * @param {Guacamole.Display.VisibleLayer} layer + * @param {!Guacamole.Display.VisibleLayer} layer * The layer being moved. * - * @param {Guacamole.Display.VisibleLayer} parent + * @param {!Guacamole.Display.VisibleLayer} parent * The parent to set. * - * @param {Number} x + * @param {!number} x * The X coordinate to move to. * - * @param {Number} y + * @param {!number} y * The Y coordinate to move to. * - * @param {Number} z + * @param {!number} z * The Z coordinate to move to. */ this.move = function move(layer, parent, x, y, z) { @@ -1151,10 +1361,10 @@ Guacamole.Display = function() { * Sets the opacity of the given layer to the given value, where 255 is * fully opaque and 0 is fully transparent. * - * @param {Guacamole.Display.VisibleLayer} layer + * @param {!Guacamole.Display.VisibleLayer} layer * The layer whose opacity should be set. * - * @param {Number} alpha + * @param {!number} alpha * The opacity to set. */ this.shade = function shade(layer, alpha) { @@ -1168,8 +1378,8 @@ Guacamole.Display = function() { * a relatively smaller or larger size, without affecting the true * resolution of the display. * - * @param {Number} scale The scale to resize to, where 1.0 is normal - * size (1:1 scale). + * @param {!number} scale + * The scale to resize to, where 1.0 is normal size (1:1 scale). */ this.scale = function(scale) { @@ -1192,7 +1402,8 @@ Guacamole.Display = function() { /** * Returns the scale of the display. * - * @return {Number} The scale of the display. + * @return {!number} + * The scale of the display. */ this.getScale = function() { return displayScale; @@ -1202,8 +1413,8 @@ Guacamole.Display = function() { * Returns a canvas element containing the entire display, with all child * layers composited within. * - * @return {!HTMLCanvasElement} A new canvas element containing a copy of - * the display. + * @return {!HTMLCanvasElement} + * A new canvas element containing a copy of the display. */ this.flatten = function() { @@ -1292,10 +1503,13 @@ Guacamole.Display = function() { * * @constructor * @augments Guacamole.Layer - * @param {Number} width The width of the Layer, in pixels. The canvas element - * backing this Layer will be given this width. - * @param {Number} height The height of the Layer, in pixels. The canvas element - * backing this Layer will be given this height. + * @param {!number} width + * The width of the Layer, in pixels. The canvas element backing this Layer + * will be given this width. + * + * @param {!number} height + * The height of the Layer, in pixels. The canvas element backing this + * Layer will be given this height. */ Guacamole.Display.VisibleLayer = function(width, height) { @@ -1303,7 +1517,9 @@ Guacamole.Display.VisibleLayer = function(width, height) { /** * Reference to this layer. + * * @private + * @type {!Guacamole.Display.Layer} */ var layer = this; @@ -1313,33 +1529,38 @@ Guacamole.Display.VisibleLayer = function(width, height) { * to the Guacamole protocol, and not relevant at this level. * * @private - * @type {Number} + * @type {!number} */ this.__unique_id = Guacamole.Display.VisibleLayer.__next_id++; /** * The opacity of the layer container, where 255 is fully opaque and 0 is * fully transparent. + * + * @type {!number} */ this.alpha = 0xFF; /** * X coordinate of the upper-left corner of this layer container within * its parent, in pixels. - * @type {Number} + * + * @type {!number} */ this.x = 0; /** * Y coordinate of the upper-left corner of this layer container within * its parent, in pixels. - * @type {Number} + * + * @type {!number} */ this.y = 0; /** * Z stacking order of this layer relative to other sibling layers. - * @type {Number} + * + * @type {!number} */ this.z = 0; @@ -1349,7 +1570,7 @@ Guacamole.Display.VisibleLayer = function(width, height) { * three values being the first row, and the last three values being the * second row. There are six values total. * - * @type {Number[]} + * @type {!number[]} */ this.matrix = [1, 0, 0, 1, 0, 0]; @@ -1362,6 +1583,8 @@ Guacamole.Display.VisibleLayer = function(width, height) { /** * Set of all children of this layer, indexed by layer index. This object * will have one property per child. + * + * @type {!Object.} */ this.children = {}; @@ -1400,7 +1623,9 @@ Guacamole.Display.VisibleLayer = function(width, height) { /** * Returns the element containing the canvas and any other elements * associated with this layer. - * @returns {!Element} The element containing this layer's canvas. + * + * @returns {!Element} + * The element containing this layer's canvas. */ this.getElement = function() { return div; @@ -1408,13 +1633,17 @@ Guacamole.Display.VisibleLayer = function(width, height) { /** * The translation component of this layer's transform. + * * @private + * @type {!string} */ var translate = "translate(0px, 0px)"; // (0, 0) /** * The arbitrary matrix component of this layer's transform. + * * @private + * @type {!string} */ var matrix = "matrix(1, 0, 0, 1, 0, 0)"; // Identity @@ -1422,8 +1651,11 @@ Guacamole.Display.VisibleLayer = function(width, height) { * Moves the upper-left corner of this layer to the given X and Y * coordinate. * - * @param {Number} x The X coordinate to move to. - * @param {Number} y The Y coordinate to move to. + * @param {!number} x + * The X coordinate to move to. + * + * @param {!number} y + * The Y coordinate to move to. */ this.translate = function(x, y) { @@ -1451,10 +1683,17 @@ Guacamole.Display.VisibleLayer = function(width, height) { * coordinate, sets the Z stacking order, and reparents this VisibleLayer * to the given VisibleLayer. * - * @param {Guacamole.Display.VisibleLayer} parent The parent to set. - * @param {Number} x The X coordinate to move to. - * @param {Number} y The Y coordinate to move to. - * @param {Number} z The Z coordinate to move to. + * @param {!Guacamole.Display.VisibleLayer} parent + * The parent to set. + * + * @param {!number} x + * The X coordinate to move to. + * + * @param {!number} y + * The Y coordinate to move to. + * + * @param {!number} z + * The Z coordinate to move to. */ this.move = function(parent, x, y, z) { @@ -1484,7 +1723,8 @@ Guacamole.Display.VisibleLayer = function(width, height) { * Sets the opacity of this layer to the given value, where 255 is fully * opaque and 0 is fully transparent. * - * @param {Number} a The opacity to set. + * @param {!number} a + * The opacity to set. */ this.shade = function(a) { layer.alpha = a; @@ -1512,13 +1752,24 @@ Guacamole.Display.VisibleLayer = function(width, height) { /** * Applies the given affine transform (defined with six values from the * transform's matrix). - * - * @param {Number} a The first value in the affine transform's matrix. - * @param {Number} b The second value in the affine transform's matrix. - * @param {Number} c The third value in the affine transform's matrix. - * @param {Number} d The fourth value in the affine transform's matrix. - * @param {Number} e The fifth value in the affine transform's matrix. - * @param {Number} f The sixth value in the affine transform's matrix. + * + * @param {!number} a + * The first value in the affine transform's matrix. + * + * @param {!number} b + * The second value in the affine transform's matrix. + * + * @param {!number} c + * The third value in the affine transform's matrix. + * + * @param {!number} d + * The fourth value in the affine transform's matrix. + * + * @param {!number} e + * The fifth value in the affine transform's matrix. + * + * @param {!number} f + * The sixth value in the affine transform's matrix. */ this.distort = function(a, b, c, d, e, f) { @@ -1554,6 +1805,6 @@ Guacamole.Display.VisibleLayer = function(width, height) { * the layer, which exists at the protocol/client level only. * * @private - * @type {Number} + * @type {!number} */ Guacamole.Display.VisibleLayer.__next_id = 0; diff --git a/guacamole-common-js/src/main/webapp/modules/Event.js b/guacamole-common-js/src/main/webapp/modules/Event.js index 073363754..04a4148b9 100644 --- a/guacamole-common-js/src/main/webapp/modules/Event.js +++ b/guacamole-common-js/src/main/webapp/modules/Event.js @@ -25,7 +25,7 @@ var Guacamole = Guacamole || {}; * specific to the event type. * * @constructor - * @param {String} type + * @param {!string} type * The unique name of this event type. */ Guacamole.Event = function Event(type) { @@ -33,7 +33,7 @@ Guacamole.Event = function Event(type) { /** * The unique name of this event type. * - * @type {String} + * @type {!string} */ this.type = type; @@ -41,14 +41,14 @@ Guacamole.Event = function Event(type) { * An arbitrary timestamp in milliseconds, indicating this event's * position in time relative to other events. * - * @type {Number} + * @type {!number} */ this.timestamp = new Date().getTime(); /** * Returns the number of milliseconds elapsed since this event was created. * - * @return {Number} + * @return {!number} * The number of milliseconds elapsed since this event was created. */ this.getAge = function getAge() { @@ -69,7 +69,7 @@ Guacamole.Event = function Event(type) { *

* Unless overridden, this function does nothing. * - * @param {Guacamole.Event.Target} eventTarget + * @param {!Guacamole.Event.Target} eventTarget * The {@link Guacamole.Event.Target} that emitted this event. */ this.invokeLegacyHandler = function invokeLegacyHandler(eventTarget) { @@ -88,7 +88,7 @@ Guacamole.Event = function Event(type) { * @constructor * @augments Guacamole.Event * - * @param {String} type + * @param {!string} type * The unique name of this event type. * * @param {Event|Event[]} [events=[]] @@ -137,7 +137,7 @@ Guacamole.Event.DOMEvent = function DOMEvent(type, events) { * event. Invoking this function prevents the default behavior of the event and * stops any further propagation. * - * @param {Event} event + * @param {!Event} event * The DOM event to cancel. */ Guacamole.Event.DOMEvent.cancelEvent = function cancelEvent(event) { @@ -163,10 +163,10 @@ Guacamole.Event.Target = function Target() { * target. * * @callback Guacamole.Event.Target~listener - * @param {Guacamole.Event} event + * @param {!Guacamole.Event} event * The event that was dispatched. * - * @param {Guacamole.Event.Target} target + * @param {!Guacamole.Event.Target} target * The object that dispatched the event. */ @@ -175,7 +175,7 @@ Guacamole.Event.Target = function Target() { * to {@link Guacamole.Event.Targer#on on()}. * * @private - * @type {Object.} + * @type {!Object.} */ var listeners = {}; @@ -184,10 +184,10 @@ Guacamole.Event.Target = function Target() { * the {@link Guacamole.Event#type type} property of {@link Guacamole.Event} * provided to {@link Guacamole.Event.Target#dispatch dispatch()}. * - * @param {String} type + * @param {!string} type * The unique name of this event type. * - * @param {Guacamole.Event.Target~listener} listener + * @param {!Guacamole.Event.Target~listener} listener * The function to invoke when an event having the given type is * dispatched. The {@link Guacamole.Event} object provided to * {@link Guacamole.Event.Target#dispatch dispatch()} will be passed to @@ -211,11 +211,11 @@ Guacamole.Event.Target = function Target() { * Invoking this function is equivalent to manually invoking * {@link Guacamole.Event.Target#on on()} for each of the provided types. * - * @param {String[]} types + * @param {!string[]} types * The unique names of the event types to associate with the given * listener. * - * @param {Guacamole.Event.Target~listener} listener + * @param {!Guacamole.Event.Target~listener} listener * The function to invoke when an event having any of the given types * is dispatched. The {@link Guacamole.Event} object provided to * {@link Guacamole.Event.Target#dispatch dispatch()} will be passed to @@ -232,7 +232,7 @@ Guacamole.Event.Target = function Target() { * this Guacamole.Event.Target for that event's * {@link Guacamole.Event#type type}. * - * @param {Guacamole.Event} event + * @param {!Guacamole.Event} event * The event to dispatch. */ this.dispatch = function dispatch(event) { @@ -258,16 +258,16 @@ Guacamole.Event.Target = function Target() { * listener were registered, the first listener still registered will be * removed. * - * @param {String} type + * @param {!string} type * The unique name of the event type handled by the listener being * removed. * - * @param {Guacamole.Event.Target~listener} listener + * @param {!Guacamole.Event.Target~listener} listener * The listener function previously provided to * {@link Guacamole.Event.Target#on on()}or * {@link Guacamole.Event.Target#onEach onEach()}. * - * @returns {Boolean} + * @returns {!boolean} * true if the specified listener was removed, false otherwise. */ this.off = function off(type, listener) { @@ -298,16 +298,16 @@ Guacamole.Event.Target = function Target() { * Invoking this function is equivalent to manually invoking * {@link Guacamole.Event.Target#off off()} for each of the provided types. * - * @param {String[]} types + * @param {!string[]} types * The unique names of the event types handled by the listeners being * removed. * - * @param {Guacamole.Event.Target~listener} listener + * @param {!Guacamole.Event.Target~listener} listener * The listener function previously provided to * {@link Guacamole.Event.Target#on on()} or * {@link Guacamole.Event.Target#onEach onEach()}. * - * @returns {Boolean} + * @returns {!boolean} * true if any of the specified listeners were removed, false * otherwise. */ diff --git a/guacamole-common-js/src/main/webapp/modules/InputSink.js b/guacamole-common-js/src/main/webapp/modules/InputSink.js index 5b1bfdfa0..616fe2628 100644 --- a/guacamole-common-js/src/main/webapp/modules/InputSink.js +++ b/guacamole-common-js/src/main/webapp/modules/InputSink.js @@ -35,7 +35,7 @@ Guacamole.InputSink = function InputSink() { * Reference to this instance of Guacamole.InputSink. * * @private - * @type {Guacamole.InputSink} + * @type {!Guacamole.InputSink} */ var sink = this; @@ -43,7 +43,7 @@ Guacamole.InputSink = function InputSink() { * The underlying input field, styled to be invisible. * * @private - * @type {Element} + * @type {!Element} */ var field = document.createElement('textarea'); field.style.position = 'fixed'; @@ -100,7 +100,8 @@ Guacamole.InputSink = function InputSink() { * Returns the underlying input field. This input field MUST be manually * added to the DOM for the Guacamole.InputSink to have any effect. * - * @returns {Element} + * @returns {!Element} + * The underlying input field. */ this.getElement = function getElement() { return field; diff --git a/guacamole-common-js/src/main/webapp/modules/InputStream.js b/guacamole-common-js/src/main/webapp/modules/InputStream.js index 9592aa23a..7bda1330b 100644 --- a/guacamole-common-js/src/main/webapp/modules/InputStream.js +++ b/guacamole-common-js/src/main/webapp/modules/InputStream.js @@ -24,20 +24,26 @@ var Guacamole = Guacamole || {}; * transfer of files or other binary data. * * @constructor - * @param {Guacamole.Client} client The client owning this stream. - * @param {Number} index The index of this stream. + * @param {!Guacamole.Client} client + * The client owning this stream. + * + * @param {!number} index + * The index of this stream. */ Guacamole.InputStream = function(client, index) { /** * Reference to this stream. + * * @private + * @type {!Guacamole.InputStream} */ var guac_stream = this; /** * The index of this stream. - * @type {Number} + * + * @type {!number} */ this.index = index; @@ -45,7 +51,8 @@ Guacamole.InputStream = function(client, index) { * Called when a blob of data is received. * * @event - * @param {String} data The received base64 data. + * @param {!string} data + * The received base64 data. */ this.onblob = null; @@ -59,9 +66,11 @@ Guacamole.InputStream = function(client, index) { /** * Acknowledges the receipt of a blob. * - * @param {String} message A human-readable message describing the error - * or status. - * @param {Number} code The error code, if any, or 0 for success. + * @param {!string} message + * A human-readable message describing the error or status. + * + * @param {!number} code + * The error code, if any, or 0 for success. */ this.sendAck = function(message, code) { client.sendAck(guac_stream.index, message, code); diff --git a/guacamole-common-js/src/main/webapp/modules/IntegerPool.js b/guacamole-common-js/src/main/webapp/modules/IntegerPool.js index 2bd94bc53..6916cab14 100644 --- a/guacamole-common-js/src/main/webapp/modules/IntegerPool.js +++ b/guacamole-common-js/src/main/webapp/modules/IntegerPool.js @@ -37,13 +37,14 @@ Guacamole.IntegerPool = function() { * Array of available integers. * * @private - * @type {Number[]} + * @type {!number[]} */ var pool = []; /** * The next integer to return if no more integers remain. - * @type {Number} + * + * @type {!number} */ this.next_int = 0; @@ -51,7 +52,8 @@ Guacamole.IntegerPool = function() { * Returns the next available integer in the pool. If possible, a previously * used integer will be returned. * - * @return {Number} The next available integer. + * @return {!number} + * The next available integer. */ this.next = function() { @@ -67,7 +69,8 @@ Guacamole.IntegerPool = function() { /** * Frees the given integer, allowing it to be reused. * - * @param {Number} integer The integer to free. + * @param {!number} integer + * The integer to free. */ this.free = function(integer) { pool.push(integer); diff --git a/guacamole-common-js/src/main/webapp/modules/JSONReader.js b/guacamole-common-js/src/main/webapp/modules/JSONReader.js index 19b354df5..ef71d786a 100644 --- a/guacamole-common-js/src/main/webapp/modules/JSONReader.js +++ b/guacamole-common-js/src/main/webapp/modules/JSONReader.js @@ -35,7 +35,7 @@ Guacamole.JSONReader = function guacamoleJSONReader(stream) { * Reference to this Guacamole.JSONReader. * * @private - * @type {Guacamole.JSONReader} + * @type {!Guacamole.JSONReader} */ var guacReader = this; @@ -43,7 +43,7 @@ Guacamole.JSONReader = function guacamoleJSONReader(stream) { * Wrapped Guacamole.StringReader. * * @private - * @type {Guacamole.StringReader} + * @type {!Guacamole.StringReader} */ var stringReader = new Guacamole.StringReader(stream); @@ -51,14 +51,14 @@ Guacamole.JSONReader = function guacamoleJSONReader(stream) { * All JSON read thus far. * * @private - * @type {String} + * @type {!string} */ var json = ''; /** * Returns the current length of this Guacamole.JSONReader, in characters. * - * @return {!Number} + * @return {!number} * The current length of this Guacamole.JSONReader. */ this.getLength = function getLength() { @@ -69,7 +69,7 @@ Guacamole.JSONReader = function guacamoleJSONReader(stream) { * Returns the contents of this Guacamole.JSONReader as a JavaScript * object. * - * @return {Object} + * @return {object} * The contents of this Guacamole.JSONReader, as parsed from the JSON * contents of the input stream. */ @@ -99,7 +99,7 @@ Guacamole.JSONReader = function guacamoleJSONReader(stream) { * Fired once for every blob of data received. * * @event - * @param {Number} length + * @param {!number} length * The number of characters received. */ this.onprogress = null; diff --git a/guacamole-common-js/src/main/webapp/modules/Keyboard.js b/guacamole-common-js/src/main/webapp/modules/Keyboard.js index f6ec68594..748cab3cc 100644 --- a/guacamole-common-js/src/main/webapp/modules/Keyboard.js +++ b/guacamole-common-js/src/main/webapp/modules/Keyboard.js @@ -34,7 +34,9 @@ Guacamole.Keyboard = function Keyboard(element) { /** * Reference to this Guacamole.Keyboard. + * * @private + * @type {!Guacamole.Keyboard} */ var guac_keyboard = this; @@ -43,7 +45,7 @@ Guacamole.Keyboard = function Keyboard(element) { * instance with respect to other Guacamole.Keyboard instances. * * @private - * @type {Number} + * @type {!number} */ var guacKeyboardID = Guacamole.Keyboard._nextID++; @@ -53,7 +55,7 @@ Guacamole.Keyboard = function Keyboard(element) { * * @private * @constant - * @type {String} + * @type {!string} */ var EVENT_MARKER = '_GUAC_KEYBOARD_HANDLED_BY_' + guacKeyboardID; @@ -62,9 +64,12 @@ Guacamole.Keyboard = function Keyboard(element) { * with this Guacamole.Keyboard in focus. * * @event - * @param {Number} keysym The keysym of the key being pressed. - * @return {Boolean} true if the key event should be allowed through to the - * browser, false otherwise. + * @param {!number} keysym + * The keysym of the key being pressed. + * + * @return {!boolean} + * true if the key event should be allowed through to the browser, + * false otherwise. */ this.onkeydown = null; @@ -73,7 +78,8 @@ Guacamole.Keyboard = function Keyboard(element) { * with this Guacamole.Keyboard in focus. * * @event - * @param {Number} keysym The keysym of the key being released. + * @param {!number} keysym + * The keysym of the key being released. */ this.onkeyup = null; @@ -83,14 +89,14 @@ Guacamole.Keyboard = function Keyboard(element) { * reliably detect that quirk is to platform/browser-sniff. * * @private - * @type {Object.} + * @type {!Object.} */ var quirks = { /** * Whether keyup events are universally unreliable. * - * @type {Boolean} + * @type {!boolean} */ keyupUnreliable: false, @@ -98,7 +104,7 @@ Guacamole.Keyboard = function Keyboard(element) { * Whether the Alt key is actually a modifier for typable keys and is * thus never used for keyboard shortcuts. * - * @type {Boolean} + * @type {!boolean} */ altIsTypableOnly: false, @@ -106,7 +112,7 @@ Guacamole.Keyboard = function Keyboard(element) { * Whether we can rely on receiving a keyup event for the Caps Lock * key. * - * @type {Boolean} + * @type {!boolean} */ capsLockKeyupUnreliable: false @@ -143,6 +149,9 @@ Guacamole.Keyboard = function Keyboard(element) { /** * Reference to this key event. + * + * @private + * @type {!KeyEvent} */ var key_event = this; @@ -153,7 +162,7 @@ Guacamole.Keyboard = function Keyboard(element) { * this is the Unicode codepoint of the character that would be typed * by the key pressed. * - * @type {Number} + * @type {!number} */ this.keyCode = orig ? (orig.which || orig.keyCode) : 0; @@ -161,7 +170,7 @@ Guacamole.Keyboard = function Keyboard(element) { * The legacy DOM3 "keyIdentifier" of the key pressed, as defined at: * http://www.w3.org/TR/2009/WD-DOM-Level-3-Events-20090908/#events-Events-KeyboardEvent * - * @type {String} + * @type {!string} */ this.keyIdentifier = orig && orig.keyIdentifier; @@ -169,7 +178,7 @@ Guacamole.Keyboard = function Keyboard(element) { * The standard name of the key pressed, as defined at: * http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent * - * @type {String} + * @type {!string} */ this.key = orig && orig.key; @@ -178,7 +187,7 @@ Guacamole.Keyboard = function Keyboard(element) { * defined at: * http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent * - * @type {Number} + * @type {!number} */ this.location = orig ? getEventLocation(orig) : 0; @@ -186,7 +195,7 @@ Guacamole.Keyboard = function Keyboard(element) { * The state of all local keyboard modifiers at the time this event was * received. * - * @type {Guacamole.Keyboard.ModifierState} + * @type {!Guacamole.Keyboard.ModifierState} */ this.modifiers = orig ? Guacamole.Keyboard.ModifierState.fromKeyboardEvent(orig) : new Guacamole.Keyboard.ModifierState(); @@ -194,14 +203,14 @@ Guacamole.Keyboard = function Keyboard(element) { * An arbitrary timestamp in milliseconds, indicating this event's * position in time relative to other events. * - * @type {Number} + * @type {!number} */ this.timestamp = new Date().getTime(); /** * Whether the default action of this key event should be prevented. * - * @type {Boolean} + * @type {!boolean} */ this.defaultPrevented = false; @@ -210,7 +219,7 @@ Guacamole.Keyboard = function Keyboard(element) { * by a best-effort guess using available event properties and keyboard * state. * - * @type {Number} + * @type {number} */ this.keysym = null; @@ -219,7 +228,7 @@ Guacamole.Keyboard = function Keyboard(element) { * If false, the keysym may still be valid, but it's only a best guess, * and future key events may be a better source of information. * - * @type {Boolean} + * @type {!boolean} */ this.reliable = false; @@ -227,8 +236,9 @@ Guacamole.Keyboard = function Keyboard(element) { * Returns the number of milliseconds elapsed since this event was * received. * - * @return {!Number} The number of milliseconds elapsed since this - * event was received. + * @return {!number} + * The number of milliseconds elapsed since this event was + * received. */ this.getAge = function() { return new Date().getTime() - key_event.timestamp; @@ -244,7 +254,7 @@ Guacamole.Keyboard = function Keyboard(element) { * @private * @constructor * @augments Guacamole.Keyboard.KeyEvent - * @param {KeyboardEvent} orig + * @param {!KeyboardEvent} orig * The relevant DOM "keydown" event. */ var KeydownEvent = function KeydownEvent(orig) { @@ -260,7 +270,7 @@ Guacamole.Keyboard = function Keyboard(element) { * Whether the keyup following this keydown event is known to be * reliable. If false, we cannot rely on the keyup event to occur. * - * @type {Boolean} + * @type {!boolean} */ this.keyupReliable = !quirks.keyupUnreliable; @@ -311,7 +321,7 @@ Guacamole.Keyboard = function Keyboard(element) { * @private * @constructor * @augments Guacamole.Keyboard.KeyEvent - * @param {KeyboardEvent} orig + * @param {!KeyboardEvent} orig * The relevant DOM "keypress" event. */ var KeypressEvent = function KeypressEvent(orig) { @@ -337,7 +347,7 @@ Guacamole.Keyboard = function Keyboard(element) { * @private * @constructor * @augments Guacamole.Keyboard.KeyEvent - * @param {KeyboardEvent} orig + * @param {!KeyboardEvent} orig * The relevant DOM "keyup" event. */ var KeyupEvent = function KeyupEvent(orig) { @@ -367,14 +377,16 @@ Guacamole.Keyboard = function Keyboard(element) { * KeydownEvent, KeypressEvent, and KeyupEvent classes. * * @private - * @type {KeyEvent[]} + * @type {!KeyEvent[]} */ var eventLog = []; /** * Map of known JavaScript keycodes which do not map to typable characters * to their X11 keysym equivalents. + * * @private + * @type {!Object.} */ var keycodeKeysyms = { 8: [0xFF08], // backspace @@ -436,7 +448,9 @@ Guacamole.Keyboard = function Keyboard(element) { /** * Map of known JavaScript keyidentifiers which do not map to typable * characters to their unshifted X11 keysym equivalents. + * * @private + * @type {!Object.} */ var keyidentifier_keysym = { "Again": [0xFF66], @@ -551,7 +565,9 @@ Guacamole.Keyboard = function Keyboard(element) { /** * All keysyms which should not repeat when held down. + * * @private + * @type {!Object.} */ var no_repeat = { 0xFE03: true, // ISO Level 3 Shift (AltGr) @@ -570,6 +586,8 @@ Guacamole.Keyboard = function Keyboard(element) { /** * All modifiers and their states. + * + * @type {!Guacamole.Keyboard.ModifierState} */ this.modifiers = new Guacamole.Keyboard.ModifierState(); @@ -577,6 +595,8 @@ Guacamole.Keyboard = function Keyboard(element) { * The state of every key, indexed by keysym. If a particular key is * pressed, the value of pressed for that keysym will be true. If a key * is not currently pressed, it will not be defined. + * + * @type {!Object.} */ this.pressed = {}; @@ -589,7 +609,7 @@ Guacamole.Keyboard = function Keyboard(element) { * of the key is explicitly known), it will not be defined. * * @private - * @tyle {Object.} + * @type {!Object.} */ var implicitlyPressed = {}; @@ -600,6 +620,7 @@ Guacamole.Keyboard = function Keyboard(element) { * is (theoretically) still pressed. * * @private + * @type {!Object.} */ var last_keydown_result = {}; @@ -608,20 +629,24 @@ Guacamole.Keyboard = function Keyboard(element) { * fired. This object maps keycodes to keysyms. * * @private - * @type {Object.} + * @type {!Object.} */ var recentKeysym = {}; /** * Timeout before key repeat starts. + * * @private + * @type {number} */ var key_repeat_timeout = null; /** * Interval which presses and releases the last key pressed while that * key is still being held down. + * * @private + * @type {number} */ var key_repeat_interval = null; @@ -631,11 +656,11 @@ Guacamole.Keyboard = function Keyboard(element) { * undefined. * * @private - * @param {Number[]} keysyms + * @param {number[]} keysyms * An array of keysyms, where the index of the keysym in the array is * the location value. * - * @param {Number} location + * @param {!number} location * The location on the keyboard corresponding to the key pressed, as * defined at: http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent */ @@ -651,10 +676,10 @@ Guacamole.Keyboard = function Keyboard(element) { * Returns true if the given keysym corresponds to a printable character, * false otherwise. * - * @param {Number} keysym + * @param {!number} keysym * The keysym to check. * - * @returns {boolean} + * @returns {!boolean} * true if the given keysym corresponds to a printable character, * false otherwise. */ @@ -733,13 +758,13 @@ Guacamole.Keyboard = function Keyboard(element) { * correct in all cases. * * @private - * @param {Number} keyCode + * @param {!number} keyCode * The keyCode from a browser keydown/keyup event. * - * @param {String} keyIdentifier + * @param {string} keyIdentifier * The legacy keyIdentifier from a browser keydown/keyup event. * - * @returns {boolean} + * @returns {!boolean} * true if the keyIdentifier looks sane, false if the keyIdentifier * appears incorrectly derived or is missing entirely. */ @@ -776,8 +801,11 @@ Guacamole.Keyboard = function Keyboard(element) { * not a modifier. The return value of this function depends on the * return value of the keydown event handler, if any. * - * @param {Number} keysym The keysym of the key to press. - * @return {Boolean} true if event should NOT be canceled, false otherwise. + * @param {number} keysym + * The keysym of the key to press. + * + * @return {boolean} + * true if event should NOT be canceled, false otherwise. */ this.press = function(keysym) { @@ -820,7 +848,8 @@ Guacamole.Keyboard = function Keyboard(element) { /** * Marks a key as released, firing the keyup event if registered. * - * @param {Number} keysym The keysym of the key to release. + * @param {number} keysym + * The keysym of the key to release. */ this.release = function(keysym) { @@ -847,7 +876,7 @@ Guacamole.Keyboard = function Keyboard(element) { * Presses and releases the keys necessary to type the given string of * text. * - * @param {String} str + * @param {!string} str * The string to type. */ this.type = function type(str) { @@ -889,14 +918,14 @@ Guacamole.Keyboard = function Keyboard(element) { * releasing keysyms. * * @private - * @param {string} modifier + * @param {!string} modifier * The name of the {@link Guacamole.Keyboard.ModifierState} property * being updated. * - * @param {number[]} keysyms + * @param {!number[]} keysyms * The keysyms which represent the modifier being updated. * - * @param {KeyEvent} keyEvent + * @param {!KeyEvent} keyEvent * Guacamole's current best interpretation of the key event being * processed. */ @@ -954,7 +983,7 @@ Guacamole.Keyboard = function Keyboard(element) { * This function pays no attention to keycodes. * * @private - * @param {KeyEvent} keyEvent + * @param {!KeyEvent} keyEvent * Guacamole's current best interpretation of the key event being * processed. */ @@ -1002,7 +1031,7 @@ Guacamole.Keyboard = function Keyboard(element) { * inspection of other key events. * * @private - * @returns {boolean} + * @returns {!boolean} * true if all currently pressed keys were implicitly pressed, false * otherwise. */ @@ -1023,8 +1052,8 @@ Guacamole.Keyboard = function Keyboard(element) { * can be). * * @private - * @return {Boolean} Whether the default action of the latest event should - * be prevented. + * @return {boolean} + * Whether the default action of the latest event should be prevented. */ function interpret_events() { @@ -1054,7 +1083,8 @@ Guacamole.Keyboard = function Keyboard(element) { * looks like a key that may require AltGr. * * @private - * @param {Number} keysym The key that was just pressed. + * @param {!number} keysym + * The key that was just pressed. */ var release_simulated_altgr = function release_simulated_altgr(keysym) { @@ -1214,11 +1244,11 @@ Guacamole.Keyboard = function Keyboard(element) { * have the same keycode, such as left shift vs. right shift. * * @private - * @param {KeyboardEvent} e + * @param {!KeyboardEvent} e * A JavaScript keyboard event, as received through the DOM via a * "keydown", "keyup", or "keypress" handler. * - * @returns {Number} + * @returns {!number} * The location of the key event on the keyboard, as defined at: * http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent */ @@ -1242,10 +1272,10 @@ Guacamole.Keyboard = function Keyboard(element) { * Guacamole.Keyboard. If the Event has already been marked as handled, * false is returned. * - * @param {Event} e + * @param {!Event} e * The Event to mark. * - * @returns {boolean} + * @returns {!boolean} * true if the given Event was successfully marked, false if the given * Event was already marked. */ @@ -1267,7 +1297,7 @@ Guacamole.Keyboard = function Keyboard(element) { * events signalled through this Guacamole.Keyboard's onkeydown and * onkeyup handlers. * - * @param {Element|Document} element + * @param {!(Element|Document)} element * The Element to attach event listeners to for the sake of handling * key or input events. */ @@ -1339,7 +1369,7 @@ Guacamole.Keyboard = function Keyboard(element) { * events is suspended, as such events may conflict with input events. * * @private - * @param {InputEvent} e + * @param {!InputEvent} e * The "input" event to handle. */ var handleInput = function handleInput(e) { @@ -1365,7 +1395,7 @@ Guacamole.Keyboard = function Keyboard(element) { * with composition events. * * @private - * @param {CompositionEvent} e + * @param {!CompositionEvent} e * The "compositionend" event to handle. */ var handleComposition = function handleComposition(e) { @@ -1401,7 +1431,7 @@ Guacamole.Keyboard = function Keyboard(element) { * instance. * * @private - * @type {Number} + * @type {!number} */ Guacamole.Keyboard._nextID = 0; @@ -1413,31 +1443,36 @@ Guacamole.Keyboard.ModifierState = function() { /** * Whether shift is currently pressed. - * @type {Boolean} + * + * @type {!boolean} */ this.shift = false; /** * Whether ctrl is currently pressed. - * @type {Boolean} + * + * @type {!boolean} */ this.ctrl = false; /** * Whether alt is currently pressed. - * @type {Boolean} + * + * @type {!boolean} */ this.alt = false; /** * Whether meta (apple key) is currently pressed. - * @type {Boolean} + * + * @type {!boolean} */ this.meta = false; /** * Whether hyper (windows key) is currently pressed. - * @type {Boolean} + * + * @type {!boolean} */ this.hyper = false; @@ -1446,9 +1481,11 @@ Guacamole.Keyboard.ModifierState = function() { /** * Returns the modifier state applicable to the keyboard event given. * - * @param {KeyboardEvent} e The keyboard event to read. - * @returns {!Guacamole.Keyboard.ModifierState} The current state of keyboard - * modifiers. + * @param {!KeyboardEvent} e + * The keyboard event to read. + * + * @returns {!Guacamole.Keyboard.ModifierState} + * The current state of keyboard modifiers. */ Guacamole.Keyboard.ModifierState.fromKeyboardEvent = function(e) { diff --git a/guacamole-common-js/src/main/webapp/modules/Layer.js b/guacamole-common-js/src/main/webapp/modules/Layer.js index 9561be423..7040d1b16 100644 --- a/guacamole-common-js/src/main/webapp/modules/Layer.js +++ b/guacamole-common-js/src/main/webapp/modules/Layer.js @@ -28,17 +28,21 @@ var Guacamole = Guacamole || {}; * * @constructor * - * @param {Number} width The width of the Layer, in pixels. The canvas element - * backing this Layer will be given this width. + * @param {!number} width + * The width of the Layer, in pixels. The canvas element backing this Layer + * will be given this width. * - * @param {Number} height The height of the Layer, in pixels. The canvas element - * backing this Layer will be given this height. + * @param {!number} height + * The height of the Layer, in pixels. The canvas element backing this + * Layer will be given this height. */ Guacamole.Layer = function(width, height) { /** * Reference to this Layer. + * * @private + * @type {!Guacamole.Layer} */ var layer = this; @@ -49,19 +53,23 @@ Guacamole.Layer = function(width, height) { * * @private * @constant - * @type Number + * @type {!number} */ var CANVAS_SIZE_FACTOR = 64; /** * The canvas element backing this Layer. + * * @private + * @type {!HTMLCanvasElement} */ var canvas = document.createElement("canvas"); /** * The 2D display context of the canvas element backing this Layer. + * * @private + * @type {!CanvasRenderingContext2D} */ var context = canvas.getContext("2d"); context.save(); @@ -72,14 +80,16 @@ Guacamole.Layer = function(width, height) { * false. * * @private - * @type Boolean + * @type {!boolean} */ var empty = true; /** * Whether a new path should be started with the next path drawing * operations. + * * @private + * @type {!boolean} */ var pathClosed = true; @@ -91,13 +101,16 @@ Guacamole.Layer = function(width, height) { * initial state. * * @private + * @type {!number} */ var stackSize = 0; /** * Map of all Guacamole channel masks to HTML5 canvas composite operation * names. Not all channel mask combinations are currently implemented. + * * @private + * @type {!Object.} */ var compositeOperation = { /* 0x0 NOT IMPLEMENTED */ @@ -123,10 +136,10 @@ Guacamole.Layer = function(width, height) { * be used internally. * * @private - * @param {Number} [newWidth=0] + * @param {number} [newWidth=0] * The new width to assign to this Layer. * - * @param {Number} [newHeight=0] + * @param {number} [newHeight=0] * The new height to assign to this Layer. */ var resize = function resize(newWidth, newHeight) { @@ -201,12 +214,17 @@ Guacamole.Layer = function(width, height) { * coordinate space, the canvas is left unchanged. * * @private - * @param {Number} x The X coordinate of the upper-left corner of the - * rectangle to fit. - * @param {Number} y The Y coordinate of the upper-left corner of the - * rectangle to fit. - * @param {Number} w The width of the the rectangle to fit. - * @param {Number} h The height of the the rectangle to fit. + * @param {!number} x + * The X coordinate of the upper-left corner of the rectangle to fit. + * + * @param {!number} y + * The Y coordinate of the upper-left corner of the rectangle to fit. + * + * @param {!number} w + * The width of the rectangle to fit. + * + * @param {!number} h + * The height of the rectangle to fit. */ function fitRect(x, y, w, h) { @@ -249,20 +267,22 @@ Guacamole.Layer = function(width, height) { * layer.autosize = true; * }); * - * @type {Boolean} + * @type {!boolean} * @default false */ this.autosize = false; /** * The current width of this layer. - * @type {Number} + * + * @type {!number} */ this.width = width; /** * The current height of this layer. - * @type {Number} + * + * @type {!number} */ this.height = height; @@ -307,8 +327,11 @@ Guacamole.Layer = function(width, height) { * is only attempted if the new size provided is actually different from * the current size. * - * @param {Number} newWidth The new width to assign to this Layer. - * @param {Number} newHeight The new height to assign to this Layer. + * @param {!number} newWidth + * The new width to assign to this Layer. + * + * @param {!number} newHeight + * The new height to assign to this Layer. */ this.resize = function(newWidth, newHeight) { if (newWidth !== layer.width || newHeight !== layer.height) @@ -319,13 +342,13 @@ Guacamole.Layer = function(width, height) { * Draws the specified image at the given coordinates. The image specified * must already be loaded. * - * @param {Number} x + * @param {!number} x * The destination X coordinate. * - * @param {Number} y + * @param {!number} y * The destination Y coordinate. * - * @param {CanvasImageSource} image + * @param {!CanvasImageSource} image * The image to draw. Note that this is not a URL. */ this.drawImage = function(x, y, image) { @@ -338,22 +361,34 @@ Guacamole.Layer = function(width, height) { * Transfer a rectangle of image data from one Layer to this Layer using the * specified transfer function. * - * @param {Guacamole.Layer} srcLayer The Layer to copy image data from. - * @param {Number} srcx The X coordinate of the upper-left corner of the - * rectangle within the source Layer's coordinate - * space to copy data from. - * @param {Number} srcy The Y coordinate of the upper-left corner of the - * rectangle within the source Layer's coordinate - * space to copy data from. - * @param {Number} srcw The width of the rectangle within the source Layer's - * coordinate space to copy data from. - * @param {Number} srch The height of the rectangle within the source - * Layer's coordinate space to copy data from. - * @param {Number} x The destination X coordinate. - * @param {Number} y The destination Y coordinate. - * @param {Function} transferFunction The transfer function to use to - * transfer data from source to - * destination. + * @param {!Guacamole.Layer} srcLayer + * The Layer to copy image data from. + * + * @param {!number} srcx + * The X coordinate of the upper-left corner of the rectangle within + * the source Layer's coordinate space to copy data from. + * + * @param {!number} srcy + * The Y coordinate of the upper-left corner of the rectangle within + * the source Layer's coordinate space to copy data from. + * + * @param {!number} srcw + * The width of the rectangle within the source Layer's coordinate + * space to copy data from. + * + * @param {!number} srch + * The height of the rectangle within the source Layer's coordinate + * space to copy data from. + * + * @param {!number} x + * The destination X coordinate. + * + * @param {!number} y + * The destination Y coordinate. + * + * @param {!function} transferFunction + * The transfer function to use to transfer data from source to + * destination. */ this.transfer = function(srcLayer, srcx, srcy, srcw, srch, x, y, transferFunction) { @@ -418,19 +453,30 @@ Guacamole.Layer = function(width, height) { * Put a rectangle of image data from one Layer to this Layer directly * without performing any alpha blending. Simply copy the data. * - * @param {Guacamole.Layer} srcLayer The Layer to copy image data from. - * @param {Number} srcx The X coordinate of the upper-left corner of the - * rectangle within the source Layer's coordinate - * space to copy data from. - * @param {Number} srcy The Y coordinate of the upper-left corner of the - * rectangle within the source Layer's coordinate - * space to copy data from. - * @param {Number} srcw The width of the rectangle within the source Layer's - * coordinate space to copy data from. - * @param {Number} srch The height of the rectangle within the source - * Layer's coordinate space to copy data from. - * @param {Number} x The destination X coordinate. - * @param {Number} y The destination Y coordinate. + * @param {!Guacamole.Layer} srcLayer + * The Layer to copy image data from. + * + * @param {!number} srcx + * The X coordinate of the upper-left corner of the rectangle within + * the source Layer's coordinate space to copy data from. + * + * @param {!number} srcy + * The Y coordinate of the upper-left corner of the rectangle within + * the source Layer's coordinate space to copy data from. + * + * @param {!number} srcw + * The width of the rectangle within the source Layer's coordinate + * space to copy data from. + * + * @param {!number} srch + * The height of the rectangle within the source Layer's coordinate + * space to copy data from. + * + * @param {!number} x + * The destination X coordinate. + * + * @param {!number} y + * The destination Y coordinate. */ this.put = function(srcLayer, srcx, srcy, srcw, srch, x, y) { @@ -465,19 +511,30 @@ Guacamole.Layer = function(width, height) { * function was called are complete. This operation will not alter the * size of the source Layer even if its autosize property is set to true. * - * @param {Guacamole.Layer} srcLayer The Layer to copy image data from. - * @param {Number} srcx The X coordinate of the upper-left corner of the - * rectangle within the source Layer's coordinate - * space to copy data from. - * @param {Number} srcy The Y coordinate of the upper-left corner of the - * rectangle within the source Layer's coordinate - * space to copy data from. - * @param {Number} srcw The width of the rectangle within the source Layer's - * coordinate space to copy data from. - * @param {Number} srch The height of the rectangle within the source - * Layer's coordinate space to copy data from. - * @param {Number} x The destination X coordinate. - * @param {Number} y The destination Y coordinate. + * @param {!Guacamole.Layer} srcLayer + * The Layer to copy image data from. + * + * @param {!number} srcx + * The X coordinate of the upper-left corner of the rectangle within + * the source Layer's coordinate space to copy data from. + * + * @param {!number} srcy + * The Y coordinate of the upper-left corner of the rectangle within + * the source Layer's coordinate space to copy data from. + * + * @param {!number} srcw + * The width of the rectangle within the source Layer's coordinate + * space to copy data from. + * + * @param {!number} srch + * The height of the rectangle within the source Layer's coordinate + * space to copy data from. + * + * @param {!number} x + * The destination X coordinate. + * + * @param {!number} y + * The destination Y coordinate. */ this.copy = function(srcLayer, srcx, srcy, srcw, srch, x, y) { @@ -505,8 +562,11 @@ Guacamole.Layer = function(width, height) { /** * Starts a new path at the specified point. * - * @param {Number} x The X coordinate of the point to draw. - * @param {Number} y The Y coordinate of the point to draw. + * @param {!number} x + * The X coordinate of the point to draw. + * + * @param {!number} y + * The Y coordinate of the point to draw. */ this.moveTo = function(x, y) { @@ -524,8 +584,11 @@ Guacamole.Layer = function(width, height) { /** * Add the specified line to the current path. * - * @param {Number} x The X coordinate of the endpoint of the line to draw. - * @param {Number} y The Y coordinate of the endpoint of the line to draw. + * @param {!number} x + * The X coordinate of the endpoint of the line to draw. + * + * @param {!number} y + * The Y coordinate of the endpoint of the line to draw. */ this.lineTo = function(x, y) { @@ -543,15 +606,25 @@ Guacamole.Layer = function(width, height) { /** * Add the specified arc to the current path. * - * @param {Number} x The X coordinate of the center of the circle which - * will contain the arc. - * @param {Number} y The Y coordinate of the center of the circle which - * will contain the arc. - * @param {Number} radius The radius of the circle. - * @param {Number} startAngle The starting angle of the arc, in radians. - * @param {Number} endAngle The ending angle of the arc, in radians. - * @param {Boolean} negative Whether the arc should be drawn in order of - * decreasing angle. + * @param {!number} x + * The X coordinate of the center of the circle which will contain the + * arc. + * + * @param {!number} y + * The Y coordinate of the center of the circle which will contain the + * arc. + * + * @param {!number} radius + * The radius of the circle. + * + * @param {!number} startAngle + * The starting angle of the arc, in radians. + * + * @param {!number} endAngle + * The ending angle of the arc, in radians. + * + * @param {!boolean} negative + * Whether the arc should be drawn in order of decreasing angle. */ this.arc = function(x, y, radius, startAngle, endAngle, negative) { @@ -569,12 +642,23 @@ Guacamole.Layer = function(width, height) { /** * Starts a new path at the specified point. * - * @param {Number} cp1x The X coordinate of the first control point. - * @param {Number} cp1y The Y coordinate of the first control point. - * @param {Number} cp2x The X coordinate of the second control point. - * @param {Number} cp2y The Y coordinate of the second control point. - * @param {Number} x The X coordinate of the endpoint of the curve. - * @param {Number} y The Y coordinate of the endpoint of the curve. + * @param {!number} cp1x + * The X coordinate of the first control point. + * + * @param {!number} cp1y + * The Y coordinate of the first control point. + * + * @param {!number} cp2x + * The X coordinate of the second control point. + * + * @param {!number} cp2y + * The Y coordinate of the second control point. + * + * @param {!number} x + * The X coordinate of the endpoint of the curve. + * + * @param {!number} y + * The Y coordinate of the endpoint of the curve. */ this.curveTo = function(cp1x, cp1y, cp2x, cp2y, x, y) { @@ -601,12 +685,17 @@ Guacamole.Layer = function(width, height) { /** * Add the specified rectangle to the current path. * - * @param {Number} x The X coordinate of the upper-left corner of the - * rectangle to draw. - * @param {Number} y The Y coordinate of the upper-left corner of the - * rectangle to draw. - * @param {Number} w The width of the rectangle to draw. - * @param {Number} h The height of the rectangle to draw. + * @param {!number} x + * The X coordinate of the upper-left corner of the rectangle to draw. + * + * @param {!number} y + * The Y coordinate of the upper-left corner of the rectangle to draw. + * + * @param {!number} w + * The width of the rectangle to draw. + * + * @param {!number} h + * The height of the rectangle to draw. */ this.rect = function(x, y, w, h) { @@ -643,15 +732,26 @@ Guacamole.Layer = function(width, height) { * for other operations (such as clip()) but a new path will be started * once a path drawing operation (path() or rect()) is used. * - * @param {String} cap The line cap style. Can be "round", "square", - * or "butt". - * @param {String} join The line join style. Can be "round", "bevel", - * or "miter". - * @param {Number} thickness The line thickness in pixels. - * @param {Number} r The red component of the color to fill. - * @param {Number} g The green component of the color to fill. - * @param {Number} b The blue component of the color to fill. - * @param {Number} a The alpha component of the color to fill. + * @param {!string} cap + * The line cap style. Can be "round", "square", or "butt". + * + * @param {!string} join + * The line join style. Can be "round", "bevel", or "miter". + * + * @param {!number} thickness + * The line thickness in pixels. + * + * @param {!number} r + * The red component of the color to fill. + * + * @param {!number} g + * The green component of the color to fill. + * + * @param {!number} b + * The blue component of the color to fill. + * + * @param {!number} a + * The alpha component of the color to fill. */ this.strokeColor = function(cap, join, thickness, r, g, b, a) { @@ -674,10 +774,17 @@ Guacamole.Layer = function(width, height) { * for other operations (such as clip()) but a new path will be started * once a path drawing operation (path() or rect()) is used. * - * @param {Number} r The red component of the color to fill. - * @param {Number} g The green component of the color to fill. - * @param {Number} b The blue component of the color to fill. - * @param {Number} a The alpha component of the color to fill. + * @param {!number} r + * The red component of the color to fill. + * + * @param {!number} g + * The green component of the color to fill. + * + * @param {!number} b + * The blue component of the color to fill. + * + * @param {!number} a + * The alpha component of the color to fill. */ this.fillColor = function(r, g, b, a) { @@ -698,13 +805,17 @@ Guacamole.Layer = function(width, height) { * for other operations (such as clip()) but a new path will be started * once a path drawing operation (path() or rect()) is used. * - * @param {String} cap The line cap style. Can be "round", "square", - * or "butt". - * @param {String} join The line join style. Can be "round", "bevel", - * or "miter". - * @param {Number} thickness The line thickness in pixels. - * @param {Guacamole.Layer} srcLayer The layer to use as a repeating pattern - * within the stroke. + * @param {!string} cap + * The line cap style. Can be "round", "square", or "butt". + * + * @param {!string} join + * The line join style. Can be "round", "bevel", or "miter". + * + * @param {!number} thickness + * The line thickness in pixels. + * + * @param {!Guacamole.Layer} srcLayer + * The layer to use as a repeating pattern within the stroke. */ this.strokeLayer = function(cap, join, thickness, srcLayer) { @@ -731,8 +842,8 @@ Guacamole.Layer = function(width, height) { * for other operations (such as clip()) but a new path will be started * once a path drawing operation (path() or rect()) is used. * - * @param {Guacamole.Layer} srcLayer The layer to use as a repeating pattern - * within the fill. + * @param {!Guacamole.Layer} srcLayer + * The layer to use as a repeating pattern within the fill. */ this.fillLayer = function(srcLayer) { @@ -799,12 +910,23 @@ Guacamole.Layer = function(width, height) { * Sets the given affine transform (defined with six values from the * transform's matrix). * - * @param {Number} a The first value in the affine transform's matrix. - * @param {Number} b The second value in the affine transform's matrix. - * @param {Number} c The third value in the affine transform's matrix. - * @param {Number} d The fourth value in the affine transform's matrix. - * @param {Number} e The fifth value in the affine transform's matrix. - * @param {Number} f The sixth value in the affine transform's matrix. + * @param {!number} a + * The first value in the affine transform's matrix. + * + * @param {!number} b + * The second value in the affine transform's matrix. + * + * @param {!number} c + * The third value in the affine transform's matrix. + * + * @param {!number} d + * The fourth value in the affine transform's matrix. + * + * @param {!number} e + * The fifth value in the affine transform's matrix. + * + * @param {!number} f + * The sixth value in the affine transform's matrix. */ this.setTransform = function(a, b, c, d, e, f) { context.setTransform( @@ -817,13 +939,24 @@ Guacamole.Layer = function(width, height) { /** * Applies the given affine transform (defined with six values from the * transform's matrix). - * - * @param {Number} a The first value in the affine transform's matrix. - * @param {Number} b The second value in the affine transform's matrix. - * @param {Number} c The third value in the affine transform's matrix. - * @param {Number} d The fourth value in the affine transform's matrix. - * @param {Number} e The fifth value in the affine transform's matrix. - * @param {Number} f The sixth value in the affine transform's matrix. + * + * @param {!number} a + * The first value in the affine transform's matrix. + * + * @param {!number} b + * The second value in the affine transform's matrix. + * + * @param {!number} c + * The third value in the affine transform's matrix. + * + * @param {!number} d + * The fourth value in the affine transform's matrix. + * + * @param {!number} e + * The fifth value in the affine transform's matrix. + * + * @param {!number} f + * The sixth value in the affine transform's matrix. */ this.transform = function(a, b, c, d, e, f) { context.transform( @@ -842,8 +975,8 @@ Guacamole.Layer = function(width, height) { * destination where source transparent, and destination where source * opaque. * - * @param {Number} mask The channel mask for future operations on this - * Layer. + * @param {!number} mask + * The channel mask for future operations on this Layer. */ this.setChannelMask = function(mask) { context.globalCompositeOperation = compositeOperation[mask]; @@ -855,8 +988,8 @@ Guacamole.Layer = function(width, height) { * width. If this ratio is exceeded, the miter will not be drawn for that * joint of the path. * - * @param {Number} limit The miter limit for stroke operations using the - * miter join. + * @param {!number} limit + * The miter limit for stroke operations using the miter join. */ this.setMiterLimit = function(limit) { context.miterLimit = limit; @@ -874,31 +1007,43 @@ Guacamole.Layer = function(width, height) { /** * Channel mask for the composite operation "rout". + * + * @type {!number} */ Guacamole.Layer.ROUT = 0x2; /** * Channel mask for the composite operation "atop". + * + * @type {!number} */ Guacamole.Layer.ATOP = 0x6; /** * Channel mask for the composite operation "xor". + * + * @type {!number} */ Guacamole.Layer.XOR = 0xA; /** * Channel mask for the composite operation "rover". + * + * @type {!number} */ Guacamole.Layer.ROVER = 0xB; /** * Channel mask for the composite operation "over". + * + * @type {!number} */ Guacamole.Layer.OVER = 0xE; /** * Channel mask for the composite operation "plus". + * + * @type {!number} */ Guacamole.Layer.PLUS = 0xF; @@ -907,6 +1052,8 @@ Guacamole.Layer.PLUS = 0xF; * Beware that WebKit-based browsers may leave the contents of the destionation * layer where the source layer is transparent, despite the definition of this * operation. + * + * @type {!number} */ Guacamole.Layer.RIN = 0x1; @@ -915,6 +1062,8 @@ Guacamole.Layer.RIN = 0x1; * Beware that WebKit-based browsers may leave the contents of the destionation * layer where the source layer is transparent, despite the definition of this * operation. + * + * @type {!number} */ Guacamole.Layer.IN = 0x4; @@ -923,6 +1072,8 @@ Guacamole.Layer.IN = 0x4; * Beware that WebKit-based browsers may leave the contents of the destionation * layer where the source layer is transparent, despite the definition of this * operation. + * + * @type {!number} */ Guacamole.Layer.OUT = 0x8; @@ -931,6 +1082,8 @@ Guacamole.Layer.OUT = 0x8; * Beware that WebKit-based browsers may leave the contents of the destionation * layer where the source layer is transparent, despite the definition of this * operation. + * + * @type {!number} */ Guacamole.Layer.RATOP = 0x9; @@ -939,6 +1092,8 @@ Guacamole.Layer.RATOP = 0x9; * Beware that WebKit-based browsers may leave the contents of the destionation * layer where the source layer is transparent, despite the definition of this * operation. + * + * @type {!number} */ Guacamole.Layer.SRC = 0xC; @@ -948,34 +1103,49 @@ Guacamole.Layer.SRC = 0xC; * * @constructor * - * @param {Number} r The red component of this pixel. - * @param {Number} g The green component of this pixel. - * @param {Number} b The blue component of this pixel. - * @param {Number} a The alpha component of this pixel. + * @param {!number} r + * The red component of this pixel. + * + * @param {!number} g + * The green component of this pixel. + * + * @param {!number} b + * The blue component of this pixel. + * + * @param {!number} a + * The alpha component of this pixel. */ Guacamole.Layer.Pixel = function(r, g, b, a) { /** * The red component of this pixel, where 0 is the minimum value, * and 255 is the maximum. + * + * @type {!number} */ this.red = r; /** * The green component of this pixel, where 0 is the minimum value, * and 255 is the maximum. + * + * @type {!number} */ this.green = g; /** * The blue component of this pixel, where 0 is the minimum value, * and 255 is the maximum. + * + * @type {!number} */ this.blue = b; /** * The alpha component of this pixel, where 0 is the minimum value, * and 255 is the maximum. + * + * @type {!number} */ this.alpha = a; diff --git a/guacamole-common-js/src/main/webapp/modules/Mouse.js b/guacamole-common-js/src/main/webapp/modules/Mouse.js index a86fae3af..2f8bc28b5 100644 --- a/guacamole-common-js/src/main/webapp/modules/Mouse.js +++ b/guacamole-common-js/src/main/webapp/modules/Mouse.js @@ -41,7 +41,7 @@ var Guacamole = Guacamole || {}; * * @constructor * @augments Guacamole.Mouse.Event.Target - * @param {Element} element + * @param {!Element} element * The Element to use to provide mouse events. */ Guacamole.Mouse = function Mouse(element) { @@ -50,29 +50,39 @@ Guacamole.Mouse = function Mouse(element) { /** * Reference to this Guacamole.Mouse. + * * @private + * @type {!Guacamole.Mouse} */ var guac_mouse = this; /** * The number of mousemove events to require before re-enabling mouse * event handling after receiving a touch event. + * + * @type {!number} */ this.touchMouseThreshold = 3; /** * The minimum amount of pixels scrolled required for a single scroll button * click. + * + * @type {!number} */ this.scrollThreshold = 53; /** * The number of pixels to scroll per line. + * + * @type {!number} */ this.PIXELS_PER_LINE = 18; /** * The number of pixels to scroll per page. + * + * @type {!number} */ this.PIXELS_PER_PAGE = this.PIXELS_PER_LINE * 16; @@ -81,7 +91,7 @@ Guacamole.Mouse = function Mouse(element) { * mouse button indices used by DOM mouse events. * * @private - * @type {String[]} + * @type {!string[]} */ var MOUSE_BUTTONS = [ Guacamole.Mouse.State.Buttons.LEFT, @@ -92,7 +102,9 @@ Guacamole.Mouse = function Mouse(element) { /** * Counter of mouse events to ignore. This decremented by mousemove, and * while non-zero, mouse events will have no effect. + * * @private + * @type {!number} */ var ignore_mouse = 0; @@ -102,6 +114,7 @@ Guacamole.Mouse = function Mouse(element) { * threshold. * * @private + * @type {!number} */ var scroll_delta = 0; @@ -254,7 +267,7 @@ Guacamole.Mouse = function Mouse(element) { * coordinates. * * @private - * @type {Boolean} + * @type {!boolean} */ var CSS3_CURSOR_SUPPORTED = (function() { @@ -291,11 +304,18 @@ Guacamole.Mouse = function Mouse(element) { * to do something else, such as use the software cursor built into * Guacamole.Display, if the local cursor cannot be set. * - * @param {HTMLCanvasElement} canvas The cursor image. - * @param {Number} x The X-coordinate of the cursor hotspot. - * @param {Number} y The Y-coordinate of the cursor hotspot. - * @return {!Boolean} true if the cursor was successfully set, false if the - * cursor could not be set for any reason. + * @param {!HTMLCanvasElement} canvas + * The cursor image. + * + * @param {!number} x + * The X-coordinate of the cursor hotspot. + * + * @param {!number} y + * The Y-coordinate of the cursor hotspot. + * + * @return {!boolean} + * true if the cursor was successfully set, false if the cursor could + * not be set for any reason. */ this.setCursor = function(canvas, x, y) { @@ -318,7 +338,7 @@ Guacamole.Mouse = function Mouse(element) { * * @constructor * @augments Guacamole.Position - * @param {Guacamole.Mouse.State|Object} [template={}] + * @param {Guacamole.Mouse.State|object} [template={}] * The object whose properties should be copied within the new * Guacamole.Mouse.State. */ @@ -332,30 +352,30 @@ Guacamole.Mouse.State = function State(template) { * Guacamole.Mouse.State constructor of Apache Guacamole 1.3.0 and older. * * @private - * @param {Number} x + * @param {!number} x * The X position of the mouse pointer in pixels. * - * @param {Number} y + * @param {!number} y * The Y position of the mouse pointer in pixels. * - * @param {Boolean} left + * @param {!boolean} left * Whether the left mouse button is pressed. * - * @param {Boolean} middle + * @param {!boolean} middle * Whether the middle mouse button is pressed. * - * @param {Boolean} right + * @param {!boolean} right * Whether the right mouse button is pressed. * - * @param {Boolean} up + * @param {!boolean} up * Whether the up mouse button is pressed (the fourth button, usually * part of a scroll wheel). * - * @param {Boolean} down + * @param {!boolean} down * Whether the down mouse button is pressed (the fifth button, usually * part of a scroll wheel). * - * @return {Object} + * @return {!object} * The equivalent template object that would be passed to the new * Guacamole.Mouse.State constructor. */ @@ -382,7 +402,7 @@ Guacamole.Mouse.State = function State(template) { /** * Whether the left mouse button is currently pressed. * - * @type {Boolean} + * @type {!boolean} * @default false */ this.left = template.left || false; @@ -390,7 +410,7 @@ Guacamole.Mouse.State = function State(template) { /** * Whether the middle mouse button is currently pressed. * - * @type {Boolean} + * @type {!boolean} * @default false */ this.middle = template.middle || false; @@ -398,7 +418,7 @@ Guacamole.Mouse.State = function State(template) { /** * Whether the right mouse button is currently pressed. * - * @type {Boolean} + * @type {!boolean} * @default false */ this.right = template.right || false; @@ -408,7 +428,7 @@ Guacamole.Mouse.State = function State(template) { * mouse button, associated with upward scrolling of the mouse scroll * wheel. * - * @type {Boolean} + * @type {!boolean} * @default false */ this.up = template.up || false; @@ -418,7 +438,7 @@ Guacamole.Mouse.State = function State(template) { * mouse button, associated with downward scrolling of the mouse scroll * wheel. * - * @type {Boolean} + * @type {!boolean} * @default false */ this.down = template.down || false; @@ -439,7 +459,7 @@ Guacamole.Mouse.State.Buttons = { * left mouse button. * * @constant - * @type {String} + * @type {!string} */ LEFT : 'left', @@ -448,7 +468,7 @@ Guacamole.Mouse.State.Buttons = { * middle mouse button. * * @constant - * @type {String} + * @type {!string} */ MIDDLE : 'middle', @@ -457,7 +477,7 @@ Guacamole.Mouse.State.Buttons = { * right mouse button. * * @constant - * @type {String} + * @type {!string} */ RIGHT : 'right', @@ -467,7 +487,7 @@ Guacamole.Mouse.State.Buttons = { * wheel is scrolled up). * * @constant - * @type {String} + * @type {!string} */ UP : 'up', @@ -477,7 +497,7 @@ Guacamole.Mouse.State.Buttons = { * wheel is scrolled up). * * @constant - * @type {String} + * @type {!string} */ DOWN : 'down' @@ -490,10 +510,10 @@ Guacamole.Mouse.State.Buttons = { * * @constructor * @augments Guacamole.Event.DOMEvent - * @param {String} type + * @param {!string} type * The type name of the event ("mousedown", "mouseup", etc.) * - * @param {Guacamole.Mouse.State} state + * @param {!Guacamole.Mouse.State} state * The current mouse state. * * @param {Event|Event[]} [events=[]] @@ -509,14 +529,14 @@ Guacamole.Mouse.Event = function MouseEvent(type, state, events) { * * @private * @constant - * @type {String} + * @type {!string} */ var legacyHandlerName = 'on' + this.type; /** * The current mouse state at the time this event was fired. * - * @type {Guacamole.Mouse.State} + * @type {!Guacamole.Mouse.State} */ this.state = state; @@ -557,7 +577,7 @@ Guacamole.Mouse.Event.Target = function MouseEventTarget() { * mouse events fire. This state object is also passed in as a parameter to * the handler of any mouse events. * - * @type {Guacamole.Mouse.State} + * @type {!Guacamole.Mouse.State} */ this.currentState = new Guacamole.Mouse.State(); @@ -572,7 +592,7 @@ Guacamole.Mouse.Event.Target = function MouseEventTarget() { * [click()]{@link Guacamole.Mouse.Event.Target#click}. * * @event Guacamole.Mouse.Event.Target#mousedown - * @param {Guacamole.Mouse.Event} event + * @param {!Guacamole.Mouse.Event} event * The mousedown event that was fired. */ @@ -587,7 +607,7 @@ Guacamole.Mouse.Event.Target = function MouseEventTarget() { * [click()]{@link Guacamole.Mouse.Event.Target#click}. * * @event Guacamole.Mouse.Event.Target#mouseup - * @param {Guacamole.Mouse.Event} event + * @param {!Guacamole.Mouse.Event} event * The mouseup event that was fired. */ @@ -601,7 +621,7 @@ Guacamole.Mouse.Event.Target = function MouseEventTarget() { * or [move()]{@link Guacamole.Mouse.Event.Target#move}. * * @event Guacamole.Mouse.Event.Target#mousemove - * @param {Guacamole.Mouse.Event} event + * @param {!Guacamole.Mouse.Event} event * The mousemove event that was fired. */ @@ -614,7 +634,7 @@ Guacamole.Mouse.Event.Target = function MouseEventTarget() { * or [out()]{@link Guacamole.Mouse.Event.Target#out}. * * @event Guacamole.Mouse.Event.Target#mouseout - * @param {Guacamole.Mouse.Event} event + * @param {!Guacamole.Mouse.Event} event * The mouseout event that was fired. */ @@ -626,7 +646,7 @@ Guacamole.Mouse.Event.Target = function MouseEventTarget() { * * @fires Guacamole.Mouse.Event.Target#mousedown * - * @param {String} button + * @param {!string} button * The name of the mouse button to press, as defined by * {@link Guacamole.Mouse.State.Buttons}. * @@ -648,7 +668,7 @@ Guacamole.Mouse.Event.Target = function MouseEventTarget() { * * @fires Guacamole.Mouse.Event.Target#mouseup * - * @param {String} button + * @param {!string} button * The name of the mouse button to release, as defined by * {@link Guacamole.Mouse.State.Buttons}. * @@ -671,7 +691,7 @@ Guacamole.Mouse.Event.Target = function MouseEventTarget() { * @fires Guacamole.Mouse.Event.Target#mousedown * @fires Guacamole.Mouse.Event.Target#mouseup * - * @param {String} button + * @param {!string} button * The name of the mouse button to click, as defined by * {@link Guacamole.Mouse.State.Buttons}. * @@ -688,7 +708,7 @@ Guacamole.Mouse.Event.Target = function MouseEventTarget() { * * @fires Guacamole.Mouse.Event.Target#mousemove * - * @param {Guacamole.Position|Object} position + * @param {!(Guacamole.Position|object)} position * The new coordinates of the mouse pointer. This object may be a * {@link Guacamole.Position} or any object with "x" and "y" * properties. @@ -761,7 +781,7 @@ Guacamole.Mouse.Event.Target = function MouseEventTarget() { * * @constructor * @augments Guacamole.Mouse.Event.Target - * @param {Element} element + * @param {!Element} element * The Element to use to provide touch events. */ Guacamole.Mouse.Touchpad = function Touchpad(element) { @@ -777,25 +797,33 @@ Guacamole.Mouse.Touchpad = function Touchpad(element) { /** * Reference to this Guacamole.Mouse.Touchpad. + * * @private + * @type {!Guacamole.Mouse.Touchpad} */ var guac_touchpad = this; /** * The distance a two-finger touch must move per scrollwheel event, in * pixels. + * + * @type {!number} */ this.scrollThreshold = 20 * (window.devicePixelRatio || 1); /** * The maximum number of milliseconds to wait for a touch to end for the * gesture to be considered a click. + * + * @type {!number} */ this.clickTimingThreshold = 250; /** * The maximum number of pixels to allow a touch to move for the gesture to * be considered a click. + * + * @type {!number} */ this.clickMoveThreshold = 10 * (window.devicePixelRatio || 1); @@ -804,7 +832,7 @@ Guacamole.Mouse.Touchpad = function Touchpad(element) { * mouse events fire. This state object is also passed in as a parameter to * the handler of any mouse events. * - * @type {Guacamole.Mouse.State} + * @type {!Guacamole.Mouse.State} */ this.currentState = new Guacamole.Mouse.State(); @@ -999,7 +1027,7 @@ Guacamole.Mouse.Touchpad = function Touchpad(element) { * * @constructor * @augments Guacamole.Mouse.Event.Target - * @param {Element} element + * @param {!Element} element * The Element to use to provide touch events. */ Guacamole.Mouse.Touchscreen = function Touchscreen(element) { @@ -1015,7 +1043,9 @@ Guacamole.Mouse.Touchscreen = function Touchscreen(element) { /** * Reference to this Guacamole.Mouse.Touchscreen. + * * @private + * @type {!Guacamole.Mouse.Touchscreen} */ var guac_touchscreen = this; @@ -1024,18 +1054,23 @@ Guacamole.Mouse.Touchscreen = function Touchscreen(element) { * will be ignored. * * @private + * @type {!boolean} */ var gesture_in_progress = false; /** * The start X location of a gesture. + * * @private + * @type {number} */ var gesture_start_x = null; /** * The start Y location of a gesture. + * * @private + * @type {number} */ var gesture_start_y = null; @@ -1043,6 +1078,7 @@ Guacamole.Mouse.Touchscreen = function Touchscreen(element) { * The timeout associated with the delayed, cancellable click release. * * @private + * @type {number} */ var click_release_timeout = null; @@ -1050,24 +1086,31 @@ Guacamole.Mouse.Touchscreen = function Touchscreen(element) { * The timeout associated with long-press for right click. * * @private + * @type {number} */ var long_press_timeout = null; /** * The distance a two-finger touch must move per scrollwheel event, in * pixels. + * + * @type {!number} */ this.scrollThreshold = 20 * (window.devicePixelRatio || 1); /** * The maximum number of milliseconds to wait for a touch to end for the * gesture to be considered a click. + * + * @type {!number} */ this.clickTimingThreshold = 250; /** * The maximum number of pixels to allow a touch to move for the gesture to * be considered a click. + * + * @type {!number} */ this.clickMoveThreshold = 16 * (window.devicePixelRatio || 1); @@ -1082,9 +1125,11 @@ Guacamole.Mouse.Touchscreen = function Touchscreen(element) { * clicking, based on where the touch gesture began. * * @private - * @param {TouchEvent} e The touch event to check. - * @return {!Boolean} true if the movement threshold is exceeded, false - * otherwise. + * @param {!TouchEvent} e + * The touch event to check. + * + * @return {!boolean} + * true if the movement threshold is exceeded, false otherwise. */ function finger_moved(e) { var touch = e.touches[0] || e.changedTouches[0]; @@ -1098,7 +1143,8 @@ Guacamole.Mouse.Touchscreen = function Touchscreen(element) { * touch event. * * @private - * @param {TouchEvent} e The touch event beginning this new gesture. + * @param {!TouchEvent} e + * The touch event beginning this new gesture. */ function begin_gesture(e) { var touch = e.touches[0]; diff --git a/guacamole-common-js/src/main/webapp/modules/Object.js b/guacamole-common-js/src/main/webapp/modules/Object.js index 87446bcb7..5d65f5753 100644 --- a/guacamole-common-js/src/main/webapp/modules/Object.js +++ b/guacamole-common-js/src/main/webapp/modules/Object.js @@ -24,10 +24,10 @@ var Guacamole = Guacamole || {}; * input and output streams. * * @constructor - * @param {Guacamole.Client} client + * @param {!Guacamole.Client} client * The client owning this object. * - * @param {Number} index + * @param {!number} index * The index of this object. */ Guacamole.Object = function guacamoleObject(client, index) { @@ -36,7 +36,7 @@ Guacamole.Object = function guacamoleObject(client, index) { * Reference to this Guacamole.Object. * * @private - * @type {Guacamole.Object} + * @type {!Guacamole.Object} */ var guacObject = this; @@ -45,7 +45,7 @@ Guacamole.Object = function guacamoleObject(client, index) { * callbacks is guaranteed to be in order of request. * * @private - * @type {Object.} + * @type {!Object.} */ var bodyCallbacks = {}; @@ -55,10 +55,10 @@ Guacamole.Object = function guacamoleObject(client, index) { * returned. * * @private - * @param {String} name + * @param {!string} name * The name of the stream to retrieve a callback for. * - * @returns {Function} + * @returns {function} * The next callback associated with the stream having the given name, * or null if no such callback exists. */ @@ -84,10 +84,10 @@ Guacamole.Object = function guacamoleObject(client, index) { * having the given name. * * @private - * @param {String} name + * @param {!string} name * The name of the stream to associate with the given callback. * - * @param {Function} callback + * @param {!function} callback * The callback to add to the queue of the stream with the given name. */ var enqueueBodyCallback = function enqueueBodyCallback(name, callback) { @@ -107,7 +107,7 @@ Guacamole.Object = function guacamoleObject(client, index) { /** * The index of this object. * - * @type {Number} + * @type {!number} */ this.index = index; @@ -119,13 +119,13 @@ Guacamole.Object = function guacamoleObject(client, index) { * handler here. * * @event - * @param {Guacamole.InputStream} inputStream + * @param {!Guacamole.InputStream} inputStream * The input stream of the received body. * - * @param {String} mimetype + * @param {!string} mimetype * The mimetype of the data being received. * - * @param {String} name + * @param {!string} name * The name of the stream whose body has been received. */ this.onbody = function defaultBodyHandler(inputStream, mimetype, name) { @@ -149,10 +149,10 @@ Guacamole.Object = function guacamoleObject(client, index) { * Requests read access to the input stream having the given name. If * successful, a new input stream will be created. * - * @param {String} name + * @param {!string} name * The name of the input stream to request. * - * @param {Function} [bodyCallback] + * @param {function} [bodyCallback] * The callback to invoke when the body of the requested input stream * is received. This callback will be provided a Guacamole.InputStream * and its mimetype as its two only arguments. If the onbody handler of @@ -174,13 +174,13 @@ Guacamole.Object = function guacamoleObject(client, index) { * given mimetype and name. The legality of a mimetype and name is dictated * by the object itself. * - * @param {String} mimetype + * @param {!string} mimetype * The mimetype of the data which will be sent to the output stream. * - * @param {String} name + * @param {!string} name * The defined name of an output stream within this object. * - * @returns {Guacamole.OutputStream} + * @returns {!Guacamole.OutputStream} * An output stream which will write blobs to the named output stream * of this object. */ @@ -195,7 +195,7 @@ Guacamole.Object = function guacamoleObject(client, index) { * the root stream MUST be a JSON map of stream name to mimetype. * * @constant - * @type {String} + * @type {!string} */ Guacamole.Object.ROOT_STREAM = '/'; @@ -205,6 +205,6 @@ Guacamole.Object.ROOT_STREAM = '/'; * have this mimetype. * * @constant - * @type {String} + * @type {!string} */ Guacamole.Object.STREAM_INDEX_MIMETYPE = 'application/vnd.glyptodon.guacamole.stream-index+json'; diff --git a/guacamole-common-js/src/main/webapp/modules/OnScreenKeyboard.js b/guacamole-common-js/src/main/webapp/modules/OnScreenKeyboard.js index d76e75933..221f3b2b3 100644 --- a/guacamole-common-js/src/main/webapp/modules/OnScreenKeyboard.js +++ b/guacamole-common-js/src/main/webapp/modules/OnScreenKeyboard.js @@ -25,7 +25,7 @@ var Guacamole = Guacamole || {}; * own key events. * * @constructor - * @param {Guacamole.OnScreenKeyboard.Layout} layout + * @param {!Guacamole.OnScreenKeyboard.Layout} layout * The layout of the on-screen keyboard to display. */ Guacamole.OnScreenKeyboard = function(layout) { @@ -34,7 +34,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * Reference to this Guacamole.OnScreenKeyboard. * * @private - * @type {Guacamole.OnScreenKeyboard} + * @type {!Guacamole.OnScreenKeyboard} */ var osk = this; @@ -44,7 +44,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * released. * * @private - * @type {Object.} + * @type {!Object.} */ var modifierKeysyms = {}; @@ -54,7 +54,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * have a corresponding mapping to true. * * @private - * @type {Object.} + * @type {!Object.} */ var pressed = {}; @@ -65,7 +65,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * experience rounding error due to unit conversions. * * @private - * @type {ScaledElement[]} + * @type {!ScaledElement[]} */ var scaledElements = []; @@ -74,10 +74,10 @@ Guacamole.OnScreenKeyboard = function(layout) { * * @private * @function - * @param {Element} element + * @param {!Element} element * The element to add a class to. * - * @param {String} classname + * @param {!string} classname * The name of the class to add. */ var addClass = function addClass(element, classname) { @@ -97,10 +97,10 @@ Guacamole.OnScreenKeyboard = function(layout) { * * @private * @function - * @param {Element} element + * @param {!Element} element * The element to remove a class from. * - * @param {String} classname + * @param {!string} classname * The name of the class to remove. */ var removeClass = function removeClass(element, classname) { @@ -132,7 +132,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * while non-zero, mouse events will have no effect. * * @private - * @type {Number} + * @type {!number} */ var ignoreMouse = 0; @@ -154,18 +154,18 @@ Guacamole.OnScreenKeyboard = function(layout) { * * @private * @constructor - * @param {Element} element + * @param {!Element} element * The element whose scale should be maintained. * - * @param {Number} width + * @param {!number} width * The width of the element, in arbitrary units, relative to other * ScaledElements. * - * @param {Number} height + * @param {!number} height * The height of the element, in arbitrary units, relative to other * ScaledElements. * - * @param {Boolean} [scaleFont=false] + * @param {boolean} [scaleFont=false] * Whether the line height and font size should be scaled as well. */ var ScaledElement = function ScaledElement(element, width, height, scaleFont) { @@ -174,7 +174,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * The width of this ScaledElement, in arbitrary units, relative to * other ScaledElements. * - * @type {Number} + * @type {!number} */ this.width = width; @@ -182,7 +182,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * The height of this ScaledElement, in arbitrary units, relative to * other ScaledElements. * - * @type {Number} + * @type {!number} */ this.height = height; @@ -190,7 +190,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * Resizes the associated element, updating its dimensions according to * the given pixels per unit. * - * @param {Number} pixels + * @param {!number} pixels * The number of pixels to assign per arbitrary unit. */ this.scale = function(pixels) { @@ -214,10 +214,10 @@ Guacamole.OnScreenKeyboard = function(layout) { * active. * * @private - * @param {String[]} names + * @param {!string[]} names * The names of all modifiers to test. * - * @returns {boolean} + * @returns {!boolean} * true if all specified modifiers are pressed, false otherwise. */ var modifiersPressed = function modifiersPressed(names) { @@ -243,7 +243,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * modifiers) are all currently satisfied. * * @private - * @param {String} keyName + * @param {!string} keyName * The name of the key to retrieve. * * @returns {Guacamole.OnScreenKeyboard.Key} @@ -281,10 +281,10 @@ Guacamole.OnScreenKeyboard = function(layout) { * already pressed, this function has no effect. * * @private - * @param {String} keyName + * @param {!string} keyName * The name of the key to press. * - * @param {String} keyElement + * @param {!string} keyElement * The element associated with the given key. */ var press = function press(keyName, keyElement) { @@ -349,10 +349,10 @@ Guacamole.OnScreenKeyboard = function(layout) { * key is already released, this function has no effect. * * @private - * @param {String} keyName + * @param {!string} keyName * The name of the key to release. * - * @param {String} keyElement + * @param {!string} keyElement * The element associated with the given key. */ var release = function release(keyName, keyElement) { @@ -399,7 +399,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * The number of mousemove events to require before re-enabling mouse * event handling after receiving a touch event. * - * @type {Number} + * @type {!number} */ this.touchMouseThreshold = 3; @@ -407,7 +407,8 @@ Guacamole.OnScreenKeyboard = function(layout) { * Fired whenever the user presses a key on this Guacamole.OnScreenKeyboard. * * @event - * @param {Number} keysym The keysym of the key being pressed. + * @param {!number} keysym + * The keysym of the key being pressed. */ this.onkeydown = null; @@ -415,20 +416,23 @@ Guacamole.OnScreenKeyboard = function(layout) { * Fired whenever the user releases a key on this Guacamole.OnScreenKeyboard. * * @event - * @param {Number} keysym The keysym of the key being released. + * @param {!number} keysym + * The keysym of the key being released. */ this.onkeyup = null; /** * The keyboard layout provided at time of construction. * - * @type {Guacamole.OnScreenKeyboard.Layout} + * @type {!Guacamole.OnScreenKeyboard.Layout} */ this.layout = new Guacamole.OnScreenKeyboard.Layout(layout); /** * Returns the element containing the entire on-screen keyboard. - * @returns {!Element} The element containing the entire on-screen keyboard. + * + * @returns {!Element} + * The element containing the entire on-screen keyboard. */ this.getElement = function() { return keyboard; @@ -439,8 +443,8 @@ Guacamole.OnScreenKeyboard = function(layout) { * the width is close to but does not exceed the specified width. The * height of the keyboard is determined based on the width. * - * @param {Number} width The width to resize this Guacamole.OnScreenKeyboard - * to, in pixels. + * @param {!number} width + * The width to resize this Guacamole.OnScreenKeyboard to, in pixels. */ this.resize = function(width) { @@ -462,10 +466,10 @@ Guacamole.OnScreenKeyboard = function(layout) { * properties as needed, and ensuring the key name is defined. * * @private - * @param {String} name + * @param {!string} name * The name of the key being coerced into an array of Key objects. * - * @param {Number|String|Guacamole.OnScreenKeyboard.Key|Guacamole.OnScreenKeyboard.Key[]} object + * @param {!(number|string|Guacamole.OnScreenKeyboard.Key|Guacamole.OnScreenKeyboard.Key[])} object * The object defining the behavior of the key having the given name, * which may be the title of the key (a string), the keysym (a number), * a single Key object, or an array of Key objects. @@ -512,12 +516,12 @@ Guacamole.OnScreenKeyboard = function(layout) { * objects. * * @private - * @param {Object.} keys + * @param {!Object.} keys * A mapping of key name to key definition, where the key definition is * the title of the key (a string), the keysym (a number), a single * Key object, or an array of Key objects. * - * @returns {Object.} + * @returns {!Object.} * A more-predictable mapping of key name to key definition, where the * key definition is always simply an array of Key objects. */ @@ -538,7 +542,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * Map of all key names to their corresponding set of keys. Each key name * may correspond to multiple keys due to the effect of modifiers. * - * @type {Object.} + * @type {!Object.} */ this.keys = getKeys(layout.keys); @@ -550,11 +554,11 @@ Guacamole.OnScreenKeyboard = function(layout) { * contiguous non-alphanumeric characters. * * @private - * @param {String} name + * @param {!string} name * An arbitrary string representing the name of some component of the * on-screen keyboard. * - * @returns {string} + * @returns {!string} * A string formatted for use as a CSS class name. */ var getCSSName = function getCSSName(name) { @@ -598,14 +602,14 @@ Guacamole.OnScreenKeyboard = function(layout) { * will be scaled according to the same size units as each key. * * @private - * @param {Element} element + * @param {!Element} element * The element to append elements to. * - * @param {Array|Object|String|Number} object + * @param {!(Array|object|string|number)} object * The layout structure object to use when constructing the elements to * append. * - * @param {String} [name] + * @param {string} [name] * The name of the top-level element being appended, if any. */ var appendElements = function appendElements(element, object, name) { @@ -709,7 +713,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * touchMouseThreshold events. * * @private - * @param {TouchEvent} e + * @param {!TouchEvent} e * The touch event being handled. */ var touchPress = function touchPress(e) { @@ -724,7 +728,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * touchMouseThreshold events. * * @private - * @param {TouchEvent} e + * @param {!TouchEvent} e * The touch event being handled. */ var touchRelease = function touchRelease(e) { @@ -739,7 +743,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * does nothing. * * @private - * @param {MouseEvent} e + * @param {!MouseEvent} e * The touch event being handled. */ var mousePress = function mousePress(e) { @@ -754,7 +758,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * does nothing. * * @private - * @param {MouseEvent} e + * @param {!MouseEvent} e * The touch event being handled. */ var mouseRelease = function mouseRelease(e) { @@ -789,7 +793,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * keys, their behaviors, and their relative position and sizing. * * @constructor - * @param {Guacamole.OnScreenKeyboard.Layout|Object} template + * @param {!(Guacamole.OnScreenKeyboard.Layout|object)} template * The object whose identically-named properties will be used to initialize * the properties of this layout. */ @@ -800,7 +804,7 @@ Guacamole.OnScreenKeyboard.Layout = function(template) { * informational purposes only, but it is recommend to conform to the * [language code]_[country code] format. * - * @type {String} + * @type {!string} */ this.language = template.language; @@ -808,7 +812,7 @@ Guacamole.OnScreenKeyboard.Layout = function(template) { * The type of keyboard layout, such as "qwerty". This property is for * informational purposes only, and does not conform to any standard. * - * @type {String} + * @type {!string} */ this.type = template.type; @@ -818,7 +822,7 @@ Guacamole.OnScreenKeyboard.Layout = function(template) { * implicitly. In all cases, the name property of the key object will be * taken from the name given in the mapping. * - * @type {Object.} + * @type {!Object.} */ this.keys = template.keys; @@ -831,7 +835,7 @@ Guacamole.OnScreenKeyboard.Layout = function(template) { * numbers present will be transformed into gaps of that size, scaled * according to the same units as each key. * - * @type {Object} + * @type {!object} */ this.layout = template.layout; @@ -841,7 +845,7 @@ Guacamole.OnScreenKeyboard.Layout = function(template) { * the same units. The conversion factor between these units and pixels is * derived later via a call to resize() on the Guacamole.OnScreenKeyboard. * - * @type {Number} + * @type {!number} */ this.width = template.width; @@ -851,7 +855,7 @@ Guacamole.OnScreenKeyboard.Layout = function(template) { * overall size of the keyboard. If not defined here, the width of each * key will default to 1. * - * @type {Object.} + * @type {!Object.} */ this.keyWidths = template.keyWidths || {}; @@ -865,11 +869,11 @@ Guacamole.OnScreenKeyboard.Layout = function(template) { * depends on modifier states. * * @constructor - * @param {Guacamole.OnScreenKeyboard.Key|Object} template + * @param {!(Guacamole.OnScreenKeyboard.Key|object)} template * The object whose identically-named properties will be used to initialize * the properties of this key. * - * @param {String} [name] + * @param {string} [name] * The name to use instead of any name provided within the template, if * any. If omitted, the name within the template will be used, assuming the * template contains a name. @@ -879,7 +883,7 @@ Guacamole.OnScreenKeyboard.Key = function(template, name) { /** * The unique name identifying this key within the keyboard layout. * - * @type {String} + * @type {!string} */ this.name = name || template.name; @@ -887,7 +891,7 @@ Guacamole.OnScreenKeyboard.Key = function(template, name) { * The human-readable title that will be displayed to the user within the * key. If not provided, this will be derived from the key name. * - * @type {String} + * @type {!string} */ this.title = template.title || this.name; @@ -896,7 +900,7 @@ Guacamole.OnScreenKeyboard.Key = function(template, name) { * not provided, this will be derived from the title if the title is a * single character. * - * @type {Number} + * @type {number} */ this.keysym = template.keysym || (function deriveKeysym(title) { @@ -925,7 +929,7 @@ Guacamole.OnScreenKeyboard.Key = function(template, name) { * the "shift" modifier, for example. By default, the key will affect no * modifiers. * - * @type {String} + * @type {string} */ this.modifier = template.modifier; @@ -936,7 +940,7 @@ Guacamole.OnScreenKeyboard.Key = function(template, name) { * is named "shift" within the layout. By default, the key will require * no modifiers. * - * @type {String[]} + * @type {!string[]} */ this.requires = template.requires || []; diff --git a/guacamole-common-js/src/main/webapp/modules/OutputStream.js b/guacamole-common-js/src/main/webapp/modules/OutputStream.js index af7bf9bd0..bb9bad60b 100644 --- a/guacamole-common-js/src/main/webapp/modules/OutputStream.js +++ b/guacamole-common-js/src/main/webapp/modules/OutputStream.js @@ -23,20 +23,25 @@ var Guacamole = Guacamole || {}; * Abstract stream which can receive data. * * @constructor - * @param {Guacamole.Client} client The client owning this stream. - * @param {Number} index The index of this stream. + * @param {!Guacamole.Client} client + * The client owning this stream. + * + * @param {!number} index + * The index of this stream. */ Guacamole.OutputStream = function(client, index) { /** * Reference to this stream. + * * @private + * @type {!Guacamole.OutputStream} */ var guac_stream = this; /** * The index of this stream. - * @type {Number} + * @type {!number} */ this.index = index; @@ -45,14 +50,16 @@ Guacamole.OutputStream = function(client, index) { * that a stream operation has completed, or an error has occurred. * * @event - * @param {Guacamole.Status} status The status of the operation. + * @param {!Guacamole.Status} status + * The status of the operation. */ this.onack = null; /** * Writes the given base64-encoded data to this stream as a blob. * - * @param {String} data The base64-encoded data to send. + * @param {!string} data + * The base64-encoded data to send. */ this.sendBlob = function(data) { client.sendBlob(guac_stream.index, data); diff --git a/guacamole-common-js/src/main/webapp/modules/Parser.js b/guacamole-common-js/src/main/webapp/modules/Parser.js index 0f6066e24..7a1a6587c 100644 --- a/guacamole-common-js/src/main/webapp/modules/Parser.js +++ b/guacamole-common-js/src/main/webapp/modules/Parser.js @@ -61,7 +61,8 @@ Guacamole.Parser = function() { * this Guacamole.Parser, executing all completed instructions at * the beginning of this buffer, if any. * - * @param {String} packet The instruction data to receive. + * @param {!string} packet + * The instruction data to receive. */ this.receive = function(packet) { @@ -147,9 +148,11 @@ Guacamole.Parser = function() { * Fired once for every complete Guacamole instruction received, in order. * * @event - * @param {String} opcode The Guacamole instruction opcode. - * @param {Array} parameters The parameters provided for the instruction, - * if any. + * @param {!string} opcode + * The Guacamole instruction opcode. + * + * @param {!string[]} parameters + * The parameters provided for the instruction, if any. */ this.oninstruction = null; diff --git a/guacamole-common-js/src/main/webapp/modules/Position.js b/guacamole-common-js/src/main/webapp/modules/Position.js index 18e895a34..8c5c4fc37 100644 --- a/guacamole-common-js/src/main/webapp/modules/Position.js +++ b/guacamole-common-js/src/main/webapp/modules/Position.js @@ -23,7 +23,7 @@ var Guacamole = Guacamole || {}; * A position in 2-D space. * * @constructor - * @param {Guacamole.Position|Object} [template={}] + * @param {Guacamole.Position|object} [template={}] * The object whose properties should be copied within the new * Guacamole.Position. */ @@ -34,7 +34,7 @@ Guacamole.Position = function Position(template) { /** * The current X position, in pixels. * - * @type {Number} + * @type {!number} * @default 0 */ this.x = template.x || 0; @@ -42,7 +42,7 @@ Guacamole.Position = function Position(template) { /** * The current Y position, in pixels. * - * @type {Number} + * @type {!number} * @default 0 */ this.y = template.y || 0; @@ -54,13 +54,13 @@ Guacamole.Position = function Position(template) { * JavaScript event objects. The final position is translated to * coordinates that are relative the given element. * - * @param {Element} element + * @param {!Element} element * The element the coordinates should be relative to. * - * @param {Number} clientX + * @param {!number} clientX * The viewport-relative X coordinate to translate. * - * @param {Number} clientY + * @param {!number} clientY * The viewport-relative Y coordinate to translate. */ this.fromClientPosition = function fromClientPosition(element, clientX, clientY) { @@ -98,16 +98,16 @@ Guacamole.Position = function Position(template) { * commonly available within JavaScript event objects. The final position is * translated to coordinates that are relative the given element. * - * @param {Element} element + * @param {!Element} element * The element the coordinates should be relative to. * - * @param {Number} clientX + * @param {!number} clientX * The viewport-relative X coordinate to translate. * - * @param {Number} clientY + * @param {!number} clientY * The viewport-relative Y coordinate to translate. * - * @returns {Guacamole.Position} + * @returns {!Guacamole.Position} * A new Guacamole.Position representing the relative position of the given * client coordinates. */ diff --git a/guacamole-common-js/src/main/webapp/modules/RawAudioFormat.js b/guacamole-common-js/src/main/webapp/modules/RawAudioFormat.js index 0fe8ac170..b2fd6ce0d 100644 --- a/guacamole-common-js/src/main/webapp/modules/RawAudioFormat.js +++ b/guacamole-common-js/src/main/webapp/modules/RawAudioFormat.js @@ -26,7 +26,7 @@ var Guacamole = Guacamole || {}; * overall sample rate. * * @constructor - * @param {Guacamole.RawAudioFormat|Object} template + * @param {!(Guacamole.RawAudioFormat|object)} template * The object whose properties should be copied into the corresponding * properties of the new Guacamole.RawAudioFormat. */ @@ -36,21 +36,21 @@ Guacamole.RawAudioFormat = function RawAudioFormat(template) { * The number of bytes in each sample of audio data. This value is * independent of the number of channels. * - * @type {Number} + * @type {!number} */ this.bytesPerSample = template.bytesPerSample; /** * The number of audio channels (ie: 1 for mono, 2 for stereo). * - * @type {Number} + * @type {!number} */ this.channels = template.channels; /** * The number of samples per second, per channel. * - * @type {Number} + * @type {!number} */ this.rate = template.rate; @@ -61,7 +61,7 @@ Guacamole.RawAudioFormat = function RawAudioFormat(template) { * which describes the type of raw audio data represented by that mimetype. If * the mimetype is not a supported raw audio data mimetype, null is returned. * - * @param {String} mimetype + * @param {!string} mimetype * The audio mimetype to parse. * * @returns {Guacamole.RawAudioFormat} diff --git a/guacamole-common-js/src/main/webapp/modules/SessionRecording.js b/guacamole-common-js/src/main/webapp/modules/SessionRecording.js index b30fe467b..c62461876 100644 --- a/guacamole-common-js/src/main/webapp/modules/SessionRecording.js +++ b/guacamole-common-js/src/main/webapp/modules/SessionRecording.js @@ -27,7 +27,7 @@ var Guacamole = Guacamole || {}; * while the recording has not yet finished being created or downloaded. * * @constructor - * @param {Guacamole.Tunnel} tunnel + * @param {!Guacamole.Tunnel} tunnel * The Guacamole.Tunnel from which the instructions of the recording should * be read. */ @@ -37,7 +37,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * Reference to this Guacamole.SessionRecording. * * @private - * @type {Guacamole.SessionRecording} + * @type {!Guacamole.SessionRecording} */ var recording = this; @@ -47,7 +47,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * * @private * @constant - * @type {Number} + * @type {!number} */ var KEYFRAME_CHAR_INTERVAL = 16384; @@ -56,7 +56,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * * @private * @constant - * @type {Number} + * @type {!number} */ var KEYFRAME_TIME_INTERVAL = 5000; @@ -67,7 +67,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * * @private * @constant - * @type {Number} + * @type {!number} */ var MAXIMUM_SEEK_TIME = 5; @@ -75,7 +75,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * All frames parsed from the provided tunnel. * * @private - * @type {Guacamole.SessionRecording._Frame[]} + * @type {!Guacamole.SessionRecording._Frame[]} */ var frames = []; @@ -84,7 +84,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * the frames array. * * @private - * @type {Guacamole.SessionRecording._Frame.Instruction[]} + * @type {!Guacamole.SessionRecording._Frame.Instruction[]} */ var instructions = []; @@ -93,7 +93,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * provided tunnel since the last frame was flagged for use as a keyframe. * * @private - * @type {Number} + * @type {!number} */ var charactersSinceLastKeyframe = 0; @@ -102,7 +102,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * If no timestamp has yet been flagged, this will be 0. * * @private - * @type {Number} + * @type {!number} */ var lastKeyframeTimestamp = 0; @@ -111,7 +111,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * Guacamole.SessionRecording for playback of the session recording. * * @private - * @type {Guacamole.SessionRecording._PlaybackTunnel} + * @type {!Guacamole.SessionRecording._PlaybackTunnel} */ var playbackTunnel = new Guacamole.SessionRecording._PlaybackTunnel(); @@ -120,7 +120,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * recording. * * @private - * @type {Guacamole.Client} + * @type {!Guacamole.Client} */ var playbackClient = new Guacamole.Client(playbackTunnel); @@ -129,7 +129,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * yet rendered, this will be -1. * * @private - * @type {Number} + * @type {!number} */ var currentFrame = -1; @@ -138,7 +138,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * playback is not in progress, this will be null. * * @private - * @type {Number} + * @type {number} */ var startVideoTimestamp = null; @@ -147,7 +147,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * playback is not in progress, this will be null. * * @private - * @type {Number} + * @type {number} */ var startRealTimestamp = null; @@ -157,7 +157,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * any) will not be valid. * * @private - * @type {Number} + * @type {number} */ var seekTimeout = null; @@ -212,10 +212,10 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * to the first frame in the recording. * * @private - * @param {Number} timestamp + * @param {!number} timestamp * The timestamp to convert to a relative timestamp. * - * @returns {number} + * @returns {!number} * The difference in milliseconds between the given timestamp and the * first frame of the recording, or zero if no frames yet exist. */ @@ -235,19 +235,19 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * relative timestamp closest to the timestamp given. * * @private - * @param {Number} minIndex + * @param {!number} minIndex * The index of the first frame in the region (the frame having the * smallest timestamp). * - * @param {Number} maxIndex + * @param {!number} maxIndex * The index of the last frame in the region (the frame having the * largest timestamp). * - * @param {Number} timestamp + * @param {!number} timestamp * The relative timestamp to search for, where zero denotes the first * frame in the recording. * - * @returns {Number} + * @returns {!number} * The index of the frame having a relative timestamp closest to the * given value. */ @@ -280,7 +280,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * instructions to the playback client. * * @private - * @param {Number} index + * @param {!number} index * The index of the frame within the frames array which should be * replayed. */ @@ -311,14 +311,14 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * can be observed through the onseek handler and the provided callback. * * @private - * @param {Number} index + * @param {!number} index * The index of the frame which should become the new playback * position. * - * @param {function} callback + * @param {!function} callback * The callback to invoke once the seek operation has completed. * - * @param {Number} [delay=0] + * @param {number} [delay=0] * The number of milliseconds that the seek operation should be * scheduled to take. */ @@ -438,7 +438,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * being downloaded. * * @event - * @param {Number} duration + * @param {!number} duration * The new duration of the recording, in milliseconds. */ this.onprogress = null; @@ -464,7 +464,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * Fired whenever the playback position within the recording changes. * * @event - * @param {Number} position + * @param {!number} position * The new position within the recording, in milliseconds. */ this.onseek = null; @@ -474,7 +474,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * session. Playback of the Guacamole session cannot occur until at least * one frame worth of instructions has been downloaded. * - * @param {String} data + * @param {string} [data] * The data to send to the tunnel when connecting. */ this.connect = function connect(data) { @@ -495,7 +495,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * which can be added to the DOM, causing the display (and thus playback of * the recording) to become visible. * - * @return {Guacamole.Display} + * @return {!Guacamole.Display} * The underlying display of the Guacamole.Client used by this * Guacamole.SessionRecording for playback. */ @@ -506,7 +506,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { /** * Returns whether playback is currently in progress. * - * @returns {boolean} + * @returns {!boolean} * true if playback is currently in progress, false otherwise. */ this.isPlaying = function isPlaying() { @@ -517,7 +517,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * Returns the current playback position within the recording, in * milliseconds, where zero is the start of the recording. * - * @returns {Number} + * @returns {!number} * The current playback position within the recording, in milliseconds. */ this.getPosition = function getPosition() { @@ -536,7 +536,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * Returns the duration of this recording, in milliseconds. If the * recording is still being downloaded, this value will gradually increase. * - * @returns {Number} + * @returns {!number} * The duration of this recording, in milliseconds. */ this.getDuration = function getDuration() { @@ -591,7 +591,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * progress, that seek is first aborted. The seek operation will proceed * asynchronously. * - * @param {Number} position + * @param {!number} position * The position within the recording to seek to, in milliseconds. * * @param {function} [callback] @@ -660,11 +660,11 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * * @private * @constructor - * @param {Number} timestamp + * @param {!number} timestamp * The timestamp of this frame, as dictated by the "sync" instruction which * terminates the frame. * - * @param {Guacamole.SessionRecording._Frame.Instruction[]} instructions + * @param {!Guacamole.SessionRecording._Frame.Instruction[]} instructions * All instructions which are necessary to generate this frame relative to * the previous frame in the Guacamole session. */ @@ -676,7 +676,7 @@ Guacamole.SessionRecording._Frame = function _Frame(timestamp, instructions) { * set for the frame to be used as a keyframe. By default, frames are not * keyframes. * - * @type {Boolean} + * @type {!boolean} * @default false */ this.keyframe = false; @@ -685,7 +685,7 @@ Guacamole.SessionRecording._Frame = function _Frame(timestamp, instructions) { * The timestamp of this frame, as dictated by the "sync" instruction which * terminates the frame. * - * @type {Number} + * @type {!number} */ this.timestamp = timestamp; @@ -693,7 +693,7 @@ Guacamole.SessionRecording._Frame = function _Frame(timestamp, instructions) { * All instructions which are necessary to generate this frame relative to * the previous frame in the Guacamole session. * - * @type {Guacamole.SessionRecording._Frame.Instruction[]} + * @type {!Guacamole.SessionRecording._Frame.Instruction[]} */ this.instructions = instructions; @@ -702,7 +702,7 @@ Guacamole.SessionRecording._Frame = function _Frame(timestamp, instructions) { * a call to exportState(). If no such snapshot has been taken, this will * be null. * - * @type {Object} + * @type {object} * @default null */ this.clientState = null; @@ -715,10 +715,10 @@ Guacamole.SessionRecording._Frame = function _Frame(timestamp, instructions) { * * @private * @constructor - * @param {String} opcode + * @param {!string} opcode * The opcode of this Guacamole instruction. * - * @param {String[]} args + * @param {!string[]} args * All arguments associated with this Guacamole instruction. */ Guacamole.SessionRecording._Frame.Instruction = function Instruction(opcode, args) { @@ -727,21 +727,21 @@ Guacamole.SessionRecording._Frame.Instruction = function Instruction(opcode, arg * Reference to this Guacamole.SessionRecording._Frame.Instruction. * * @private - * @type {Guacamole.SessionRecording._Frame.Instruction} + * @type {!Guacamole.SessionRecording._Frame.Instruction} */ var instruction = this; /** * The opcode of this Guacamole instruction. * - * @type {String} + * @type {!string} */ this.opcode = opcode; /** * All arguments associated with this Guacamole instruction. * - * @type {String[]} + * @type {!string[]} */ this.args = args; @@ -751,7 +751,7 @@ Guacamole.SessionRecording._Frame.Instruction = function Instruction(opcode, arg * prefixes and various delimiters used by the Guacamole protocol; only * the content of the opcode and each argument is taken into account. * - * @returns {Number} + * @returns {!number} * The approximate size of this instruction, in characters. */ this.getSize = function getSize() { @@ -783,7 +783,7 @@ Guacamole.SessionRecording._PlaybackTunnel = function _PlaybackTunnel() { * Reference to this Guacamole.SessionRecording._PlaybackTunnel. * * @private - * @type {Guacamole.SessionRecording._PlaybackTunnel} + * @type {!Guacamole.SessionRecording._PlaybackTunnel} */ var tunnel = this; @@ -805,10 +805,10 @@ Guacamole.SessionRecording._PlaybackTunnel = function _PlaybackTunnel() { * been received. If the oninstruction handler has not been set, this * function has no effect. * - * @param {String} opcode + * @param {!string} opcode * The opcode of the Guacamole instruction. * - * @param {String[]} args + * @param {!string[]} args * All arguments associated with this Guacamole instruction. */ this.receiveInstruction = function receiveInstruction(opcode, args) { diff --git a/guacamole-common-js/src/main/webapp/modules/Status.js b/guacamole-common-js/src/main/webapp/modules/Status.js index c831246fe..19b872f59 100644 --- a/guacamole-common-js/src/main/webapp/modules/Status.js +++ b/guacamole-common-js/src/main/webapp/modules/Status.js @@ -25,24 +25,27 @@ var Guacamole = Guacamole || {}; * included for debugging convenience. * * @constructor - * @param {Number} code + * @param {!number} code * The Guacamole status code, as defined by Guacamole.Status.Code. * - * @param {String} [message] + * @param {string} [message] * An optional human-readable message. */ Guacamole.Status = function(code, message) { /** * Reference to this Guacamole.Status. + * * @private + * @type {!Guacamole.Status} */ var guac_status = this; /** * The Guacamole status code. + * * @see Guacamole.Status.Code - * @type {Number} + * @type {!number} */ this.code = code; @@ -52,14 +55,15 @@ Guacamole.Status = function(code, message) { * for debugging purposes only. For user feedback, it is better to translate * the Guacamole status code into a message. * - * @type {String} + * @type {string} */ this.message = message; /** * Returns whether this status represents an error. - * @returns {boolean} true if this status represents an error, false - * otherwise. + * + * @returns {!boolean} + * true if this status represents an error, false otherwise. */ this.isError = function() { return guac_status.code < 0 || guac_status.code > 0x00FF; @@ -75,28 +79,28 @@ Guacamole.Status.Code = { /** * The operation succeeded. * - * @type {Number} + * @type {!number} */ "SUCCESS": 0x0000, /** * The requested operation is unsupported. * - * @type {Number} + * @type {!number} */ "UNSUPPORTED": 0x0100, /** * The operation could not be performed due to an internal failure. * - * @type {Number} + * @type {!number} */ "SERVER_ERROR": 0x0200, /** * The operation could not be performed as the server is busy. * - * @type {Number} + * @type {!number} */ "SERVER_BUSY": 0x0201, @@ -104,7 +108,7 @@ Guacamole.Status.Code = { * The operation could not be performed because the upstream server is not * responding. * - * @type {Number} + * @type {!number} */ "UPSTREAM_TIMEOUT": 0x0202, @@ -112,7 +116,7 @@ Guacamole.Status.Code = { * The operation was unsuccessful due to an error or otherwise unexpected * condition of the upstream server. * - * @type {Number} + * @type {!number} */ "UPSTREAM_ERROR": 0x0203, @@ -120,7 +124,7 @@ Guacamole.Status.Code = { * The operation could not be performed as the requested resource does not * exist. * - * @type {Number} + * @type {!number} */ "RESOURCE_NOT_FOUND": 0x0204, @@ -128,7 +132,7 @@ Guacamole.Status.Code = { * The operation could not be performed as the requested resource is * already in use. * - * @type {Number} + * @type {!number} */ "RESOURCE_CONFLICT": 0x0205, @@ -136,7 +140,7 @@ Guacamole.Status.Code = { * The operation could not be performed as the requested resource is now * closed. * - * @type {Number} + * @type {!number} */ "RESOURCE_CLOSED": 0x0206, @@ -144,7 +148,7 @@ Guacamole.Status.Code = { * The operation could not be performed because the upstream server does * not appear to exist. * - * @type {Number} + * @type {!number} */ "UPSTREAM_NOT_FOUND": 0x0207, @@ -152,7 +156,7 @@ Guacamole.Status.Code = { * The operation could not be performed because the upstream server is not * available to service the request. * - * @type {Number} + * @type {!number} */ "UPSTREAM_UNAVAILABLE": 0x0208, @@ -160,7 +164,7 @@ Guacamole.Status.Code = { * The session within the upstream server has ended because it conflicted * with another session. * - * @type {Number} + * @type {!number} */ "SESSION_CONFLICT": 0x0209, @@ -168,21 +172,21 @@ Guacamole.Status.Code = { * The session within the upstream server has ended because it appeared to * be inactive. * - * @type {Number} + * @type {!number} */ "SESSION_TIMEOUT": 0x020A, /** * The session within the upstream server has been forcibly terminated. * - * @type {Number} + * @type {!number} */ "SESSION_CLOSED": 0x020B, /** * The operation could not be performed because bad parameters were given. * - * @type {Number} + * @type {!number} */ "CLIENT_BAD_REQUEST": 0x0300, @@ -190,7 +194,7 @@ Guacamole.Status.Code = { * Permission was denied to perform the operation, as the user is not yet * authorized (not yet logged in, for example). * - * @type {Number} + * @type {!number} */ "CLIENT_UNAUTHORIZED": 0x0301, @@ -198,28 +202,28 @@ Guacamole.Status.Code = { * Permission was denied to perform the operation, and this permission will * not be granted even if the user is authorized. * - * @type {Number} + * @type {!number} */ "CLIENT_FORBIDDEN": 0x0303, /** * The client took too long to respond. * - * @type {Number} + * @type {!number} */ "CLIENT_TIMEOUT": 0x0308, /** * The client sent too much data. * - * @type {Number} + * @type {!number} */ "CLIENT_OVERRUN": 0x030D, /** * The client sent data of an unsupported or unexpected type. * - * @type {Number} + * @type {!number} */ "CLIENT_BAD_TYPE": 0x030F, @@ -227,7 +231,7 @@ Guacamole.Status.Code = { * The operation failed because the current client is already using too * many resources. * - * @type {Number} + * @type {!number} */ "CLIENT_TOO_MANY": 0x031D @@ -237,11 +241,11 @@ Guacamole.Status.Code = { * Returns the Guacamole protocol status code which most closely * represents the given HTTP status code. * - * @param {Number} status + * @param {!number} status * The HTTP status code to translate into a Guacamole protocol status * code. * - * @returns {Number} + * @returns {!number} * The Guacamole protocol status code which most closely represents the * given HTTP status code. */ @@ -281,11 +285,11 @@ Guacamole.Status.Code.fromHTTPCode = function fromHTTPCode(status) { * Returns the Guacamole protocol status code which most closely * represents the given WebSocket status code. * - * @param {Number} code + * @param {!number} code * The WebSocket status code to translate into a Guacamole protocol * status code. * - * @returns {Number} + * @returns {!number} * The Guacamole protocol status code which most closely represents the * given WebSocket status code. */ diff --git a/guacamole-common-js/src/main/webapp/modules/StringReader.js b/guacamole-common-js/src/main/webapp/modules/StringReader.js index fb3125327..247b8b9a2 100644 --- a/guacamole-common-js/src/main/webapp/modules/StringReader.js +++ b/guacamole-common-js/src/main/webapp/modules/StringReader.js @@ -25,21 +25,24 @@ var Guacamole = Guacamole || {}; * handlers on the given Guacamole.InputStream. * * @constructor - * @param {Guacamole.InputStream} stream The stream that data will be read - * from. + * @param {!Guacamole.InputStream} stream + * The stream that data will be read from. */ Guacamole.StringReader = function(stream) { /** * Reference to this Guacamole.InputStream. + * * @private + * @type {!Guacamole.StringReader} */ var guac_reader = this; /** * Wrapped Guacamole.ArrayBufferReader. + * * @private - * @type {Guacamole.ArrayBufferReader} + * @type {!Guacamole.ArrayBufferReader} */ var array_reader = new Guacamole.ArrayBufferReader(stream); @@ -47,7 +50,7 @@ Guacamole.StringReader = function(stream) { * The number of bytes remaining for the current codepoint. * * @private - * @type {Number} + * @type {!number} */ var bytes_remaining = 0; @@ -55,7 +58,7 @@ Guacamole.StringReader = function(stream) { * The current codepoint value, as calculated from bytes read so far. * * @private - * @type {Number} + * @type {!number} */ var codepoint = 0; @@ -64,8 +67,11 @@ Guacamole.StringReader = function(stream) { * the middle of a multibyte character. * * @private - * @param {ArrayBuffer} buffer Arbitrary UTF-8 data. - * @return {string} A decoded Unicode string. + * @param {!ArrayBuffer} buffer + * Arbitrary UTF-8 data. + * + * @return {!string} + * A decoded Unicode string. */ function __decode_utf8(buffer) { @@ -154,7 +160,8 @@ Guacamole.StringReader = function(stream) { * Fired once for every blob of text data received. * * @event - * @param {String} text The data packet received. + * @param {!string} text + * The data packet received. */ this.ontext = null; diff --git a/guacamole-common-js/src/main/webapp/modules/StringWriter.js b/guacamole-common-js/src/main/webapp/modules/StringWriter.js index abf1684ba..6daeed229 100644 --- a/guacamole-common-js/src/main/webapp/modules/StringWriter.js +++ b/guacamole-common-js/src/main/webapp/modules/StringWriter.js @@ -24,33 +24,40 @@ var Guacamole = Guacamole || {}; * data. * * @constructor - * @param {Guacamole.OutputStream} stream The stream that data will be written - * to. + * @param {!Guacamole.OutputStream} stream + * The stream that data will be written to. */ Guacamole.StringWriter = function(stream) { /** * Reference to this Guacamole.StringWriter. + * * @private + * @type {!Guacamole.StringWriter} */ var guac_writer = this; /** * Wrapped Guacamole.ArrayBufferWriter. + * * @private - * @type {Guacamole.ArrayBufferWriter} + * @type {!Guacamole.ArrayBufferWriter} */ var array_writer = new Guacamole.ArrayBufferWriter(stream); /** * Internal buffer for UTF-8 output. + * * @private + * @type {!Uint8Array} */ var buffer = new Uint8Array(8192); /** * The number of bytes currently in the buffer. + * * @private + * @type {!number} */ var length = 0; @@ -65,8 +72,8 @@ Guacamole.StringWriter = function(stream) { * updating the length appropriately. * * @private - * @param {Number} bytes The number of bytes to add to the underlying - * buffer. + * @param {!number} bytes + * The number of bytes to add to the underlying buffer. */ function __expand(bytes) { @@ -86,8 +93,8 @@ Guacamole.StringWriter = function(stream) { * buffer if necessary. The character will be encoded as UTF-8. * * @private - * @param {Number} codepoint The codepoint of the Unicode character to - * append. + * @param {!number} codepoint + * The codepoint of the Unicode character to append. */ function __append_utf8(codepoint) { @@ -144,8 +151,11 @@ Guacamole.StringWriter = function(stream) { * the resulting bytes. * * @private - * @param {String} text The string to encode as UTF-8. - * @return {Uint8Array} The encoded UTF-8 data. + * @param {!string} text + * The string to encode as UTF-8. + * + * @return {!Uint8Array} + * The encoded UTF-8 data. */ function __encode_utf8(text) { @@ -167,7 +177,8 @@ Guacamole.StringWriter = function(stream) { /** * Sends the given text. * - * @param {String} text The text to send. + * @param {!string} text + * The text to send. */ this.sendText = function(text) { if (text.length) @@ -184,8 +195,10 @@ Guacamole.StringWriter = function(stream) { /** * Fired for received data, if acknowledged by the server. + * * @event - * @param {Guacamole.Status} status The status of the operation. + * @param {!Guacamole.Status} status + * The status of the operation. */ this.onack = null; diff --git a/guacamole-common-js/src/main/webapp/modules/Touch.js b/guacamole-common-js/src/main/webapp/modules/Touch.js index dd57789c3..19aa76b88 100644 --- a/guacamole-common-js/src/main/webapp/modules/Touch.js +++ b/guacamole-common-js/src/main/webapp/modules/Touch.js @@ -27,7 +27,7 @@ var Guacamole = Guacamole || {}; * * @constructor * @augments Guacamole.Event.Target - * @param {Element} element + * @param {!Element} element * The Element to use to provide touch events. */ Guacamole.Touch = function Touch(element) { @@ -38,7 +38,7 @@ Guacamole.Touch = function Touch(element) { * Reference to this Guacamole.Touch. * * @private - * @type {Guacamole.Touch} + * @type {!Guacamole.Touch} */ var guacTouch = this; @@ -48,14 +48,14 @@ Guacamole.Touch = function Touch(element) { * * @private * @constant - * @type {Number} + * @type {!number} */ var DEFAULT_CONTACT_RADIUS = Math.floor(16 * window.devicePixelRatio); /** * The set of all active touches, stored by their unique identifiers. * - * @type {Object.} + * @type {!Object.} */ this.touches = {}; @@ -70,7 +70,7 @@ Guacamole.Touch = function Touch(element) { * associated with this Guacamole.Touch. * * @event Guacamole.Touch#touchstart - * @param {Guacamole.Touch.Event} event + * @param {!Guacamole.Touch.Event} event * A {@link Guacamole.Touch.Event} object representing the "touchstart" * event. */ @@ -80,7 +80,7 @@ Guacamole.Touch = function Touch(element) { * associated with this Guacamole.Touch. * * @event Guacamole.Touch#touchmove - * @param {Guacamole.Touch.Event} event + * @param {!Guacamole.Touch.Event} event * A {@link Guacamole.Touch.Event} object representing the "touchmove" * event. */ @@ -90,7 +90,7 @@ Guacamole.Touch = function Touch(element) { * associated with this Guacamole.Touch. * * @event Guacamole.Touch#touchend - * @param {Guacamole.Touch.Event} event + * @param {!Guacamole.Touch.Event} event * A {@link Guacamole.Touch.Event} object representing the "touchend" * event. */ @@ -190,7 +190,7 @@ Guacamole.Touch = function Touch(element) { * * @constructor * @augments Guacamole.Position - * @param {Guacamole.Touch.State|Object} [template={}] + * @param {Guacamole.Touch.State|object} [template={}] * The object whose properties should be copied within the new * Guacamole.Touch.State. */ @@ -204,7 +204,7 @@ Guacamole.Touch.State = function State(template) { * An arbitrary integer ID which uniquely identifies this contact relative * to other active contacts. * - * @type {Number} + * @type {!number} * @default 0 */ this.id = template.id || 0; @@ -213,7 +213,7 @@ Guacamole.Touch.State = function State(template) { * The Y radius of the ellipse covering the general area of the touch * contact, in pixels. * - * @type {Number} + * @type {!number} * @default 0 */ this.radiusX = template.radiusX || 0; @@ -222,7 +222,7 @@ Guacamole.Touch.State = function State(template) { * The X radius of the ellipse covering the general area of the touch * contact, in pixels. * - * @type {Number} + * @type {!number} * @default 0 */ this.radiusY = template.radiusY || 0; @@ -231,7 +231,7 @@ Guacamole.Touch.State = function State(template) { * The rough angle of clockwise rotation of the general area of the touch * contact, in degrees. * - * @type {Number} + * @type {!number} * @default 0.0 */ this.angle = template.angle || 0.0; @@ -241,7 +241,7 @@ Guacamole.Touch.State = function State(template) { * (the touch has been lifted) and 1 is maximum force (the maximum amount * of force representable by the device). * - * @type {Number} + * @type {!number} * @default 1.0 */ this.force = template.force || 1.0; @@ -256,14 +256,14 @@ Guacamole.Touch.State = function State(template) { * * @constructor * @augments Guacamole.Event.DOMEvent - * @param {String} type + * @param {!string} type * The name of the touch event type. Possible values are "touchstart", * "touchmove", and "touchend". * - * @param {TouchEvent} event + * @param {!TouchEvent} event * The DOM touch event that produced this Guacamole.Touch.Event. * - * @param {Guacamole.Touch.State} state + * @param {!Guacamole.Touch.State} state * The state of the touch contact associated with this event. */ Guacamole.Touch.Event = function TouchEvent(type, event, state) { @@ -273,7 +273,7 @@ Guacamole.Touch.Event = function TouchEvent(type, event, state) { /** * The state of the touch contact associated with this event. * - * @type{Guacamole.Touch.State} + * @type {!Guacamole.Touch.State} */ this.state = state; diff --git a/guacamole-common-js/src/main/webapp/modules/Tunnel.js b/guacamole-common-js/src/main/webapp/modules/Tunnel.js index eef12b58c..54538eb5d 100644 --- a/guacamole-common-js/src/main/webapp/modules/Tunnel.js +++ b/guacamole-common-js/src/main/webapp/modules/Tunnel.js @@ -35,7 +35,8 @@ Guacamole.Tunnel = function() { * typically used for authentication. The format of data accepted is * up to the tunnel implementation. * - * @param {String} data The data to send to the tunnel when connecting. + * @param {string} [data] + * The data to send to the tunnel when connecting. */ this.connect = function(data) {}; @@ -59,7 +60,7 @@ Guacamole.Tunnel = function() { * event if the new state is different and a handler has been defined. * * @private - * @param {Number} state + * @param {!number} state * The new state of this tunnel. */ this.setState = function(state) { @@ -78,7 +79,7 @@ Guacamole.Tunnel = function() { * onuuid event if a handler has been defined. * * @private - * @param {String} uuid + * @param {string} uuid * The new state of this tunnel. */ this.setUUID = function setUUID(uuid) { @@ -90,7 +91,7 @@ Guacamole.Tunnel = function() { /** * Returns whether this tunnel is currently connected. * - * @returns {boolean} + * @returns {!boolean} * true if this tunnel is currently connected, false otherwise. */ this.isConnected = function isConnected() { @@ -101,7 +102,7 @@ Guacamole.Tunnel = function() { /** * The current state of this tunnel. * - * @type {Number} + * @type {!number} */ this.state = Guacamole.Tunnel.State.CONNECTING; @@ -110,7 +111,7 @@ Guacamole.Tunnel = function() { * milliseconds. If data is not received within this amount of time, * the tunnel is closed with an error. The default value is 15000. * - * @type {Number} + * @type {!number} */ this.receiveTimeout = 15000; @@ -121,7 +122,7 @@ Guacamole.Tunnel = function() { * the connection appears unresponsive and may close. The default value is * 1500. * - * @type {Number} + * @type {!number} */ this.unstableThreshold = 1500; @@ -129,7 +130,7 @@ Guacamole.Tunnel = function() { * The UUID uniquely identifying this tunnel. If not yet known, this will * be null. * - * @type {String} + * @type {string} */ this.uuid = null; @@ -137,7 +138,7 @@ Guacamole.Tunnel = function() { * Fired when the UUID that uniquely identifies this tunnel is known. * * @event - * @param {String} + * @param {!string} * The UUID uniquely identifying this tunnel. */ this.onuuid = null; @@ -146,8 +147,8 @@ Guacamole.Tunnel = function() { * Fired whenever an error is encountered by the tunnel. * * @event - * @param {Guacamole.Status} status A status object which describes the - * error. + * @param {!Guacamole.Status} status + * A status object which describes the error. */ this.onerror = null; @@ -155,7 +156,8 @@ Guacamole.Tunnel = function() { * Fired whenever the state of the tunnel changes. * * @event - * @param {Number} state The new state of the client. + * @param {!number} state + * The new state of the client. */ this.onstatechange = null; @@ -163,9 +165,11 @@ Guacamole.Tunnel = function() { * Fired once for every complete Guacamole instruction received, in order. * * @event - * @param {String} opcode The Guacamole instruction opcode. - * @param {Array} parameters The parameters provided for the instruction, - * if any. + * @param {!string} opcode + * The Guacamole instruction opcode. + * + * @param {!string[]} parameters + * The parameters provided for the instruction, if any. */ this.oninstruction = null; @@ -180,12 +184,14 @@ Guacamole.Tunnel = function() { * connection stability test pings/responses. * * @constant - * @type {String} + * @type {!string} */ Guacamole.Tunnel.INTERNAL_DATA_OPCODE = ''; /** * All possible tunnel states. + * + * @type {!Object.} */ Guacamole.Tunnel.State = { @@ -193,14 +199,14 @@ Guacamole.Tunnel.State = { * A connection is in pending. It is not yet known whether connection was * successful. * - * @type {Number} + * @type {!number} */ "CONNECTING": 0, /** * Connection was successful, and data is being received. * - * @type {Number} + * @type {!number} */ "OPEN": 1, @@ -209,7 +215,7 @@ Guacamole.Tunnel.State = { * tunnel may have been explicitly closed by either side, or an error may * have occurred. * - * @type {Number} + * @type {!number} */ "CLOSED": 2, @@ -217,7 +223,7 @@ Guacamole.Tunnel.State = { * The connection is open, but communication through the tunnel appears to * be disrupted, and the connection may close as a result. * - * @type {Number} + * @type {!number} */ "UNSTABLE" : 3 @@ -229,15 +235,15 @@ Guacamole.Tunnel.State = { * @constructor * @augments Guacamole.Tunnel * - * @param {String} tunnelURL + * @param {!string} tunnelURL * The URL of the HTTP tunneling service. * - * @param {Boolean} [crossDomain=false] + * @param {boolean} [crossDomain=false] * Whether tunnel requests will be cross-domain, and thus must use CORS * mechanisms and headers. By default, it is assumed that tunnel requests * will be made to the same domain. * - * @param {Object} [extraTunnelHeaders={}] + * @param {object} [extraTunnelHeaders={}] * Key value pairs containing the header names and values of any additional * headers to be sent in tunnel requests. By default, no extra headers will * be added. @@ -246,7 +252,9 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, extraTunnelHeaders) { /** * Reference to this HTTP tunnel. + * * @private + * @type {!Guacamole.HTTPTunnel} */ var tunnel = this; @@ -269,7 +277,9 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, extraTunnelHeaders) { /** * The current receive timeout ID, if any. + * * @private + * @type {number} */ var receive_timeout = null; @@ -277,7 +287,7 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, extraTunnelHeaders) { * The current connection stability timeout ID, if any. * * @private - * @type {Number} + * @type {number} */ var unstableTimeout = null; @@ -286,7 +296,7 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, extraTunnelHeaders) { * will only be set upon successful connection. * * @private - * @type {Number} + * @type {number} */ var pingInterval = null; @@ -296,7 +306,7 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, extraTunnelHeaders) { * * @private * @constant - * @type {Number} + * @type {!number} */ var PING_FREQUENCY = 500; @@ -306,6 +316,7 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, extraTunnelHeaders) { * tokens, etc. * * @private + * @type {!object} */ var extraHeaders = extraTunnelHeaders || {}; @@ -315,7 +326,7 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, extraTunnelHeaders) { * * @private * @constant - * @type {string} + * @type {!string} */ var TUNNEL_TOKEN_HEADER = 'Guacamole-Tunnel-Token'; @@ -331,13 +342,12 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, extraTunnelHeaders) { /** * Adds the configured additional headers to the given request. * - * @param {XMLHttpRequest} request + * @private + * @param {!XMLHttpRequest} request * The request where the configured extra headers will be added. * - * @param {Object} headers + * @param {!object} headers * The headers to be added to the request. - * - * @private */ function addExtraHeaders(request, headers) { for (var name in headers) { @@ -379,8 +389,8 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, extraTunnelHeaders) { * an error status. * * @private - * @param {Guacamole.Status} status The status causing the connection to - * close; + * @param {!Guacamole.Status} status + * The status causing the connection to close; */ function close_tunnel(status) { @@ -430,8 +440,11 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, extraTunnelHeaders) { * element in a Guacamole instruction. * * @private - * @param value The value to convert. - * @return {string} The converted value. + * @param value + * The value to convert. + * + * @return {!string} + * The converted value. */ function getElement(value) { var string = new String(value); @@ -793,25 +806,32 @@ Guacamole.HTTPTunnel.prototype = new Guacamole.Tunnel(); * * @constructor * @augments Guacamole.Tunnel - * @param {String} tunnelURL The URL of the WebSocket tunneling service. + * @param {!string} tunnelURL + * The URL of the WebSocket tunneling service. */ Guacamole.WebSocketTunnel = function(tunnelURL) { /** * Reference to this WebSocket tunnel. + * * @private + * @type {Guacamole.WebSocketTunnel} */ var tunnel = this; /** * The WebSocket used by this tunnel. + * * @private + * @type {WebSocket} */ var socket = null; /** * The current receive timeout ID, if any. + * * @private + * @type {number} */ var receive_timeout = null; @@ -819,7 +839,7 @@ Guacamole.WebSocketTunnel = function(tunnelURL) { * The current connection stability timeout ID, if any. * * @private - * @type {Number} + * @type {number} */ var unstableTimeout = null; @@ -828,14 +848,16 @@ Guacamole.WebSocketTunnel = function(tunnelURL) { * will only be set upon successful connection. * * @private - * @type {Number} + * @type {number} */ var pingInterval = null; /** * The WebSocket protocol corresponding to the protocol used for the current * location. + * * @private + * @type {!Object.} */ var ws_protocol = { "http:": "ws:", @@ -848,7 +870,7 @@ Guacamole.WebSocketTunnel = function(tunnelURL) { * * @private * @constant - * @type {Number} + * @type {!number} */ var PING_FREQUENCY = 500; @@ -919,8 +941,8 @@ Guacamole.WebSocketTunnel = function(tunnelURL) { * an error status. * * @private - * @param {Guacamole.Status} status The status causing the connection to - * close; + * @param {!Guacamole.Status} status + * The status causing the connection to close; */ function close_tunnel(status) { @@ -961,8 +983,11 @@ Guacamole.WebSocketTunnel = function(tunnelURL) { * element in a Guacamole instruction. * * @private - * @param value The value to convert. - * @return {string} The converted value. + * @param {*} value + * The value to convert. + * + * @return {!string} + * The converted value. */ function getElement(value) { var string = new String(value); @@ -1113,7 +1138,7 @@ Guacamole.WebSocketTunnel.prototype = new Guacamole.Tunnel(); * * @constructor * @augments Guacamole.Tunnel - * @param {...*} tunnelChain + * @param {...Guacamole.Tunnel} tunnelChain * The tunnels to use, in order of priority. */ Guacamole.ChainedTunnel = function(tunnelChain) { @@ -1155,7 +1180,8 @@ Guacamole.ChainedTunnel = function(tunnelChain) { * Sets the current tunnel. * * @private - * @param {Guacamole.Tunnel} tunnel The tunnel to set as the current tunnel. + * @param {!Guacamole.Tunnel} tunnel + * The tunnel to set as the current tunnel. */ function attach(tunnel) { @@ -1297,15 +1323,15 @@ Guacamole.ChainedTunnel.prototype = new Guacamole.Tunnel(); * * @constructor * @augments Guacamole.Tunnel - * @param {String} url + * @param {!string} url * The URL of a Guacamole protocol dump. * - * @param {Boolean} [crossDomain=false] + * @param {boolean} [crossDomain=false] * Whether tunnel requests will be cross-domain, and thus must use CORS * mechanisms and headers. By default, it is assumed that tunnel requests * will be made to the same domain. * - * @param {Object} [extraTunnelHeaders={}] + * @param {object} [extraTunnelHeaders={}] * Key value pairs containing the header names and values of any additional * headers to be sent in tunnel requests. By default, no extra headers will * be added. @@ -1334,16 +1360,17 @@ Guacamole.StaticHTTPTunnel = function StaticHTTPTunnel(url, crossDomain, extraTu * tokens, etc. * * @private + * @type {!object} */ var extraHeaders = extraTunnelHeaders || {}; /** * Adds the configured additional headers to the given request. * - * @param {XMLHttpRequest} request + * @param {!XMLHttpRequest} request * The request where the configured extra headers will be added. * - * @param {Object} headers + * @param {!object} headers * The headers to be added to the request. * * @private diff --git a/guacamole-common-js/src/main/webapp/modules/Version.js b/guacamole-common-js/src/main/webapp/modules/Version.js index 98d41e6a1..fd01fcba7 100644 --- a/guacamole-common-js/src/main/webapp/modules/Version.js +++ b/guacamole-common-js/src/main/webapp/modules/Version.js @@ -25,6 +25,6 @@ var Guacamole = Guacamole || {}; * used in downstream applications as a sanity check that the proper version * of the APIs is being used (in case an older version is cached, for example). * - * @type {String} + * @type {!string} */ Guacamole.API_VERSION = "1.4.0"; diff --git a/guacamole-common-js/src/main/webapp/modules/VideoPlayer.js b/guacamole-common-js/src/main/webapp/modules/VideoPlayer.js index 641e06eb3..2f82125ef 100644 --- a/guacamole-common-js/src/main/webapp/modules/VideoPlayer.js +++ b/guacamole-common-js/src/main/webapp/modules/VideoPlayer.js @@ -47,10 +47,10 @@ Guacamole.VideoPlayer = function VideoPlayer() { * implementation of Guacamole.VideoPlayer, and thus will be properly handled * by Guacamole.VideoPlayer.getInstance(). * - * @param {String} mimetype + * @param {!string} mimetype * The mimetype to check. * - * @returns {boolean} + * @returns {!boolean} * true if the given mimetype is supported by any built-in * Guacamole.VideoPlayer, false otherwise. */ @@ -68,7 +68,7 @@ Guacamole.VideoPlayer.isSupportedType = function isSupportedType(mimetype) { * mimetypes themselves will be listed. Any mimetype parameters, even required * ones, will not be included in the list. * - * @returns {string[]} + * @returns {!string[]} * A list of all mimetypes supported by any built-in Guacamole.VideoPlayer, * excluding any parameters. */ @@ -85,14 +85,14 @@ Guacamole.VideoPlayer.getSupportedTypes = function getSupportedTypes() { * video format. If support for the given video format is not available, null * is returned. * - * @param {Guacamole.InputStream} stream + * @param {!Guacamole.InputStream} stream * The Guacamole.InputStream to read video data from. * - * @param {Guacamole.Display.VisibleLayer} layer + * @param {!Guacamole.Display.VisibleLayer} layer * The destination layer in which this Guacamole.VideoPlayer should play * the received video data. * - * @param {String} mimetype + * @param {!string} mimetype * The mimetype of the video data in the provided stream. * * @return {Guacamole.VideoPlayer} diff --git a/guacamole-common-js/src/test/javascript/EventSpec.js b/guacamole-common-js/src/test/javascript/EventSpec.js index 9f94d6fa1..9d249294d 100644 --- a/guacamole-common-js/src/test/javascript/EventSpec.js +++ b/guacamole-common-js/src/test/javascript/EventSpec.js @@ -27,6 +27,8 @@ describe("Guacamole.Event", function EventSpec() { * * @constructor * @augments Guacamole.Event + * @param {object} value + * An arbitrary value to expose to the handler of the event. */ var TestEvent = function TestEvent(value) { @@ -35,7 +37,7 @@ describe("Guacamole.Event", function EventSpec() { /** * An arbitrary value to expose to the handler of this event. * - * @type {Object} + * @type {object} */ this.value = value;