You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/04/15 23:43:22 UTC
[17/55] [abbrv] git commit: [flex-asjs] [refs/heads/develop] - move
handwritten JS code to final home. Build scripts still need fixing up
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/JQuery/js/tests/MyModel.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/JQuery/js/tests/MyModel.js b/frameworks/projects/JQuery/js/tests/MyModel.js
new file mode 100644
index 0000000..59a659a
--- /dev/null
+++ b/frameworks/projects/JQuery/js/tests/MyModel.js
@@ -0,0 +1,60 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the 'License');
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an 'AS IS' BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+goog.provide('MyModel');
+
+goog.require('flash.events.EventDispatcher');
+
+goog.require('org.apache.flex.FlexGlobal');
+
+/**
+ * @constructor
+ * @extends {flash.events.EventDispatcher}
+ */
+MyModel = function() {
+ flash.events.EventDispatcher.call(this);
+
+ /**
+ * @private
+ * @type {string}
+ */
+ this.labelText_;
+};
+goog.inherits(MyModel, flash.events.EventDispatcher);
+
+/**
+ * @expose
+ * @this {MyModel}
+ * @return {string} The labelText getter.
+ */
+MyModel.prototype.get_labelText = function() {
+ return this.labelText_;
+};
+
+/**
+ * @expose
+ * @this {MyModel}
+ * @param {string} value The labelText setter.
+ */
+MyModel.prototype.set_labelText = function(value) {
+ if (value != this.labelText_) {
+ this.labelText_ = value;
+
+ this.dispatchEvent(
+ org.apache.flex.FlexGlobal.newObject(
+ flash.events.Event, ['labelTextChanged']
+ )
+ );
+ }
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/JQuery/js/tests/MySimpleValuesImpl.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/JQuery/js/tests/MySimpleValuesImpl.js b/frameworks/projects/JQuery/js/tests/MySimpleValuesImpl.js
new file mode 100644
index 0000000..dfde492
--- /dev/null
+++ b/frameworks/projects/JQuery/js/tests/MySimpleValuesImpl.js
@@ -0,0 +1,41 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+goog.provide('MySimpleValuesImpl');
+
+goog.require('org.apache.flex.core.SimpleValuesImpl');
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.core.SimpleValuesImpl}
+ */
+MySimpleValuesImpl = function() {
+ org.apache.flex.core.SimpleValuesImpl.call(this);
+
+ /**
+ * @private
+ * @type {Object}
+ */
+ this.values_ = {
+ /*
+ ITextButtonBead :
+ org_apache_flex_html_beads_TextButtonBead,
+ ITextBead :
+ org_apache_flex_html_beads_TextFieldBead,
+ ITextModel :
+ org_apache_flex_html_beads_models.TextModel
+ */
+ };
+};
+goog.inherits(MySimpleValuesImpl, org.apache.flex.core.SimpleValuesImpl);
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/JQuery/js/tests/test.html
----------------------------------------------------------------------
diff --git a/frameworks/projects/JQuery/js/tests/test.html b/frameworks/projects/JQuery/js/tests/test.html
new file mode 100644
index 0000000..60c6032
--- /dev/null
+++ b/frameworks/projects/JQuery/js/tests/test.html
@@ -0,0 +1,43 @@
+<html>
+<head>
+
+ <!-- start "compiled" -->
+ <script type="text/javascript" src="./FlexJS.js"></script>
+ <!-- end "compiled" -->
+
+ <!-- start "all": sequence matters ;-) ->
+
+ <script type="text/javascript" src="../closure/library/closure/goog/base.js"></script>
+
+ <script type="text/javascript" src="../src/FlexObject.js"></script>
+
+ <script type="text/javascript" src="../src/flash/events/Event.js"></script>
+
+ <script type="text/javascript" src="../src/FlexGlobal.js"></script>
+
+ <script type="text/javascript" src="../src/flash/events/EventDispatcher.js"></script>
+
+ <script type="text/javascript" src="../src/org/apache/flex/binding/SimpleBinding.js"></script>
+
+ <script type="text/javascript" src="../src/org/apache/flex/core/UIBase.js"></script>
+ <script type="text/javascript" src="../src/org/apache/flex/core/ViewBase.js"></script>
+ <script type="text/javascript" src="../src/org/apache/flex/core/ValuesManager.js"></script>
+ <script type="text/javascript" src="../src/org/apache/flex/core/SimpleValuesImpl.js"></script>
+ <script type="text/javascript" src="../src/org/apache/flex/core/Application.js"></script>
+
+ <script type="text/javascript" src="../src/org/apache/flex/html/Label.js"></script>
+ <script type="text/javascript" src="../src/org/apache/flex/html/TextButton.js"></script>
+
+ <script type="text/javascript" src="./MySimpleValuesImpl.js"></script>
+ <script type="text/javascript" src="./MyController.js"></script>
+ <script type="text/javascript" src="./MyModel.js"></script>
+ <script type="text/javascript" src="./MyInitialView.js"></script>
+
+ <script type="text/javascript" src="./FlexJSTest.js"></script>
+
+ <!-- end "all" -->
+
+</head>
+<body onload="new FlexJSTest().start();">
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Mobile/js/src/org/apache/cordova/Application.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/js/src/org/apache/cordova/Application.js b/frameworks/projects/Mobile/js/src/org/apache/cordova/Application.js
new file mode 100644
index 0000000..00c670d
--- /dev/null
+++ b/frameworks/projects/Mobile/js/src/org/apache/cordova/Application.js
@@ -0,0 +1,61 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/**
+ * org_apache_cordova_Application
+ *
+ * @fileoverview
+ *
+ * @suppress {checkTypes}
+ */
+
+goog.provide('org_apache_cordova_Application');
+
+goog.require('org_apache_flex_core_Application');
+
+
+
+/**
+ * @constructor
+ * @extends {org_apache_flex_core_Application}
+ */
+org_apache_cordova_Application = function() {
+ org_apache_cordova_Application.base(this, 'constructor');
+
+ document.addEventListener('deviceready',
+ goog.bind(this.devicereadyredispatcher, this),
+ false);
+};
+goog.inherits(org_apache_cordova_Application,
+ org_apache_flex_core_Application);
+
+
+/**
+ * @protected
+ * @param {Object} event
+ */
+org_apache_cordova_Application.prototype.devicereadyredispatcher = function(event) {
+ this.dispatchEvent('deviceready');
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_cordova_Application.prototype.FLEXJS_CLASS_INFO = {
+ names: [{ name: 'Application', qName: 'org_apache_cordova_Application'}]
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Mobile/js/src/org/apache/cordova/Weinre.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/js/src/org/apache/cordova/Weinre.js b/frameworks/projects/Mobile/js/src/org/apache/cordova/Weinre.js
new file mode 100644
index 0000000..130c161
--- /dev/null
+++ b/frameworks/projects/Mobile/js/src/org/apache/cordova/Weinre.js
@@ -0,0 +1,67 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/**
+ * org_apache_cordova_Application
+ *
+ * @fileoverview
+ *
+ * @suppress {checkTypes}
+ */
+
+goog.provide('org_apache_cordova_Weinre');
+
+
+
+/**
+ * @constructor
+ */
+org_apache_cordova_Weinre = function() {
+};
+
+
+Object.defineProperties(org_apache_cordova_Weinre.prototype, {
+ /** @expose */
+ strand: {
+ /** @this {org_apache_cordova_Weinre} */
+ set: function(value) {
+ this.strand_ = value;
+ }
+ },
+ /** @expose */
+ guid: {
+ /** @this {org_apache_cordova_Weinre} */
+ set: function(value) {
+
+ var scriptNode = document.createElement('SCRIPT');
+ scriptNode.type = 'text/javascript';
+ scriptNode.src = 'http://debug.phonegap.com/target/target-script-min.js#' + value;
+
+ var headNode = document.getElementsByTagName('HEAD');
+ if (headNode[0] != null)
+ headNode[0].appendChild(scriptNode);
+ }
+ }
+});
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_cordova_Weinre.prototype.FLEXJS_CLASS_INFO = {
+ names: [{ name: 'Weinre', qName: 'org_apache_cordova_Weinre'}]
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Mobile/js/src/org/apache/cordova/camera/Camera.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/js/src/org/apache/cordova/camera/Camera.js b/frameworks/projects/Mobile/js/src/org/apache/cordova/camera/Camera.js
new file mode 100644
index 0000000..c263770
--- /dev/null
+++ b/frameworks/projects/Mobile/js/src/org/apache/cordova/camera/Camera.js
@@ -0,0 +1,136 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ FalconJX will inject html into the index.html file. Surround with
+ "inject_html" tag as follows:
+
+ <inject_html>
+ <script type="text/javascript" src="cordova.js"></script>
+ </inject_html>
+ */
+
+/**
+ * org_apache_cordova_camera_Camera
+ *
+ * @fileoverview
+ *
+ * @suppress {checkTypes}
+ */
+
+goog.provide('org_apache_cordova_camera_Camera');
+
+
+
+/**
+ * @constructor
+ */
+org_apache_cordova_camera_Camera = function() {
+ this.pictureSourceType = org_apache_cordova_camera_Camera.PictureSourceType.PHOTOLIBRARY;
+ this.destinationType = org_apache_cordova_camera_Camera.DestinationType.DATA_URL;
+ this.mediaType = org_apache_cordova_camera_Camera.MediaType.PICTURE;
+ this.encodingType = org_apache_cordova_camera_Camera.EncodingType.JPEG;
+ this.direction = org_apache_cordova_camera_Camera.Direction.BACK;
+};
+
+
+/**
+ * @type {Object}
+ */
+org_apache_cordova_camera_Camera.DestinationType = {DATA_URL: 0, FILE_URI: 1, NATIVE_URI: 2};
+
+
+/**
+ * @type {Object}
+ */
+org_apache_cordova_camera_Camera.PictureSourceType = {PHOTOLIBRARY: 0, CAMERA: 1, SAVEDPHOTOALBUM: 2};
+
+
+/**
+ * @type {Object}
+ */
+org_apache_cordova_camera_Camera.EncodingType = {JPEG: 0, PNG: 1};
+
+
+/**
+ * @type {Object}
+ */
+org_apache_cordova_camera_Camera.MediaType = {PICTURE: 0, VIDEO: 1, ALLMEDIA: 2};
+
+
+/**
+ * @type {Object}
+ */
+org_apache_cordova_camera_Camera.Direction = {BACK: 0, FRONT: 1};
+
+
+/**
+ * @type {number}
+ */
+//org_apache_cordova_camera_Camera.prototype.pictureSourceType;
+
+
+/**
+ * @type {number}
+ */
+//org_apache_cordova_camera_Camera.prototype.destinationType;
+
+
+/**
+ * @type {number}
+ */
+//org_apache_cordova_camera_Camera.prototype.mediaType;
+
+
+/**
+ * @type {number}
+ */
+//org_apache_cordova_camera_Camera.prototype.encodingType;
+
+
+/**
+ * @type {number}
+ */
+//org_apache_cordova_camera_Camera.prototype.direction;
+
+
+/**
+ * @expose
+ * @param {Function} cameraSuccess
+ * @param {Function} cameraError
+ * @param {Object} cameraOptions
+ */
+org_apache_cordova_camera_Camera.prototype.getPicture = function(cameraSuccess, cameraError, cameraOptions) {
+ navigator.camera.getPicture(cameraSuccess, cameraError, cameraOptions);
+};
+
+
+/**
+ * @expose
+ * @param {Function} cameraSuccess
+ * @param {Function} cameraError
+ */
+org_apache_cordova_camera_Camera.prototype.cleanup = function(cameraSuccess, cameraError) {
+ navigator.camera.cleanup();
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_cordova_camera_Camera.prototype.FLEXJS_CLASS_INFO = {
+ names: [{ name: 'Camera', qName: 'org_apache_cordova_camera_Camera'}]
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Mobile/js/src/org/apache/flex/mobile/ManagerBase.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/js/src/org/apache/flex/mobile/ManagerBase.js b/frameworks/projects/Mobile/js/src/org/apache/flex/mobile/ManagerBase.js
new file mode 100644
index 0000000..0c705e6
--- /dev/null
+++ b/frameworks/projects/Mobile/js/src/org/apache/flex/mobile/ManagerBase.js
@@ -0,0 +1,128 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the 'License');
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an 'AS IS' BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+goog.provide('org_apache_flex_mobile_ManagerBase');
+
+goog.require('org_apache_flex_core_IChrome');
+goog.require('org_apache_flex_core_UIBase');
+goog.require('org_apache_flex_utils_Language');
+
+
+
+/**
+ * @constructor
+ * @extends {org_apache_flex_core_UIBase}
+ */
+org_apache_flex_mobile_ManagerBase = function() {
+ org_apache_flex_mobile_ManagerBase.base(this, 'constructor');
+};
+goog.inherits(org_apache_flex_mobile_ManagerBase,
+ org_apache_flex_core_UIBase);
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_flex_mobile_ManagerBase.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'ManagerBase',
+ qName: 'org_apache_flex_mobile_ManagerBase' }] };
+
+
+/**
+ * @type {org_apache_flex_core_UIBase}
+ */
+org_apache_flex_mobile_ManagerBase.prototype._contentArea = null;
+
+
+/**
+ * @expose
+ * @return {Object} The content area for this manager.
+ */
+org_apache_flex_mobile_ManagerBase.prototype.get_contentArea =
+ function() {
+ return this._contentArea;
+};
+
+
+/**
+ * @override
+ * @param {Object} c Element being added.
+ */
+org_apache_flex_mobile_ManagerBase.prototype.addElement = function(c) {
+ if (org_apache_flex_utils_Language.is(c, org_apache_flex_core_IChrome)) {
+ org_apache_flex_mobile_ManagerBase.base(this, 'addElement', c);
+ }
+ else {
+ this._contentArea.addElement(c);
+ }
+};
+
+
+/**
+ * @override
+ * @param {Object} c The child element.
+ * @param {number} index The index.
+ */
+org_apache_flex_mobile_ManagerBase.prototype.addElementAt =
+ function(c, index) {
+ if (org_apache_flex_utils_Language.is(c, org_apache_flex_core_IChrome)) {
+ org_apache_flex_mobile_ManagerBase.base(this, 'addElementAt', c, index);
+ }
+ else {
+ this._contentArea.addElementAt(c, index);
+ }
+};
+
+
+/**
+ * @override
+ * @param {Object} c The child element.
+ * @return {number} The index in parent.
+ */
+org_apache_flex_mobile_ManagerBase.prototype.getElementIndex =
+ function(c) {
+ return this._contentArea.getElementIndex(c);
+};
+
+
+/**
+ * @override
+ * @param {Object} c The child element.
+ */
+org_apache_flex_mobile_ManagerBase.prototype.removeElement =
+ function(c) {
+ this._contentArea.removeElement(c);
+};
+
+
+/**
+ * @override
+ */
+org_apache_flex_mobile_ManagerBase.prototype.createElement =
+ function() {
+
+ this.element = document.createElement('div');
+ this.element.className = 'ManagerBase';
+
+ this.positioner = this.element;
+ this.element.flexjs_wrapper = this;
+
+ this._contentArea = new org_apache_flex_core_UIBase();
+ this._contentArea.set_className('ContentArea');
+ org_apache_flex_core_UIBase.prototype.addElement.call(this, this._contentArea);
+
+ return this.element;
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Network/js/src/org/apache/flex/net/BinaryUploader.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Network/js/src/org/apache/flex/net/BinaryUploader.js b/frameworks/projects/Network/js/src/org/apache/flex/net/BinaryUploader.js
new file mode 100644
index 0000000..4d7cc22
--- /dev/null
+++ b/frameworks/projects/Network/js/src/org/apache/flex/net/BinaryUploader.js
@@ -0,0 +1,360 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the 'License');
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an 'AS IS' BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+goog.provide('org_apache_flex_net_BinaryUploader');
+
+goog.require('org_apache_flex_core_HTMLElementWrapper');
+goog.require('org_apache_flex_net_HTTPHeader');
+
+
+
+/**
+ * @constructor
+ * @extends {org_apache_flex_core_HTMLElementWrapper}
+ */
+org_apache_flex_net_BinaryUploader = function() {
+ org_apache_flex_net_BinaryUploader .base(this, 'constructor');
+
+ /**
+ * @private
+ * @type {string}
+ */
+ this.url_ = null;
+
+ /**
+ * @private
+ * @type {Number}
+ */
+ this.status_ = -1;
+
+ /**
+ * @private
+ * @type {string}
+ */
+ this.method_ = 'POST';
+
+ /**
+ * @private
+ * @type {Array}
+ */
+ this.headers_ = null;
+
+ /**
+ * @private
+ * @type {Array}
+ */
+ this.responseHeaders_ = null;
+
+ /**
+ * @private
+ * @type {string}
+ */
+ this.responseURL_ = null;
+
+ /**
+ * @private
+ * @type {Number}
+ */
+ this.timeout_ = 0;
+
+ /**
+ * @private
+ * @type {string}
+ */
+ this.binaryData_ = null;
+
+ /**
+ * @private
+ * @type {string}
+ */
+ this.contentType_ = 'application/octet-stream';
+
+ //try { // (erikdebruin) 'desperate' attempt to bypass XDR security in IE < 10
+ // this.contentType_ = 'text/plain';
+ // this.element = new XDomainRequest();
+ //} catch (e) {}
+
+ this.element = new XMLHttpRequest();
+};
+goog.inherits(org_apache_flex_net_BinaryUploader,
+ org_apache_flex_core_HTMLElementWrapper);
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_flex_net_BinaryUploader.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'BinaryUploader',
+ qName: 'org_apache_flex_net_BinaryUploader'}] };
+
+
+/**
+ * @expose
+ * @type {string}
+ */
+org_apache_flex_net_BinaryUploader.HTTP_METHOD_GET = 'GET';
+
+
+/**
+ * @expose
+ * @type {string}
+ */
+org_apache_flex_net_BinaryUploader.HTTP_METHOD_POST = 'POST';
+
+
+/**
+ * @expose
+ * @type {string}
+ */
+org_apache_flex_net_BinaryUploader.HTTP_METHOD_PUT = 'PUT';
+
+
+/**
+ * @expose
+ * @type {string}
+ */
+org_apache_flex_net_BinaryUploader.HTTP_METHOD_DELETE = 'DELETE';
+
+
+Object.defineProperties(org_apache_flex_net_BinaryUploader.prototype, {
+ /** @expose */
+ data: {
+ /** @this {org_apache_flex_net_BinaryUploader} */
+ get: function() {
+ return this.element.responseText;
+ }
+ },
+ /** @expose */
+ binaryData: {
+ /** @this {org_apache_flex_net_BinaryUploader} */
+ get: function() {
+ return this.binaryData_;
+ },
+ /** @this {org_apache_flex_net_BinaryUploader} */
+ set: function(value) {
+ this.binaryData_ = value;
+ }
+ },
+ /** @expose */
+ contentType: {
+ /** @this {org_apache_flex_net_BinaryUploader} */
+ get: function() {
+ return this.contentType_;
+ },
+ /** @this {org_apache_flex_net_BinaryUploader} */
+ set: function(value) {
+ this.contentType_ = value;
+ }
+ },
+ /** @expose */
+ headers: {
+ /** @this {org_apache_flex_net_BinaryUploader} */
+ get: function() {
+ if (this.headers_ === 'undefined') {
+ this.headers_ = [];
+ }
+
+ return this.headers_;
+ },
+ /** @this {org_apache_flex_net_BinaryUploader} */
+ set: function(value) {
+ this.headers_ = value;
+ }
+ },
+ /** @expose */
+ method: {
+ /** @this {org_apache_flex_net_BinaryUploader} */
+ get: function() {
+ return this.method_;
+ },
+ /** @this {org_apache_flex_net_BinaryUploader} */
+ set: function(value) {
+ this.method_ = value;
+ }
+ },
+ /** @expose */
+ responseHeaders: {
+ /** @this {org_apache_flex_net_BinaryUploader} */
+ get: function() {
+ var allHeaders, c, hdr, i, n, part1, part2;
+
+ if (typeof this.responseHeaders_ === 'undefined') {
+ allHeaders = this.element.getAllResponseHeaders();
+ this.responseHeaders_ = allHeaders.split('\n');
+ n = this.responseHeaders_.length;
+ for (i = 0; i < n; i++) {
+ hdr = this.responseHeaders_[i];
+ c = hdr.indexOf(':');
+ part1 = hdr.substring(0, c);
+ part2 = hdr.substring(c + 2);
+ this.responseHeaders_[i] =
+ new org_apache_flex_net_HTTPHeader(part1, part2);
+ }
+ }
+ return this.responseHeaders_;
+ }
+ },
+ /** @expose */
+ responseURL: {
+ /** @this {org_apache_flex_net_BinaryUploader} */
+ get: function() {
+ return this.responseURL_;
+ }
+ },
+ /** @expose */
+ status: {
+ /** @this {org_apache_flex_net_BinaryUploader} */
+ get: function() {
+ return this.status_;
+ }
+ },
+ /** @expose */
+ timeout: {
+ /** @this {org_apache_flex_net_BinaryUploader} */
+ get: function() {
+ return this.timeout_;
+ },
+ /** @this {org_apache_flex_net_BinaryUploader} */
+ set: function(value) {
+ this.timeout_ = value;
+ }
+ },
+ /** @expose */
+ url: {
+ /** @this {org_apache_flex_net_BinaryUploader} */
+ get: function() {
+ return this.url_;
+ },
+ /** @this {org_apache_flex_net_BinaryUploader} */
+ set: function(value) {
+ this.url_ = value;
+ }
+ },
+ /** @expose */
+ id: {
+ /** @this {org_apache_flex_net_BinaryUploader} */
+ get: function() {
+ return this.id;
+ },
+ /** @this {org_apache_flex_net_BinaryUploader} */
+ set: function(value) {
+ if (this.id !== value) {
+ this.id = value;
+ this.dispatchEvent('idChanged');
+ }
+ }
+ },
+ /** @expose */
+ MXMLDescriptor: {
+ /** @this {org_apache_flex_net_BinaryUploader} */
+ get: function() {
+ return null;
+ }
+ },
+ /** @expose */
+ MXMLProperties: {
+ /** @this {org_apache_flex_net_BinaryUploader} */
+ get: function() {
+ return null;
+ }
+ }
+});
+
+
+/**
+ * @expose
+ */
+org_apache_flex_net_BinaryUploader.prototype.send = function() {
+ var binaryData, header, i, n, sawContentType, url;
+
+ this.element.onreadystatechange = goog.bind(this.progressHandler, this);
+
+ url = this.url_;
+
+ binaryData = null;
+ if (this.binaryData_ !== undefined) {
+ if (this.method_ === org_apache_flex_net_BinaryUploader.HTTP_METHOD_GET) {
+ if (url.indexOf('?') !== -1) {
+ url += this.binaryData_.data;
+ } else {
+ url += '?' + this.binaryData_.data;
+ }
+ } else {
+ binaryData = this.binaryData_.data;
+ }
+ }
+
+ this.element.open(this.method_, this.url_, true);
+ this.element.timeout = this.timeout_;
+
+ sawContentType = false;
+ if (this.headers_) {
+ n = this.headers_.length;
+ for (i = 0; i < n; i++) {
+ header = this.headers_[i];
+ if (header.name === org_apache_flex_net_HTTPHeader.CONTENT_TYPE) {
+ sawContentType = true;
+ }
+
+ this.element.setRequestHeader(header.name, header.value);
+ }
+ }
+
+ if (this.method_ !== org_apache_flex_net_BinaryUploader.HTTP_METHOD_GET &&
+ !sawContentType && binaryData) {
+ this.element.setRequestHeader(
+ org_apache_flex_net_HTTPHeader.CONTENT_TYPE, this.binaryType_);
+ }
+
+ if (binaryData) {
+ this.element.setRequestHeader('Content-length', binaryData.length);
+ this.element.setRequestHeader('Connection', 'close');
+ this.element.send(binaryData);
+ } else {
+ this.element.send();
+ }
+};
+
+
+/**
+ * @protected
+ */
+org_apache_flex_net_BinaryUploader.prototype.progressHandler = function() {
+ if (this.element.readyState === 2) {
+ this.status_ = this.element.status;
+ this.dispatchEvent('httpResponseStatus');
+ this.dispatchEvent('httpStatus');
+ } else if (this.element.readyState === 4) {
+ this.dispatchEvent('complete');
+ }
+};
+
+
+/**
+ * @expose
+ * @type {string}
+ */
+org_apache_flex_net_BinaryUploader.prototype.id = null;
+
+
+/**
+ * @param {Object} document The MXML object.
+ * @param {string} id The id for the instance.
+ */
+org_apache_flex_net_BinaryUploader.prototype.setDocument =
+ function(document, id) {
+ this.document = document;
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Network/js/src/org/apache/flex/net/HTTPHeader.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Network/js/src/org/apache/flex/net/HTTPHeader.js b/frameworks/projects/Network/js/src/org/apache/flex/net/HTTPHeader.js
new file mode 100644
index 0000000..8eee6f2
--- /dev/null
+++ b/frameworks/projects/Network/js/src/org/apache/flex/net/HTTPHeader.js
@@ -0,0 +1,63 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+goog.provide('org_apache_flex_net_HTTPHeader');
+
+
+
+/**
+ * @constructor
+ * @param {string=} opt_name The name.
+ * @param {string=} opt_value The value.
+ */
+org_apache_flex_net_HTTPHeader = function(opt_name, opt_value) {
+ if (typeof opt_name !== 'undefined') {
+ this.name = opt_name;
+ }
+
+ if (typeof opt_value !== 'undefined') {
+ this.value = opt_value;
+ }
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_flex_net_HTTPHeader.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'HTTPHeader',
+ qName: 'org_apache_flex_net_HTTPHeader'}] };
+
+
+/**
+ * @expose
+ * @type {string}
+ */
+org_apache_flex_net_HTTPHeader.CONTENT_TYPE = 'Content-type';
+
+
+/**
+ * @expose
+ * @type {?string}
+ */
+org_apache_flex_net_HTTPHeader.prototype.value = null;
+
+
+/**
+ * @expose
+ * @type {?string}
+ */
+org_apache_flex_net_HTTPHeader.prototype.name = null;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Network/js/src/org/apache/flex/net/HTTPService.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Network/js/src/org/apache/flex/net/HTTPService.js b/frameworks/projects/Network/js/src/org/apache/flex/net/HTTPService.js
new file mode 100644
index 0000000..ff1f743
--- /dev/null
+++ b/frameworks/projects/Network/js/src/org/apache/flex/net/HTTPService.js
@@ -0,0 +1,389 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the 'License');
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an 'AS IS' BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+goog.provide('org_apache_flex_net_HTTPService');
+
+goog.require('org_apache_flex_core_HTMLElementWrapper');
+goog.require('org_apache_flex_net_HTTPHeader');
+
+
+
+/**
+ * @constructor
+ * @extends {org_apache_flex_core_HTMLElementWrapper}
+ */
+org_apache_flex_net_HTTPService = function() {
+ org_apache_flex_net_HTTPService.base(this, 'constructor');
+
+ /**
+ * @private
+ * @type {?string}
+ */
+ this.url_ = null;
+
+ /**
+ * @private
+ * @type {number}
+ */
+ this.status_ = -1;
+
+ /**
+ * @private
+ * @type {string}
+ */
+ this.method_ = 'GET';
+
+ /**
+ * @private
+ * @type {Array}
+ */
+ this.headers_ = null;
+
+ /**
+ * @private
+ * @type {Array}
+ */
+ this.responseHeaders_ = null;
+
+ /**
+ * @private
+ * @type {?string}
+ */
+ this.responseURL_ = null;
+
+ /**
+ * @private
+ * @type {Array.<Object>}
+ */
+ this.mxmlBeads_ = null;
+
+ /**
+ * @private
+ * @type {Array.<Object>}
+ */
+ this.beads_ = null;
+
+ /**
+ * @private
+ * @type {number}
+ */
+ this.timeout_ = 0;
+
+ /**
+ * @private
+ * @type {?string}
+ */
+ this.contentData_ = null;
+
+ /**
+ * @private
+ * @type {string}
+ */
+ this.contentType_ = 'application/x-www-form-urlencoded';
+
+ /**
+ * @private
+ * @type {?string}
+ */
+ this.id_ = null;
+
+ //try { // (erikdebruin) 'desperate' attempt to bypass XDR security in IE < 10
+ // this.contentType_ = 'text/plain';
+ // this.element = new XDomainRequest();
+ //} catch (e) {}
+
+ this.element = new XMLHttpRequest();
+};
+goog.inherits(org_apache_flex_net_HTTPService,
+ org_apache_flex_core_HTMLElementWrapper);
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_flex_net_HTTPService.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'HTTPService',
+ qName: 'org_apache_flex_net_HTTPService'}] };
+
+
+/**
+ * @expose
+ * @type {string}
+ */
+org_apache_flex_net_HTTPService.HTTP_METHOD_GET = 'GET';
+
+
+/**
+ * @expose
+ * @type {string}
+ */
+org_apache_flex_net_HTTPService.HTTP_METHOD_POST = 'POST';
+
+
+/**
+ * @expose
+ * @type {string}
+ */
+org_apache_flex_net_HTTPService.HTTP_METHOD_PUT = 'PUT';
+
+
+/**
+ * @expose
+ * @type {string}
+ */
+org_apache_flex_net_HTTPService.HTTP_METHOD_DELETE = 'DELETE';
+
+
+Object.defineProperties(org_apache_flex_net_HTTPService.prototype, {
+ /** @expose */
+ strand: {
+ /** @this {org_apache_flex_net_HTTPService} */
+ set: function(value) {}
+ },
+ /** @expose */
+ beads: {
+ /** @this {org_apache_flex_net_HTTPService} */
+ set: function(value) {
+ this.mxmlBeads_ = value;
+ }
+ },
+ /** @expose */
+ data: {
+ /** @this {org_apache_flex_net_HTTPService} */
+ get: function() {
+ return this.element.responseText;
+ }
+ },
+ /** @expose */
+ contentData: {
+ /** @this {org_apache_flex_net_HTTPService} */
+ get: function() {
+ return this.contentData_;
+ },
+ /** @this {org_apache_flex_net_HTTPService} */
+ set: function(value) {
+ this.contentData_ = value;
+ }
+ },
+ /** @expose */
+ contentType: {
+ /** @this {org_apache_flex_net_HTTPService} */
+ get: function() {
+ return this.contentType_;
+ },
+ /** @this {org_apache_flex_net_HTTPService} */
+ set: function(value) {
+ this.contentType_ = value;
+ }
+ },
+ /** @expose */
+ headers: {
+ /** @this {org_apache_flex_net_HTTPService} */
+ get: function() {
+ if (this.headers_ === undefined) {
+ this.headers_ = [];
+ }
+
+ return this.headers_;
+ },
+ /** @this {org_apache_flex_net_HTTPService} */
+ set: function(value) {
+ this.headers_ = value;
+ }
+ },
+ /** @expose */
+ method: {
+ /** @this {org_apache_flex_net_HTTPService} */
+ get: function() {
+ return this.method_;
+ },
+ /** @this {org_apache_flex_net_HTTPService} */
+ set: function(value) {
+ this.method_ = value;
+ }
+ },
+ /** @expose */
+ responseHeaders: {
+ /** @this {org_apache_flex_net_HTTPService} */
+ get: function() {
+ var allHeaders, c, hdr, i, n, part1, part2;
+
+ if (typeof this.responseHeaders_ === 'undefined') {
+ allHeaders = this.element.getAllResponseHeaders();
+ this.responseHeaders_ = allHeaders.split('\n');
+ n = this.responseHeaders_.length;
+ for (i = 0; i < n; i++) {
+ hdr = this.responseHeaders_[i];
+ c = hdr.indexOf(':');
+ part1 = hdr.substring(0, c);
+ part2 = hdr.substring(c + 2);
+ this.responseHeaders_[i] =
+ new org_apache_flex_net_HTTPHeader(part1, part2);
+ }
+ }
+ return this.responseHeaders_;
+ }
+ },
+ /** @expose */
+ responseURL: {
+ /** @this {org_apache_flex_net_HTTPService} */
+ get: function() {
+ return this.responseURL_;
+ }
+ },
+ /** @expose */
+ status: {
+ /** @this {org_apache_flex_net_HTTPService} */
+ get: function() {
+ return this.status_;
+ }
+ },
+ /** @expose */
+ timeout: {
+ /** @this {org_apache_flex_net_HTTPService} */
+ get: function() {
+ return this.timeout_;
+ },
+ /** @this {org_apache_flex_net_HTTPService} */
+ set: function(value) {
+ this.timeout_ = value;
+ }
+ },
+ /** @expose */
+ url: {
+ /** @this {org_apache_flex_net_HTTPService} */
+ get: function() {
+ return this.url_;
+ },
+ /** @this {org_apache_flex_net_HTTPService} */
+ set: function(value) {
+ this.url_ = value;
+ }
+ },
+ /** @expose */
+ id: {
+ /** @this {org_apache_flex_net_HTTPService} */
+ get: function() {
+ return this.id_;
+ },
+ /** @this {org_apache_flex_net_HTTPService} */
+ set: function(value) {
+ if (this.id_ !== value) {
+ this.id_ = value;
+ this.dispatchEvent('idChanged');
+ }
+ }
+ },
+ /** @expose */
+ MXMLDescriptor: {
+ /** @this {org_apache_flex_net_HTTPService} */
+ get: function() {
+ return null;
+ }
+ },
+ /** @expose */
+ MXMLProperties: {
+ /** @this {org_apache_flex_net_HTTPService} */
+ get: function() {
+ return null;
+ }
+ }
+});
+
+
+/**
+ * @expose
+ */
+org_apache_flex_net_HTTPService.prototype.send = function() {
+ var contentData, header, i, n, sawContentType, url;
+
+ if (this.beads_ == null && this.mxmlBeads_) {
+ var m = this.mxmlBeads_.length;
+ for (var j = 0; j < m; j++) {
+ this.addBead(this.mxmlBeads_[j]);
+ }
+ }
+
+ this.element.onreadystatechange = goog.bind(this.progressHandler, this);
+
+ url = this.url_;
+
+ contentData = null;
+ if (this.contentData_ !== undefined) {
+ if (this.method_ === org_apache_flex_net_HTTPService.HTTP_METHOD_GET) {
+ if (url.indexOf('?') !== -1) {
+ url += this.contentData_;
+ } else {
+ url += '?' + this.contentData_;
+ }
+ } else {
+ contentData = this.contentData_;
+ }
+ }
+
+ this.element.open(this.method_, this.url_, true);
+ this.element.timeout = this.timeout_;
+
+ sawContentType = false;
+ if (this.headers_) {
+ n = this.headers_.length;
+ for (i = 0; i < n; i++) {
+ header = this.headers_[i];
+ if (header.name === org_apache_flex_net_HTTPHeader.CONTENT_TYPE) {
+ sawContentType = true;
+ }
+
+ this.element.setRequestHeader(header.name, header.value);
+ }
+ }
+
+ if (this.method_ !== org_apache_flex_net_HTTPService.HTTP_METHOD_GET &&
+ !sawContentType && contentData) {
+ this.element.setRequestHeader(
+ org_apache_flex_net_HTTPHeader.CONTENT_TYPE, this.contentType_);
+ }
+
+ if (contentData) {
+ this.element.setRequestHeader('Content-length', contentData.length);
+ this.element.setRequestHeader('Connection', 'close');
+ this.element.send(contentData);
+ } else {
+ this.element.send();
+ }
+};
+
+
+/**
+ * @protected
+ */
+org_apache_flex_net_HTTPService.prototype.progressHandler = function() {
+ if (this.element.readyState === 2) {
+ this.status_ = this.element.status;
+ this.dispatchEvent('httpResponseStatus');
+ this.dispatchEvent('httpStatus');
+ } else if (this.element.readyState === 4) {
+ this.dispatchEvent('complete');
+ }
+};
+
+
+/**
+ * @param {Object} document The MXML object.
+ * @param {string} id The id for the instance.
+ */
+org_apache_flex_net_HTTPService.prototype.setDocument = function(document, id) {
+ this.document = document;
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Network/js/src/org/apache/flex/net/JSONInputParser.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Network/js/src/org/apache/flex/net/JSONInputParser.js b/frameworks/projects/Network/js/src/org/apache/flex/net/JSONInputParser.js
new file mode 100644
index 0000000..83a41d1
--- /dev/null
+++ b/frameworks/projects/Network/js/src/org/apache/flex/net/JSONInputParser.js
@@ -0,0 +1,48 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+goog.provide('org_apache_flex_net_JSONInputParser');
+
+
+
+/**
+ * @constructor
+ */
+org_apache_flex_net_JSONInputParser = function() {
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_flex_net_JSONInputParser.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'JSONInputParser',
+ qName: 'org_apache_flex_net_JSONInputParser'}] };
+
+
+/**
+ * @expose
+ * @param {string} s The input string.
+ * @return {Array.<string>} The Array of unparsed objects.
+ */
+org_apache_flex_net_JSONInputParser.prototype.parseItems = function(s) {
+ var c = s.indexOf('[');
+ if (c != -1) {
+ var c2 = s.lastIndexOf(']');
+ s = s.substring(c + 1, c2);
+ }
+ return s.split('},');
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Network/js/src/org/apache/flex/net/JSONItemConverter.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Network/js/src/org/apache/flex/net/JSONItemConverter.js b/frameworks/projects/Network/js/src/org/apache/flex/net/JSONItemConverter.js
new file mode 100644
index 0000000..5434a15
--- /dev/null
+++ b/frameworks/projects/Network/js/src/org/apache/flex/net/JSONItemConverter.js
@@ -0,0 +1,48 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+goog.provide('org_apache_flex_net_JSONItemConverter');
+
+
+
+/**
+ * @constructor
+ */
+org_apache_flex_net_JSONItemConverter = function() {
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_flex_net_JSONItemConverter.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'JSONItemConverter',
+ qName: 'org_apache_flex_net_JSONItemConverter'}] };
+
+
+/**
+ * @expose
+ * @param {string} s The input string.
+ * @return {*} The object.
+ */
+org_apache_flex_net_JSONItemConverter.prototype.convertItem = function(s) {
+ var c = s.indexOf('{)');
+ if (c > 0)
+ s = s.substring(c);
+ if (s.indexOf('}') == -1)
+ s += '}';
+ return JSON.parse(s);
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Network/js/src/org/apache/flex/net/dataConverters/LazyCollection.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Network/js/src/org/apache/flex/net/dataConverters/LazyCollection.js b/frameworks/projects/Network/js/src/org/apache/flex/net/dataConverters/LazyCollection.js
new file mode 100644
index 0000000..af2245d
--- /dev/null
+++ b/frameworks/projects/Network/js/src/org/apache/flex/net/dataConverters/LazyCollection.js
@@ -0,0 +1,163 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+goog.provide('org_apache_flex_net_dataConverters_LazyCollection');
+
+goog.require('org_apache_flex_events_EventDispatcher');
+goog.require('org_apache_flex_events_IEventDispatcher');
+
+
+
+/**
+ * @constructor
+ * @extends {org_apache_flex_events_EventDispatcher}
+ */
+org_apache_flex_net_dataConverters_LazyCollection = function() {
+ org_apache_flex_net_dataConverters_LazyCollection.base(this, 'constructor');
+ /**
+ * @private
+ * @type {Object}
+ */
+ this.data_ = null;
+
+ /**
+ * @private
+ * @type {Object}
+ */
+
+ this.itemConverter_ = null;
+
+ /**
+ * @private
+ * @type {Object}
+ */
+ this.inputParser_ = null;
+
+ /**
+ * @private
+ * @type {Object}
+ */
+ this.rawData_ = null;
+
+ /**
+ * @private
+ * @type {Object}
+ */
+ this.strand_ = null;
+};
+goog.inherits(org_apache_flex_net_dataConverters_LazyCollection, org_apache_flex_events_EventDispatcher);
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_flex_net_dataConverters_LazyCollection.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'LazyCollection',
+ qName: 'org_apache_flex_net_dataConverters_LazyCollection'}],
+ interfaces: [org_apache_flex_events_IEventDispatcher]};
+
+
+Object.defineProperties(org_apache_flex_net_dataConverters_LazyCollection.prototype, {
+ /** @expose */
+ strand: {
+ /** @this {org_apache_flex_net_dataConverters_LazyCollection} */
+ set: function(value) {
+ if (this.strand_ !== value) {
+ this.strand_ = value;
+ this.strand_.addEventListener('complete',
+ goog.bind(this.completeHandler, this));
+ }
+ }
+ },
+ /** @expose */
+ length: {
+ /** @this {org_apache_flex_net_dataConverters_LazyCollection} */
+ get: function() {
+ return this.rawData_ ? this.rawData_.length : 0;
+ }
+ },
+ /** @expose */
+ inputParser: {
+ /** @this {org_apache_flex_net_dataConverters_LazyCollection} */
+ get: function() {
+ return this.inputParser_;
+ },
+ /** @this {org_apache_flex_net_dataConverters_LazyCollection} */
+ set: function(value) {
+ this.inputParser_ = value;
+ }
+ },
+ /** @expose */
+ itemConverter: {
+ /** @this {org_apache_flex_net_dataConverters_LazyCollection} */
+ get: function() {
+ return this.itemConverter_;
+ },
+ /** @this {org_apache_flex_net_dataConverters_LazyCollection} */
+ set: function(value) {
+ this.itemConverter_ = value;
+ }
+ },
+ /** @expose */
+ id: {
+ /** @this {org_apache_flex_net_dataConverters_LazyCollection} */
+ get: function() {
+ return this.id_;
+ },
+ /** @this {org_apache_flex_net_dataConverters_LazyCollection} */
+ set: function(value) {
+ if (this.id_ !== value) {
+ this.id_ = value;
+ // this.dispatchEvent(new Event('idChanged'));
+ }
+ }
+ }
+});
+
+
+/**
+ * @private
+ * @type {string}
+ */
+org_apache_flex_net_dataConverters_LazyCollection.prototype.id_ = '';
+
+
+/**
+ * @protected
+ */
+org_apache_flex_net_dataConverters_LazyCollection.prototype.completeHandler =
+ function() {
+ var results = this.strand_.data;
+ this.rawData_ = this.inputParser_.parseItems(results);
+ this.data_ = [];
+ this.dispatchEvent('complete');
+};
+
+
+/**
+ * @expose
+ * @param {number} index The index in the collection.
+ * @return {Object} An item in the collection.
+ */
+org_apache_flex_net_dataConverters_LazyCollection.prototype.getItemAt =
+ function(index) {
+ if (this.data_[index] === undefined) {
+ this.data_[index] =
+ this.itemConverter_.convertItem(this.rawData_[index]);
+ }
+
+ return this.data_[index];
+};