You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by er...@apache.org on 2013/05/04 20:19:45 UTC
[3/9] git commit: [flex-asjs] [refs/heads/develop] - [FlexJS] initial
commit of 'goog.events' refactoring
[FlexJS] initial commit of 'goog.events' refactoring
Major refactor that exchanges the 'roll-your-own' event handling for 'goog.events'.
Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/b7b74f50
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/b7b74f50
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/b7b74f50
Branch: refs/heads/develop
Commit: b7b74f506b5462a3afa6f96509b73613c550f214
Parents: ab3a320
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Wed Apr 24 20:19:35 2013 +0200
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Wed Apr 24 20:35:59 2013 +0200
----------------------------------------------------------------------
.../js/FlexJS/src/org/apache/flex/FlexGlobal.js | 61 --
.../js/FlexJS/src/org/apache/flex/FlexObject.js | 26 -
.../src/org/apache/flex/binding/BindingBase.js | 78 ++
.../src/org/apache/flex/binding/ConstantBinding.js | 59 +-
.../src/org/apache/flex/binding/SimpleBinding.js | 72 +--
.../FlexJS/src/org/apache/flex/core/Application.js | 66 +--
.../src/org/apache/flex/core/HTMLElementWrapper.js | 174 ++--
.../FlexJS/src/org/apache/flex/core/IDocument.js | 28 -
.../js/FlexJS/src/org/apache/flex/core/ListBase.js | 185 ++++
.../org/apache/flex/core/SimpleCSSValuesImpl.js | 7 +-
.../src/org/apache/flex/core/SimpleValuesImpl.js | 7 +-
.../js/FlexJS/src/org/apache/flex/core/UIBase.js | 74 +-
.../src/org/apache/flex/core/ValuesManager.js | 8 +-
.../js/FlexJS/src/org/apache/flex/core/ViewBase.js | 29 +-
.../src/org/apache/flex/events/CustomEvent.js | 19 +-
.../js/FlexJS/src/org/apache/flex/events/Event.js | 22 +-
.../src/org/apache/flex/events/EventDispatcher.js | 100 +--
.../apache/flex/html/staticControls/CheckBox.js | 55 +-
.../apache/flex/html/staticControls/ComboBox.js | 307 +++----
.../flex/html/staticControls/DropDownList.js | 129 +---
.../org/apache/flex/html/staticControls/Label.js | 20 +-
.../org/apache/flex/html/staticControls/List.js | 124 +---
.../apache/flex/html/staticControls/RadioButton.js | 66 +-
.../apache/flex/html/staticControls/TextArea.js | 27 +-
.../apache/flex/html/staticControls/TextButton.js | 24 +-
.../apache/flex/html/staticControls/TextInput.js | 29 +-
.../apache/flex/html5/staticControls/CheckBox.js | 55 +-
.../apache/flex/html5/staticControls/ComboBox.js | 306 +++----
.../flex/html5/staticControls/DropDownList.js | 129 +---
.../org/apache/flex/html5/staticControls/Label.js | 23 +-
.../org/apache/flex/html5/staticControls/List.js | 121 +---
.../flex/html5/staticControls/RadioButton.js | 66 +-
.../apache/flex/html5/staticControls/TextArea.js | 27 +-
.../apache/flex/html5/staticControls/TextButton.js | 27 +-
.../apache/flex/html5/staticControls/TextInput.js | 29 +-
.../src/org/apache/flex/jquery/Application.js | 96 +--
.../apache/flex/jquery/staticControls/CheckBox.js | 72 +-
.../flex/jquery/staticControls/RadioButton.js | 68 +-
.../flex/jquery/staticControls/TextButton.js | 29 +-
.../FlexJS/src/org/apache/flex/net/HTTPHeader.js | 26 +-
.../FlexJS/src/org/apache/flex/net/HTTPService.js | 451 +++++------
.../src/org/apache/flex/net/JSONInputParser.js | 8 +-
.../src/org/apache/flex/net/JSONItemConverter.js | 9 +-
.../flex/net/dataConverters/LazyCollection.js | 159 ++--
.../FlexJS/src/org/apache/flex/utils/IE8Utils.js | 104 ---
.../org/apache/flex/utils/MXMLDataInterpreter.js | 675 ++++++++-------
.../js/FlexJS/src/org/apache/flex/utils/Timer.js | 126 ++--
47 files changed, 1901 insertions(+), 2501 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/FlexGlobal.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/FlexGlobal.js b/frameworks/js/FlexJS/src/org/apache/flex/FlexGlobal.js
deleted file mode 100644
index 01f06bf..0000000
--- a/frameworks/js/FlexJS/src/org/apache/flex/FlexGlobal.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * 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.FlexGlobal');
-
-goog.require('org.apache.flex.events.Event');
-goog.require('org.apache.flex.events.CustomEvent');
-
-/**
- * @constructor
- */
-org.apache.flex.FlexGlobal = function() {};
-
-/**
- * @param {Object} context The context.
- * @param {?} method The method.
- * @return {function (?): void} Return new proxy.
- */
-org.apache.flex.FlexGlobal.createProxy = function(context, method) {
- return function(value) {
- method.apply(context, [value]);
- };
-};
-
-/**
- * @param {?} ctor The creator.
- * @param {Array} ctorArgs The creator arguments.
- * @return {Object} Return the new object.
- */
-org.apache.flex.FlexGlobal.newObject = function(ctor, ctorArgs) {
- var evt;
-
- if ((ctor === org.apache.flex.events.Event ||
- ctor === org.apache.flex.events.CustomEvent) &&
- ctorArgs.length === 1) {
- evt = org.apache.flex.events.EventDispatcher.createEvent(ctorArgs[0]);
- return evt;
- }
-
- if (ctorArgs.length === 1) {
- return new ctor(ctorArgs[0]);
- }
-
- if (ctorArgs.length === 0) {
- return new ctor();
- }
-
- return {};
-};
-
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/FlexObject.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/FlexObject.js b/frameworks/js/FlexJS/src/org/apache/flex/FlexObject.js
deleted file mode 100644
index a0521bf..0000000
--- a/frameworks/js/FlexJS/src/org/apache/flex/FlexObject.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * 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.FlexObject');
-
-/**
- * @constructor
- */
-org.apache.flex.FlexObject = function() {};
-
-/**
- * @protected
- * @type {Object}
- */
-org.apache.flex.FlexObject.prototype.element = null;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/binding/BindingBase.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/binding/BindingBase.js b/frameworks/js/FlexJS/src/org/apache/flex/binding/BindingBase.js
new file mode 100644
index 0000000..08032a6
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/binding/BindingBase.js
@@ -0,0 +1,78 @@
+/**
+ * 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.binding.BindingBase');
+
+
+
+/**
+ * @constructor
+ */
+org.apache.flex.binding.BindingBase = function() {
+ /**
+ * @private
+ * @type {Object}
+ */
+ this.document_;
+};
+
+
+/**
+ * @expose
+ * @type {Object}
+ */
+org.apache.flex.binding.BindingBase.prototype.destination = null;
+
+
+/**
+ * @expose
+ * @type {string}
+ */
+org.apache.flex.binding.BindingBase.prototype.destinationPropertyName = '';
+
+
+/**
+ * @expose
+ * @type {Object}
+ */
+org.apache.flex.binding.BindingBase.prototype.source = null;
+
+
+/**
+ * @expose
+ * @type {string}
+ */
+org.apache.flex.binding.BindingBase.prototype.sourcePropertyName = '';
+
+
+/**
+ * @this {org.apache.flex.binding.BindingBase}
+ * @param {Object} value The strand (owner) of the bead.
+ */
+org.apache.flex.binding.BindingBase.prototype.set_strand = function(value) {
+ this.destination = value;
+
+ this.source = this.document_[this.sourceID];
+};
+
+
+/**
+ * @this {org.apache.flex.binding.BindingBase}
+ * @param {Object} document The MXML object.
+ * @param {string} id The id for the instance.
+ */
+org.apache.flex.binding.BindingBase.prototype.setDocument =
+ function(document, id) {
+ this.document_ = document;
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/binding/ConstantBinding.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/binding/ConstantBinding.js b/frameworks/js/FlexJS/src/org/apache/flex/binding/ConstantBinding.js
index 241337e..ca2c4e9 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/binding/ConstantBinding.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/binding/ConstantBinding.js
@@ -3,7 +3,7 @@
* 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
+ * 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,
@@ -14,63 +14,28 @@
goog.provide('org.apache.flex.binding.ConstantBinding');
-goog.require('org.apache.flex.FlexGlobal');
-goog.require('org.apache.flex.FlexObject');
+goog.require('org.apache.flex.binding.BindingBase');
+
+
/**
* @constructor
- * @extends {org.apache.flex.FlexObject}
*/
org.apache.flex.binding.ConstantBinding = function() {
- org.apache.flex.FlexObject.call(this);
+ goog.base(this);
};
-goog.inherits(
- org.apache.flex.binding.ConstantBinding, org.apache.flex.FlexObject
-);
-
-/**
- * @expose
- * @type {Object}
- */
-org.apache.flex.binding.ConstantBinding.prototype.destination = null;
-
-/**
- * @expose
- * @type {string}
- */
-org.apache.flex.binding.ConstantBinding.prototype.destinationPropertyName = '';
-
-/**
- * @expose
- * @type {Object}
- */
-org.apache.flex.binding.ConstantBinding.prototype.source = null;
+goog.inherits(org.apache.flex.binding.ConstantBinding,
+ org.apache.flex.binding.BindingBase);
-/**
- * @expose
- * @type {string}
- */
-org.apache.flex.binding.ConstantBinding.prototype.sourcePropertyName = '';
/**
+ * @override
* @this {org.apache.flex.binding.ConstantBinding}
- * @param {object} value The strand (owner) of the bead.
+ * @param {Object} value The strand (owner) of the bead.
*/
org.apache.flex.binding.ConstantBinding.prototype.set_strand = function(value) {
- this.destination = value;
- this.source = this.document[this.sourceID];
+ goog.base(this, 'set_strand', value);
- this.destination['set_' + this.destinationPropertyName](
- this.source['get_' + this.sourcePropertyName]()
- );
-};
-
-/**
- * @this {org.apache.flex.binding.ConstantBinding}
- * @param {object} document The MXML object.
- * @param {string} id The id for the instance.
- */
-org.apache.flex.binding.ConstantBinding.prototype.setDocument =
- function(document, id) {
- this.document = document;
+ this.destination['set_' + this.destinationPropertyName](
+ this.source['get_' + this.sourcePropertyName]());
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/binding/SimpleBinding.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/binding/SimpleBinding.js b/frameworks/js/FlexJS/src/org/apache/flex/binding/SimpleBinding.js
index 822b1ac..ab168e6 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/binding/SimpleBinding.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/binding/SimpleBinding.js
@@ -14,38 +14,19 @@
goog.provide('org.apache.flex.binding.SimpleBinding');
-goog.require('org.apache.flex.FlexGlobal');
-goog.require('org.apache.flex.FlexObject');
+goog.require('org.apache.flex.binding.BindingBase');
+
+
/**
* @constructor
- * @extends {org.apache.flex.FlexObject}
*/
org.apache.flex.binding.SimpleBinding = function() {
- org.apache.flex.FlexObject.call(this);
-
- /**
- * @private
- * @type {object}
- */
- this.document;
-
+ goog.base(this);
};
-goog.inherits(
- org.apache.flex.binding.SimpleBinding, org.apache.flex.FlexObject
-);
-
-/**
- * @expose
- * @type {Object}
- */
-org.apache.flex.binding.SimpleBinding.prototype.destination = null;
+goog.inherits(org.apache.flex.binding.SimpleBinding,
+ org.apache.flex.binding.BindingBase);
-/**
- * @expose
- * @type {string}
- */
-org.apache.flex.binding.SimpleBinding.prototype.destinationPropertyName = '';
/**
* @expose
@@ -53,11 +34,6 @@ org.apache.flex.binding.SimpleBinding.prototype.destinationPropertyName = '';
*/
org.apache.flex.binding.SimpleBinding.prototype.eventName = '';
-/**
- * @expose
- * @type {Object}
- */
-org.apache.flex.binding.SimpleBinding.prototype.source = null;
/**
* @expose
@@ -65,43 +41,27 @@ org.apache.flex.binding.SimpleBinding.prototype.source = null;
*/
org.apache.flex.binding.SimpleBinding.prototype.sourceID = '';
-/**
- * @expose
- * @type {string}
- */
-org.apache.flex.binding.SimpleBinding.prototype.sourcePropertyName = '';
/**
* @this {org.apache.flex.binding.SimpleBinding}
*/
org.apache.flex.binding.SimpleBinding.prototype.changeHandler = function() {
- this.destination['set_' + this.destinationPropertyName](
- this.source['get_' + this.sourcePropertyName]()
- );
+ this.destination['set_' + this.destinationPropertyName](
+ this.source['get_' + this.sourcePropertyName]()
+ );
};
+
/**
+ * @override
* @this {org.apache.flex.binding.SimpleBinding}
- * @param {object} value The strand (owner) of the bead.
+ * @param {Object} value The strand (owner) of the bead.
*/
org.apache.flex.binding.SimpleBinding.prototype.set_strand = function(value) {
- this.destination = value;
- this.source = this.document[this.sourceID];
- this.source.addEventListener(
- this.eventName, org.apache.flex.FlexGlobal.createProxy(
- this, this.changeHandler
- )
- );
+ goog.base(this, 'set_strand', value);
- this.changeHandler();
-};
+ this.source.addEventListener(this.eventName,
+ goog.bind(this.changeHandler, this));
-/**
- * @this {org.apache.flex.binding.SimpleBinding}
- * @param {object} document The MXML object.
- * @param {string} id The id for the instance.
- */
-org.apache.flex.binding.SimpleBinding.prototype.setDocument =
- function(document, id) {
- this.document = document;
+ this.changeHandler();
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/core/Application.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/Application.js b/frameworks/js/FlexJS/src/org/apache/flex/core/Application.js
index 84a7c72..b588ac7 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/Application.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/Application.js
@@ -15,102 +15,64 @@
goog.provide('org.apache.flex.core.Application');
goog.require('org.apache.flex.core.HTMLElementWrapper');
-
-goog.require('org.apache.flex.core.SimpleValuesImpl');
-goog.require('org.apache.flex.core.ValuesManager');
-goog.require('org.apache.flex.core.ViewBase');
goog.require('org.apache.flex.utils.MXMLDataInterpreter');
+
+
/**
* @constructor
* @extends {org.apache.flex.core.HTMLElementWrapper}
*/
org.apache.flex.core.Application = function() {
- org.apache.flex.core.HTMLElementWrapper.call(this);
-
- /**
- * @private
- * @type {Array.<Object>}
- */
- this.queuedListeners_;
-
+ goog.base(this);
};
goog.inherits(org.apache.flex.core.Application,
org.apache.flex.core.HTMLElementWrapper);
+
/**
* @expose
* @type {Object}
*/
org.apache.flex.core.Application.prototype.controller = null;
+
/**
* @expose
* @type {org.apache.flex.core.ViewBase}
*/
org.apache.flex.core.Application.prototype.initialView = null;
+
/**
* @expose
* @type {org.apache.flex.events.EventDispatcher}
*/
org.apache.flex.core.Application.prototype.model = null;
+
/**
* @expose
* @type {org.apache.flex.core.SimpleValuesImpl}
*/
org.apache.flex.core.Application.prototype.valuesImpl = null;
-/**
- * @this {org.apache.flex.core.Application}
- * @param {string} t The event type.
- * @param {function(?): ?} fn The event handler.
- */
-org.apache.flex.core.Application.prototype.addEventListener = function(t, fn) {
- if (!this.element) {
- if (!this.queuedListeners_) {
- this.queuedListeners_ = [];
- }
-
- this.queuedListeners_.push({ type: t, handler: fn });
-
- return;
- }
-
- goog.base(this, 'addEventListener', t, fn);
-};
/**
* @expose
* @this {org.apache.flex.core.Application}
*/
org.apache.flex.core.Application.prototype.start = function() {
- var evt, i, n, q;
-
- this.element = document.getElementsByTagName('body')[0];
-
- if (this.queuedListeners_) {
- n = this.queuedListeners_.length;
- for (i = 0; i < n; i++) {
- q = this.queuedListeners_[i];
-
- this.addEventListener(q.type, q.handler);
- }
- }
-
- org.apache.flex.utils.MXMLDataInterpreter.generateMXMLProperties(this,
- this.get_MXMLProperties());
+ this.element = document.getElementsByTagName('body')[0];
- org.apache.flex.core.ValuesManager.valuesImpl = this.valuesImpl;
+ org.apache.flex.utils.MXMLDataInterpreter.generateMXMLProperties(this,
+ this.get_MXMLProperties());
- evt = this.createEvent('initialize');
- this.dispatchEvent(evt);
+ this.dispatchEvent('initialize');
- this.initialView.addToParent(this.element);
- this.initialView.initUI(this.model);
+ this.initialView.addToParent(this.element);
+ this.initialView.initUI(this.model);
- evt = this.createEvent('viewChanged');
- this.dispatchEvent(evt);
+ this.dispatchEvent('viewChanged');
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/core/HTMLElementWrapper.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/HTMLElementWrapper.js b/frameworks/js/FlexJS/src/org/apache/flex/core/HTMLElementWrapper.js
index ec837af..ec52dbc 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/HTMLElementWrapper.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/HTMLElementWrapper.js
@@ -3,7 +3,7 @@
* 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
+ * 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,
@@ -14,139 +14,137 @@
goog.provide('org.apache.flex.core.HTMLElementWrapper');
-goog.require('org.apache.flex.FlexObject');
goog.require('org.apache.flex.events.EventDispatcher');
-goog.require('org.apache.flex.utils.IE8Utils');
+
+
/**
* @constructor
- * @extends {org.apache.flex.FlexObject}
+ * @extends {org.apache.flex.events.EventDispatcher}
*/
org.apache.flex.core.HTMLElementWrapper = function() {
- org.apache.flex.FlexObject.call(this);
-
- /**
- * @private
- * @type {Array}
- */
- this.strand;
+ goog.base(this);
};
goog.inherits(org.apache.flex.core.HTMLElementWrapper,
- org.apache.flex.FlexObject);
+ org.apache.flex.events.EventDispatcher);
+
/**
- * @this {org.apache.flex.core.HTMLElementWrapper}
- * @param {string} type The event type.
- * @param {function(?): ?} fn The event handler.
+ * @protected
+ * @type {Object}
*/
-org.apache.flex.core.HTMLElementWrapper.prototype.addEventListener =
- function(type, fn) {
- if (this.element.addEventListener) {
- this.element.addEventListener(type, fn);
- }
- else if (this.element.attachEvent || !this.element.dispatchEvent) {
- org.apache.flex.utils.IE8Utils.addEventListener(this, this.element, type, fn);
- }
-};
+org.apache.flex.core.HTMLElementWrapper.prototype.element = null;
+
/**
- * @this {org.apache.flex.core.HTMLElementWrapper}
- * @param {org.apache.flex.events.Event} evt The event.
+ * @protected
+ * @type {Object}
*/
-org.apache.flex.core.HTMLElementWrapper.prototype.dispatchEvent =
- function(evt) {
- if (this.element.addEventListener)
- {
- try {
- this.element.dispatchEvent(evt);
- } catch (e) {
- var domevt = this.createEvent(evt.type);
- this.element.dispatchEvent(domevt);
- }
- }
- else if (this.element.attachEvent || !this.element.dispatchEvent)
- org.apache.flex.utils.IE8Utils.dispatchEvent(this, this.element, evt)
-};
+org.apache.flex.core.HTMLElementWrapper.prototype.strand = null;
+
/**
+ * @expose
* @this {org.apache.flex.core.HTMLElementWrapper}
- * @param {string} type The event type.
+ * @param {Object} bead The new bead.
*/
-org.apache.flex.core.HTMLElementWrapper.prototype.createEvent =
- function(type) {
- return org.apache.flex.events.EventDispatcher.createEvent(type);
+org.apache.flex.core.HTMLElementWrapper.prototype.addBead = function(bead) {
+ if (!this.strand) {
+ this.strand = [];
+ }
+
+ this.strand.push(bead);
+
+ if (typeof bead.constructor.$implements !== 'undefined' &&
+ typeof bead.constructor.$implements.IBeadModel !== 'undefined') {
+ this.model = bead;
+ }
+
+ bead.set_strand(this);
};
+
/**
* @expose
* @this {org.apache.flex.core.HTMLElementWrapper}
- * @param {object} bead The new bead.
+ * @param {Object} classOrInterface The requested bead type.
+ * @return {Object} The bead.
*/
-org.apache.flex.core.HTMLElementWrapper.prototype.addBead = function(bead) {
- if (!this.strand)
- this.strand = [];
- this.strand.push(bead);
- if (typeof(bead.constructor.$implements) != 'undefined' &&
- typeof(bead.constructor.$implements.IBeadModel != 'undefined'))
- this.model = bead;
- bead.set_strand(this);
+org.apache.flex.core.HTMLElementWrapper.prototype.getBeadByType =
+ function(classOrInterface) {
+ var bead, i, n;
+
+ n = this.strand.length;
+ for (i = 0; i < n; i++) {
+ bead = this.strand[i];
+
+ if (bead instanceof classOrInterface) {
+ return bead;
+ }
+
+ if (bead.constructor.$implements.hasOwnProperty(classOrInterface)) {
+ return bead;
+ }
+ }
+
+ return null;
};
+
/**
* @expose
* @this {org.apache.flex.core.HTMLElementWrapper}
- * @param {object} classOrInterface The requested bead type.
- * @return {object} The bead.
+ * @return {Array} The array of descriptors.
*/
-org.apache.flex.core.HTMLElementWrapper.prototype.getBeadByType =
- function(classOrInterface) {
- var n;
- n = this.strand.length;
- for (var i = 0; i < n; i++)
- {
- var bead = strand[i];
- if (bead instanceof classOrInterface)
- return bead;
- if (classOrInterface in bead.constructor.$implements)
- return bead;
- }
- return null;
+org.apache.flex.core.HTMLElementWrapper.prototype.get_MXMLDescriptor =
+ function() {
+ return null;
};
+
/**
* @expose
* @this {org.apache.flex.core.HTMLElementWrapper}
- * @param {object} bead The bead to remove.
- * @return {object} The bead.
+ * @return {Array} The array of properties.
*/
-org.apache.flex.core.HTMLElementWrapper.prototype.removeBead = function(bead) {
- var n = this.strand.length;
- for (var i = 0; i < n; i++)
- {
- var bead = strand[i];
- if (bead == value)
- {
- this.strand.splice(i, 1);
- return bead;
- }
- }
- return null;
+org.apache.flex.core.HTMLElementWrapper.prototype.get_MXMLProperties =
+ function() {
+ return null;
};
+
/**
* @expose
* @this {org.apache.flex.core.HTMLElementWrapper}
- * @return {Array} The array of descriptors.
+ * @param {Object} bead The bead to remove.
+ * @return {Object} The bead.
*/
-org.apache.flex.core.HTMLElementWrapper.prototype.get_MXMLDescriptor = function() {
- return null;
+org.apache.flex.core.HTMLElementWrapper.prototype.removeBead = function(bead) {
+ var i, n, value;
+
+ n = this.strand.length;
+ for (i = 0; i < n; i++) {
+ value = this.strand[i];
+
+ if (bead === value) {
+ this.strand.splice(i, 1);
+
+ return bead;
+ }
+ }
+
+ return null;
};
+
/**
* @expose
* @this {org.apache.flex.core.HTMLElementWrapper}
- * @return {Array} The array of properties.
+ * @param {Object} value The new strand.
*/
-org.apache.flex.core.HTMLElementWrapper.prototype.get_MXMLProperties = function() {
- return null;
+org.apache.flex.core.HTMLElementWrapper.prototype.set_strand =
+ function(value) {
+ if (this.strand !== value) {
+ this.strand = value;
+ }
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/core/IDocument.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/IDocument.js b/frameworks/js/FlexJS/src/org/apache/flex/core/IDocument.js
deleted file mode 100644
index fb8d955..0000000
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/IDocument.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * 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.core.IDocument');
-
-goog.require('org.apache.flex.FlexObject');
-
-/**
- * @constructor
- * @extends {org.apache.flex.FlexObject}
- */
-org.apache.flex.core.IDocument = function() {
- org.apache.flex.FlexObject.call(this);
-};
-goog.inherits(
- org.apache.flex.core.IDocument, org.apache.flex.FlexObject
-);
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/core/ListBase.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/ListBase.js b/frameworks/js/FlexJS/src/org/apache/flex/core/ListBase.js
new file mode 100644
index 0000000..810944f
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/ListBase.js
@@ -0,0 +1,185 @@
+/**
+ * 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.core.ListBase');
+
+goog.require('org.apache.flex.core.UIBase');
+
+
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.core.UIBase}
+ */
+org.apache.flex.core.ListBase = function() {
+ goog.base(this);
+
+ /**
+ * @protected
+ * @type {Array.<Object>}
+ */
+ this.dataProvider_;
+
+ /**
+ * @private
+ * @type {number}
+ */
+ this.selectedIndex_ = -1;
+};
+goog.inherits(org.apache.flex.core.ListBase,
+ org.apache.flex.core.UIBase);
+
+
+/**
+ * @override
+ * @this {org.apache.flex.core.ListBase}
+ * @param {Object} p The parent element.
+ */
+org.apache.flex.core.ListBase.prototype.addToParent = function(p) {
+ this.element = document.createElement('select');
+ goog.events.listen(this.element, 'change',
+ goog.bind(this.changeHandler, this));
+
+ p.appendChild(this.element);
+
+ this.positioner = this.element;
+};
+
+
+/**
+ * @expose
+ * @this {org.apache.flex.core.ListBase}
+ * @return {Array.<Object>} The collection of data.
+ */
+org.apache.flex.core.ListBase.prototype.get_dataProvider =
+ function() {
+ return this.dataProvider_;
+};
+
+
+/**
+ * @expose
+ * @this {org.apache.flex.core.ListBase}
+ * @param {Array.<Object>} value The text setter.
+ */
+org.apache.flex.core.ListBase.prototype.set_dataProvider =
+ function(value) {
+ var dp, i, n, opt;
+
+ this.dataProvider_ = value;
+
+ dp = this.element.options;
+ n = dp.length;
+ for (i = 0; i < n; i++) {
+ dp.remove(0);
+ }
+
+ n = value.length;
+ for (i = 0; i < n; i++) {
+ opt = document.createElement('option');
+ opt.text = value[i];
+ dp.add(opt);
+ }
+};
+
+
+/**
+ * @expose
+ * @this {org.apache.flex.core.ListBase}
+ * @return {number} The selected index.
+ */
+org.apache.flex.core.ListBase.prototype.get_selectedIndex =
+ function() {
+ if (typeof this.element.selectedIndex !== 'undefined') {
+ return this.element.selectedIndex;
+ } else {
+ return this.selectedIndex_;
+ }
+};
+
+
+/**
+ * @expose
+ * @this {org.apache.flex.core.ListBase}
+ * @param {number} value The selected index.
+ */
+org.apache.flex.core.ListBase.prototype.set_selectedIndex =
+ function(value) {
+ this.selectedIndex_ = value;
+
+ if (this.element.selectedIndex) {
+ this.element.selectedIndex = value;
+ }
+};
+
+
+/**
+ * @expose
+ * @this {org.apache.flex.core.ListBase}
+ * @return {Object} The selected item.
+ */
+org.apache.flex.core.ListBase.prototype.get_selectedItem =
+ function() {
+ var si;
+
+ si = this.get_selectedIndex();
+
+ if (!this.dataProvider_ || si < 0 ||
+ si >= this.dataProvider_.length) {
+ return null;
+ }
+
+ return this.dataProvider_[si];
+};
+
+
+/**
+ * @expose
+ * @this {org.apache.flex.core.ListBase}
+ * @param {Object} value The selected item.
+ */
+org.apache.flex.core.ListBase.prototype.set_selectedItem =
+ function(value) {
+ var dp, i, n;
+
+ dp = this.dataProvider_;
+ n = dp.length;
+ for (i = 0; i < n; i++) {
+ if (dp[i] === value) {
+ break;
+ }
+ }
+
+ if (i < n) {
+ this.selectedIndex_ = i;
+
+ if (this.element.selectedIndex) {
+ this.element.selectedIndex = i;
+ }
+
+ if (this.element.childNodes) {
+ this.element.childNodes.item(0).value = dp[i];
+ }
+ }
+};
+
+
+/**
+ * @protected
+ * @this {org.apache.flex.core.ListBase}
+ */
+org.apache.flex.core.ListBase.prototype.changeHandler =
+ function() {
+ this.dispatchEvent('change');
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleCSSValuesImpl.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleCSSValuesImpl.js b/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleCSSValuesImpl.js
index b997538..a54a50f 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleCSSValuesImpl.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleCSSValuesImpl.js
@@ -14,15 +14,10 @@
goog.provide('org.apache.flex.core.SimpleCSSValuesImpl');
-goog.require('org.apache.flex.FlexObject');
+
/**
* @constructor
- * @extends {org.apache.flex.FlexObject}
*/
org.apache.flex.core.SimpleCSSValuesImpl = function() {
- org.apache.flex.FlexObject.call(this);
};
-goog.inherits(
- org.apache.flex.core.SimpleCSSValuesImpl, org.apache.flex.FlexObject
-);
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleValuesImpl.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleValuesImpl.js b/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleValuesImpl.js
index bf17d95..84ffc8e 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleValuesImpl.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleValuesImpl.js
@@ -14,15 +14,10 @@
goog.provide('org.apache.flex.core.SimpleValuesImpl');
-goog.require('org.apache.flex.FlexObject');
+
/**
* @constructor
- * @extends {org.apache.flex.FlexObject}
*/
org.apache.flex.core.SimpleValuesImpl = function() {
- org.apache.flex.FlexObject.call(this);
};
-goog.inherits(
- org.apache.flex.core.SimpleValuesImpl, org.apache.flex.FlexObject
-);
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/core/UIBase.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/UIBase.js b/frameworks/js/FlexJS/src/org/apache/flex/core/UIBase.js
index dedbb0d..aaad59a 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/UIBase.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/UIBase.js
@@ -14,104 +14,111 @@
goog.provide('org.apache.flex.core.UIBase');
-goog.require('org.apache.flex.FlexGlobal');
goog.require('org.apache.flex.core.HTMLElementWrapper');
+
+
/**
* @constructor
* @extends {org.apache.flex.core.HTMLElementWrapper}
*/
org.apache.flex.core.UIBase = function() {
- org.apache.flex.core.HTMLElementWrapper.call(this);
-
- /**
- * @protected
- * @type {Object}
- */
- this.positioner;
+ goog.base(this);
+ /**
+ * @protected
+ * @type {Object}
+ */
+ this.positioner;
};
goog.inherits(org.apache.flex.core.UIBase,
org.apache.flex.core.HTMLElementWrapper);
+
/**
* @this {org.apache.flex.core.UIBase}
* @param {Object} p The parent element.
*/
org.apache.flex.core.UIBase.prototype.addToParent = function(p) {
- this.element = document.createElement('div');
+ this.element = document.createElement('div');
- p.appendChild(this.element);
+ p.appendChild(this.element);
};
+
/**
* @expose
* @this {org.apache.flex.core.UIBase}
* @param {number} pixels The pixel count from the left edge.
*/
org.apache.flex.core.UIBase.prototype.set_x = function(pixels) {
- this.positioner.style.position = 'absolute';
- this.positioner.style.left = pixels.toString() + 'px';
+ this.positioner.style.position = 'absolute';
+ this.positioner.style.left = pixels.toString() + 'px';
};
+
/**
* @expose
* @this {org.apache.flex.core.UIBase}
* @param {number} pixels The pixel count from the top edge.
*/
org.apache.flex.core.UIBase.prototype.set_y = function(pixels) {
- this.positioner.style.position = 'absolute';
- this.positioner.style.top = pixels.toString() + 'px';
+ this.positioner.style.position = 'absolute';
+ this.positioner.style.top = pixels.toString() + 'px';
};
+
/**
* @expose
* @this {org.apache.flex.core.UIBase}
* @param {number} pixels The pixel count from the left edge.
*/
org.apache.flex.core.UIBase.prototype.set_width = function(pixels) {
- this.positioner.style.width = pixels.toString() + 'px';
+ this.positioner.style.width = pixels.toString() + 'px';
};
+
/**
* @expose
* @this {org.apache.flex.core.UIBase}
* @param {number} pixels The pixel count from the top edge.
*/
org.apache.flex.core.UIBase.prototype.set_height = function(pixels) {
- this.positioner.style.height = pixels.toString() + 'px';
+ this.positioner.style.height = pixels.toString() + 'px';
};
+
/**
* @expose
* @type {string}
*/
org.apache.flex.core.UIBase.prototype.id;
+
/**
* @expose
* @this {org.apache.flex.core.UIBase}
* @return {string} The id.
*/
org.apache.flex.core.UIBase.prototype.get_id = function() {
- return this.id;
+ return this.id;
};
+
/**
* @expose
* @this {org.apache.flex.core.UIBase}
- * @param {object} value The new id.
+ * @param {Object} value The new id.
*/
org.apache.flex.core.UIBase.prototype.set_id = function(value) {
- if (this.id != value)
- {
- this.element.id = value;
- this.id = value;
- var evt = this.createEvent('idChanged');
- this.dispatchEvent(evt);
- }
+ if (this.id !== value) {
+ this.element.id = value;
+ this.id = value;
+ this.dispatchEvent('idChanged');
+ }
};
+
/**
* @expose
* @type {string}
@@ -148,25 +155,26 @@ org.apache.flex.core.UIBase.prototype.set_className = function(value) {
*/
org.apache.flex.core.UIBase.prototype.model;
+
/**
* @expose
* @this {org.apache.flex.core.UIBase}
- * @return {object} The model.
+ * @return {Object} The model.
*/
org.apache.flex.core.UIBase.prototype.get_model = function() {
- return this.model;
+ return this.model;
};
+
/**
* @expose
* @this {org.apache.flex.core.UIBase}
- * @param {object} value The new model.
+ * @param {Object} value The new model.
*/
org.apache.flex.core.UIBase.prototype.set_model = function(value) {
- if (this.model != value)
- {
- this.addBead(value);
- this.dispatchEvent(new Event('modelChanged'));
- }
+ if (this.model !== value) {
+ this.addBead(value);
+ this.dispatchEvent('modelChanged');
+ }
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/core/ValuesManager.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/ValuesManager.js b/frameworks/js/FlexJS/src/org/apache/flex/core/ValuesManager.js
index 2a083d6..754d210 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/ValuesManager.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/ValuesManager.js
@@ -14,19 +14,17 @@
goog.provide('org.apache.flex.core.ValuesManager');
-goog.require('org.apache.flex.FlexObject');
+
/**
* @constructor
- * @extends {org.apache.flex.FlexObject}
*/
org.apache.flex.core.ValuesManager = function() {
- org.apache.flex.FlexObject.call(this);
};
-goog.inherits(org.apache.flex.core.ValuesManager, org.apache.flex.FlexObject);
+
/**
* @expose
- * @type {org.apache.flex.core.SimpleValuesImpl}
+ * @type {org.apache.flex.core.ValuesManager}
*/
org.apache.flex.core.ValuesManager.prototype.valuesImpl;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/core/ViewBase.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/ViewBase.js b/frameworks/js/FlexJS/src/org/apache/flex/core/ViewBase.js
index f0c4ade..b8f4729 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/ViewBase.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/ViewBase.js
@@ -14,53 +14,52 @@
goog.provide('org.apache.flex.core.ViewBase');
-goog.require('org.apache.flex.FlexGlobal');
-
goog.require('org.apache.flex.core.UIBase');
-
goog.require('org.apache.flex.utils.MXMLDataInterpreter');
+
+
/**
* @constructor
* @extends {org.apache.flex.core.UIBase}
*/
org.apache.flex.core.ViewBase = function() {
- org.apache.flex.core.UIBase.call(this);
-
- /**
- * @private
- * @type {org.apache.flex.core.ViewBase}
- */
- this.currentObject_;
+ goog.base(this);
};
goog.inherits(org.apache.flex.core.ViewBase, org.apache.flex.core.UIBase);
+
/**
* @expose
* @type {Object}
*/
org.apache.flex.core.ViewBase.prototype.applicationModel;
+
/**
* @expose
* @type {Array}
*/
org.apache.flex.core.ViewBase.prototype.MXMLProperties;
+
/**
* @expose
* @type {Array}
*/
org.apache.flex.core.ViewBase.prototype.MXMLDescriptor;
+
/**
* @this {org.apache.flex.core.ViewBase}
* @param {Object} model The model for this view.
*/
org.apache.flex.core.ViewBase.prototype.initUI = function(model) {
- this.applicationModel = model;
- org.apache.flex.utils.MXMLDataInterpreter.generateMXMLProperties(this,
- this.get_MXMLProperties());
- org.apache.flex.utils.MXMLDataInterpreter.generateMXMLInstances(this,
- this, this.get_MXMLDescriptor());
+ this.applicationModel = model;
+
+ org.apache.flex.utils.MXMLDataInterpreter.generateMXMLProperties(this,
+ this.get_MXMLProperties());
+
+ org.apache.flex.utils.MXMLDataInterpreter.generateMXMLInstances(this,
+ this, this.get_MXMLDescriptor());
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/events/CustomEvent.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/events/CustomEvent.js b/frameworks/js/FlexJS/src/org/apache/flex/events/CustomEvent.js
index a218459..b1a05ef 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/events/CustomEvent.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/events/CustomEvent.js
@@ -14,23 +14,36 @@
goog.provide('org.apache.flex.events.CustomEvent');
+goog.require('goog.events.Event');
+
+
+
/**
* @constructor
+ * @extends {goog.events.Event}
+ * @param {string} type The event type.
*/
org.apache.flex.events.CustomEvent = function(type) {
- this.type = type;
+ goog.base(this);
+
+ this.type = type;
};
+goog.inherits(org.apache.flex.events.CustomEvent,
+ goog.events.Event);
+
/**
+ * @expose
* @this {org.apache.flex.events.CustomEvent}
* @param {string} type The event type.
*/
org.apache.flex.events.CustomEvent.prototype.init = function(type) {
- this.type_ = type;
+ this.type = type;
};
+
/**
- * @expose
+ * @expose
* @type {string} type The event type.
*/
org.apache.flex.events.CustomEvent.prototype.type;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/events/Event.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/events/Event.js b/frameworks/js/FlexJS/src/org/apache/flex/events/Event.js
index 3c0e20c..51752cc 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/events/Event.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/events/Event.js
@@ -14,24 +14,36 @@
goog.provide('org.apache.flex.events.Event');
+goog.require('goog.events.Event');
+
+
+
/**
* @constructor
+ * @extends {goog.events.Event}
+ * @param {string} type The event type.
*/
org.apache.flex.events.Event = function(type) {
- this.type = type;
+ goog.base(this, type);
+
+ this.type = type;
};
+goog.inherits(org.apache.flex.events.Event,
+ goog.events.Event);
+
/**
+ * @expose
* @this {org.apache.flex.events.Event}
* @param {string} type The event type.
*/
org.apache.flex.events.Event.prototype.init = function(type) {
- this.type = type;
+ this.type = type;
};
+
/**
- * @expose
+ * @expose
* @type {string} type The event type.
*/
-org.apache.flex.events.Event.prototype.type;
-
+org.apache.flex.events.CustomEvent.prototype.type;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/events/EventDispatcher.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/events/EventDispatcher.js b/frameworks/js/FlexJS/src/org/apache/flex/events/EventDispatcher.js
index fb479f3..f9d1aef 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/events/EventDispatcher.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/events/EventDispatcher.js
@@ -14,96 +14,44 @@
goog.provide('org.apache.flex.events.EventDispatcher');
-goog.require('org.apache.flex.FlexGlobal');
+goog.require('goog.events.EventTarget');
+
+
/**
* @constructor
- * @extends {org.apache.flex.FlexGlobal}
+ * @extends {goog.events.EventTarget}
*/
org.apache.flex.events.EventDispatcher = function() {
- org.apache.flex.FlexGlobal.call(this);
+ goog.base(this);
- /**
- * @private
- * @type {Object}
- */
- this.listeners_ = {};
};
goog.inherits(org.apache.flex.events.EventDispatcher,
- org.apache.flex.FlexGlobal);
-
-/**
- * @expose
- * @this {org.apache.flex.events.EventDispatcher}
- * @param {string} type The event type.
- * @param {function(?): ?} fn The event handler.
- */
-org.apache.flex.events.EventDispatcher.prototype.addEventListener = function(type, fn) {
- if (!this.listeners_.type) {
- this.listeners_[type] = [];
- }
+ goog.events.EventTarget);
- this.listeners_[type].push(fn);
-};
/**
+ * @override
* @expose
* @this {org.apache.flex.events.EventDispatcher}
* @param {string} type The event type.
* @param {function(?): ?} fn The event handler.
*/
-org.apache.flex.events.EventDispatcher.prototype.removeEventListener = function(type, fn) {
- if (!this.listeners_.type) {
- return;
- }
-
- var listeners = this.listeners_[type];
- var n = listeners.length;
- for (var i = 0; i < n; i++)
- {
- if (fn == listeners[i])
- {
- listeners.splice(i, 1);
- break;
- }
- }
-};
-
-/**
- * @expose
- * @this {org.apache.flex.events.EventDispatcher}
- * @param {Object} event The event to dispatch.
- */
-org.apache.flex.events.EventDispatcher.prototype.dispatchEvent = function(event) {
- var arr, i, n, type;
-
- type = event.type;
-
- if (this.listeners_[type]) {
- arr = this.listeners_[type];
- n = arr.length;
- for (i = 0; i < n; i++) {
- arr[i](event);
- }
- }
-};
-
-/**
- * @expose
- * @param {String} type The event type.
- * @returns {Object} event The event to dispatch.
- */
-org.apache.flex.events.EventDispatcher.createEvent = function(type) {
- var evt;
- if (document.createEvent)
- {
- evt = document.createEvent('Event');
- evt.initEvent(type, false, false);
- }
- else if (document.createEventObject)
- {
- evt = document.createEventObject();
- evt.type = type;
- }
- return evt;
+org.apache.flex.events.EventDispatcher.prototype.addEventListener =
+ function(type, fn) {
+ var source;
+
+ /**
+ * A bit of a hack, but for 'native' HTML element based controls, we
+ * want to listen to the 'native' events from the element; for other
+ * types of controls, we listen to 'custom' events.
+ */
+ source = this;
+ if (this.element && this.element.nodeName &&
+ this.element.nodeName.toLowerCase() !== 'div' &&
+ this.element.nodeName.toLowerCase() !== 'body') {
+ source = this.element;
+ }
+
+ goog.events.listen(source, type, fn);
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/CheckBox.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/CheckBox.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/CheckBox.js
index 1743d7c..e31ad1d 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/CheckBox.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/CheckBox.js
@@ -16,70 +16,79 @@ goog.provide('org.apache.flex.html.staticControls.CheckBox');
goog.require('org.apache.flex.core.UIBase');
-var cbCount = 0;
+
/**
* @constructor
* @extends {org.apache.flex.core.UIBase}
*/
org.apache.flex.html.staticControls.CheckBox = function() {
- org.apache.flex.core.UIBase.call(this);
+ goog.base(this);
};
-goog.inherits(
- org.apache.flex.html.staticControls.CheckBox, org.apache.flex.core.UIBase
-);
+goog.inherits(org.apache.flex.html.staticControls.CheckBox,
+ org.apache.flex.core.UIBase);
+
/**
* @override
* @this {org.apache.flex.html.staticControls.CheckBox}
* @param {Object} p The parent element.
*/
-org.apache.flex.html.staticControls.CheckBox.prototype.addToParent =
+org.apache.flex.html.staticControls.CheckBox.prototype.addToParent =
function(p) {
- this.element = document.createElement('label');
-
- var cb = document.createElement('input');
- cb.type = 'checkbox';
- this.element.appendChild(cb);
- this.element.appendChild(document.createTextNode("check box"));
-
- p.appendChild(this.element);
-
- this.positioner = this.element;
+ var cb;
+
+ this.element = document.createElement('label');
+
+ cb = document.createElement('input');
+ cb.type = 'checkbox';
+ this.element.appendChild(cb);
+ this.element.appendChild(document.createTextNode('check box'));
+
+ p.appendChild(this.element);
+
+ this.positioner = this.element;
};
+
/**
* @expose
* @this {org.apache.flex.html.staticControls.CheckBox}
* @return {string} The text getter.
*/
org.apache.flex.html.staticControls.CheckBox.prototype.get_text = function() {
- return this.element.childNodes.item(1).nodeValue;
+ return this.element.childNodes.item(1).nodeValue;
};
+
/**
* @expose
* @this {org.apache.flex.html.staticControls.CheckBox}
* @param {string} value The text setter.
*/
-org.apache.flex.html.staticControls.CheckBox.prototype.set_text = function(value) {
- this.element.childNodes.item(1).nodeValue = value;
+org.apache.flex.html.staticControls.CheckBox.prototype.set_text =
+ function(value) {
+ this.element.childNodes.item(1).nodeValue = value;
};
+
/**
* @expose
* @this {org.apache.flex.html.staticControls.CheckBox}
* @return {bool} The selected getter.
*/
-org.apache.flex.html.staticControls.CheckBox.prototype.get_selected = function() {
- return this.element.childNodes.item(0).checked;
+org.apache.flex.html.staticControls.CheckBox.prototype.get_selected =
+ function() {
+ return this.element.childNodes.item(0).checked;
};
+
/**
* @expose
* @this {org.apache.flex.html.staticControls.CheckBox}
* @param {bool} value The selected setter.
*/
-org.apache.flex.html.staticControls.CheckBox.prototype.set_selected = function(value) {
- this.element.childNodes.item(0).checked = value;
+org.apache.flex.html.staticControls.CheckBox.prototype.set_selected =
+ function(value) {
+ this.element.childNodes.item(0).checked = value;
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/ComboBox.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/ComboBox.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/ComboBox.js
index 6a5472c..953c858 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/ComboBox.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/ComboBox.js
@@ -14,26 +14,19 @@
goog.provide('org.apache.flex.html.staticControls.ComboBox');
-goog.require('org.apache.flex.core.UIBase');
+goog.require('org.apache.flex.core.ListBase');
+
/**
* @constructor
- * @extends {org.apache.flex.core.UIBase}
+ * @extends {org.apache.flex.core.ListBase}
*/
org.apache.flex.html.staticControls.ComboBox = function() {
- org.apache.flex.core.UIBase.call(this);
-
- /**
- * @private
- * @type {Array.<Object>}
- */
- this._dataProvider;
- this._selectedIndex = -1;
+ goog.base(this);
};
-goog.inherits(
- org.apache.flex.html.staticControls.ComboBox, org.apache.flex.core.UIBase
-);
+goog.inherits(org.apache.flex.html.staticControls.ComboBox,
+ org.apache.flex.core.ListBase);
/**
@@ -41,220 +34,170 @@ goog.inherits(
* @this {org.apache.flex.html.staticControls.ComboBox}
* @param {Object} p The parent element.
*/
-org.apache.flex.html.staticControls.ComboBox.prototype.addToParent =
-function(p) {
- this.element = document.createElement('div');
-
- var input = document.createElement('input');
- input.style.position = "absolute";
- input.style.width = "80px";
- this.element.appendChild(input);
-
- var button = document.createElement('div');
- button.style.position = "absolute";
- button.style.top = "0px";
- button.style.right = "0px";
- button.style.background = "#bbb";
- button.style.width = "16px";
- button.style.height = "20px";
- button.style.margin = "0";
- button.style.border = "solid #609 1px";
- button.onclick = org.apache.flex.FlexGlobal.createProxy(
- this, this.buttonClicked);
- this.element.appendChild(button);
-
- this.element.style.position = "relative";
-
- p.appendChild(this.element);
-
- this.positioner = this.element;
-
- // add a click handler to p's parentElement so that a click
- // outside of the combo box can dismiss the pop-up should it
- // be visible
- p.parentElement.onclick = org.apache.flex.FlexGlobal.createProxy(
- this, this.dismissPopup);
+org.apache.flex.html.staticControls.ComboBox.prototype.addToParent =
+ function(p) {
+ var button, input;
+
+ this.element = document.createElement('div');
+
+ input = document.createElement('input');
+ input.style.position = 'absolute';
+ input.style.width = '80px';
+ this.element.appendChild(input);
+
+ button = document.createElement('div');
+ button.style.position = 'absolute';
+ button.style.top = '0px';
+ button.style.right = '0px';
+ button.style.background = '#bbb';
+ button.style.width = '16px';
+ button.style.height = '20px';
+ button.style.margin = '0';
+ button.style.border = 'solid #609 1px';
+ goog.events.listen(button, 'click', goog.bind(this.buttonClicked, this));
+ this.element.appendChild(button);
+
+ this.element.style.position = 'relative';
+
+ p.appendChild(this.element);
+
+ this.positioner = this.element;
+
+ // add a click handler to p's parentElement so that a click
+ // outside of the combo box can dismiss the pop-up should it
+ // be visible
+ goog.events.listen(p.parentElement, 'click',
+ goog.bind(this.dismissPopup, this));
};
+
/**
* @expose
* @this {org.apache.flex.html.staticControls.ComboBox}
+ * @param {string} event The event.
*/
org.apache.flex.html.staticControls.ComboBox.prototype.selectChanged =
-function(event) {
- var select = event.currentTarget;
-// var input = this.element.childNodes.item(0);
-// input.value = select.value;
- this.set_selectedItem(select.value);
-
- this.popup.parentNode.removeChild(this.popup);
- this.popup = null;
-
- evt = this.createEvent('change');
- this.dispatchEvent(evt);
-};
+ function(event) {
+ var select;
+ select = event.currentTarget;
-/**
- * @expose
- * @this {org.apache.flex.html.staticControls.ComboBox}
- */
-org.apache.flex.html.staticControls.ComboBox.prototype.dismissPopup =
-function(event) {
+ this.set_selectedItem(select.options[select.selectedIndex].value);
- // remove the popup if it already exists
- if( this.popup ) {
- this.popup.parentNode.removeChild(this.popup);
- this.popup = null;
- }
-};
-
-/**
- * @expose
- * @this {org.apache.flex.html.staticControls.ComboBox}
- */
-org.apache.flex.html.staticControls.ComboBox.prototype.buttonClicked =
-function(event) {
-
- event.stopPropagation();
-
- // remove the popup if it already exists
- if( this.popup ) {
- this.popup.parentNode.removeChild(this.popup);
- this.popup = null;
- return;
- }
-
- var input = this.element.childNodes.item(0);
-
- var pn = this.element;
- var top = pn.offsetTop + input.offsetHeight;
- var left = pn.offsetLeft;
- var width = pn.offsetWidth;
-
- var popup = document.createElement('div');
- popup.className = 'popup';
- popup.id = 'test';
- popup.style.position = "absolute";
- popup.style.top = top.toString() + "px";
- popup.style.left = left.toString() + "px";
- popup.style.width = width.toString() + "px";
- popup.style.margin = "0px auto";
- popup.style.padding = "0px";
- popup.style.zIndex = "10000";
-
- var select = document.createElement('select');
- select.style.width = width.toString() + "px";
- select.onchange = org.apache.flex.FlexGlobal.createProxy(
- this, this.selectChanged);
- var opts = select.options;
-
- var dp = this._dataProvider;
- var n = dp.length;
- for (i = 0; i < n; i++)
- {
- var opt = document.createElement('option');
- opt.text = dp[i];
- opts.add(opt);
- }
- select.size = n;
- if( this._selectedIndex < 0 ) select.value = null;
- else select.value = this._dataProvider[this._selectedIndex];
-
- this.popup = popup;
-
- popup.appendChild(select);
- document.body.appendChild(popup);
-
+ this.popup.parentNode.removeChild(this.popup);
+ this.popup = null;
+ this.dispatchEvent(event);
};
-/**
- * @expose
- * @this {org.apache.flex.html.staticControls.ComboBox}
- * @return {Array.<Object>} The collection of data.
- */
-org.apache.flex.html.staticControls.ComboBox.prototype.get_dataProvider =
-function() {
- return this._dataProvider;
-};
/**
* @expose
* @this {org.apache.flex.html.staticControls.ComboBox}
- * @param {Array.<Object>} value The text setter.
+ * @param {string} event The event.
*/
-org.apache.flex.html.staticControls.ComboBox.prototype.set_dataProvider =
-function(value) {
- this._dataProvider = value;
+org.apache.flex.html.staticControls.ComboBox.prototype.dismissPopup =
+ function(event) {
+ // remove the popup if it already exists
+ if (this.popup) {
+ this.popup.parentNode.removeChild(this.popup);
+ this.popup = null;
+ }
};
-/**
- * @expose
- * @this {org.apache.flex.html.staticControls.ComboBox}
- * @return {int} The selected index.
- */
-org.apache.flex.html.staticControls.ComboBox.prototype.get_selectedIndex =
-function() {
- return this._selectedIndex;
-};
/**
* @expose
* @this {org.apache.flex.html.staticControls.ComboBox}
- * @param {int} value The selected index.
+ * @param {string} event The event.
*/
-org.apache.flex.html.staticControls.ComboBox.prototype.set_selectedIndex =
-function(value) {
- this._selectedIndex = value;
+org.apache.flex.html.staticControls.ComboBox.prototype.buttonClicked =
+ function(event) {
+ var dp, i, input, left, n, opt, opts, pn, popup, select, si, top, width;
+
+ event.stopPropagation();
+
+ if (this.popup) {
+ this.dismissPopup();
+
+ return;
+ }
+
+ input = this.element.childNodes.item(0);
+
+ pn = this.element;
+ top = pn.offsetTop + input.offsetHeight;
+ left = pn.offsetLeft;
+ width = pn.offsetWidth;
+
+ popup = document.createElement('div');
+ popup.className = 'popup';
+ popup.id = 'test';
+ popup.style.position = 'absolute';
+ popup.style.top = top.toString() + 'px';
+ popup.style.left = left.toString() + 'px';
+ popup.style.width = width.toString() + 'px';
+ popup.style.margin = '0px auto';
+ popup.style.padding = '0px';
+ popup.style.zIndex = '10000';
+
+ select = document.createElement('select');
+ select.style.width = width.toString() + 'px';
+ goog.events.listen(select, 'change', goog.bind(this.selectChanged, this));
+ opts = select.options;
+
+ dp = this.get_dataProvider();
+ n = dp.length;
+ for (i = 0; i < n; i++) {
+ opt = document.createElement('option');
+ opt.text = dp[i];
+ opts.add(opt);
+ }
+
+ select.size = n;
+
+ si = this.get_selectedIndex();
+ if (si < 0) {
+ select.value = null;
+ } else {
+ select.value = dp[si];
+ }
+
+ this.popup = popup;
+
+ popup.appendChild(select);
+ document.body.appendChild(popup);
};
-/**
- * @expose
- * @this {org.apache.flex.html.staticControls.ComboBox}
- * @return {Object} The selected item.
- */
-org.apache.flex.html.staticControls.ComboBox.prototype.get_selectedItem =
-function() {
- if( this._dataProvider == null || this._selectedIndex < 0 || this._selectedIndex >= this._dataProvider.length ) return null;
- return this._dataProvider[this._selectedIndex];
-};
/**
+ * @override
* @expose
* @this {org.apache.flex.html.staticControls.ComboBox}
- * @param {Object} value The selected item.
+ * @param {Array.<Object>} value The collection of data.
*/
-org.apache.flex.html.staticControls.ComboBox.prototype.set_selectedItem =
-function(value) {
-
- var dp = this._dataProvider;
- var n = dp.length;
- for (var i = 0; i < n; i++)
- {
- if (dp[i] == value)
- break;
- }
- if (i < n) {
- this._selectedIndex = i;
- this.element.childNodes.item(0).value = this._dataProvider[i];
- }
+org.apache.flex.html.staticControls.ComboBox.prototype.set_dataProvider =
+ function(value) {
+ this.dataProvider_ = value;
};
+
/**
* @expose
* @this {org.apache.flex.html.staticControls.ComboBox}
* @return {string} The text getter.
*/
org.apache.flex.html.staticControls.ComboBox.prototype.get_text = function() {
- return this.element.childNodes.item(0).value;
+ return this.element.childNodes.item(0).value;
};
+
/**
* @expose
* @this {org.apache.flex.html.staticControls.ComboBox}
* @param {string} value The text setter.
*/
-org.apache.flex.html.staticControls.ComboBox.prototype.set_text = function(value) {
- this.element.childNodes.item(0).value = value;
+org.apache.flex.html.staticControls.ComboBox.prototype.set_text =
+ function(value) {
+ this.element.childNodes.item(0).value = value;
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/DropDownList.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/DropDownList.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/DropDownList.js
index f6d15e5..e5c9a31 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/DropDownList.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/DropDownList.js
@@ -14,131 +14,16 @@
goog.provide('org.apache.flex.html.staticControls.DropDownList');
-goog.require('org.apache.flex.core.UIBase');
+goog.require('org.apache.flex.core.ListBase');
-/**
- * @constructor
- * @extends {org.apache.flex.core.UIBase}
- */
-org.apache.flex.html.staticControls.DropDownList = function() {
- org.apache.flex.core.UIBase.call(this);
-
- /**
- * @private
- * @type {Array.<Object>}
- */
- this._dataProvider;
-};
-goog.inherits(
- org.apache.flex.html.staticControls.DropDownList, org.apache.flex.core.UIBase
-);
-
-/**
- * @override
- * @this {org.apache.flex.html.staticControls.DropDownList}
- * @param {Object} p The parent element.
- */
-org.apache.flex.html.staticControls.DropDownList.prototype.addToParent = function(p) {
- this.element = document.createElement('select');
- //this.element.onchange = org.apache.flex.FlexGlobal.createProxy(
- // this, this.changeHandler);
-
- p.appendChild(this.element);
-
- this.positioner = this.element;
-};
-
-/**
- * @expose
- * @this {org.apache.flex.html.staticControls.DropDownList}
- * @return {Array.<Object>} The collection of data.
- */
-org.apache.flex.html.staticControls.DropDownList.prototype.get_dataProvider =
-function() {
- return this._dataProvider;
-};
-
-/**
- * @expose
- * @this {org.apache.flex.html.staticControls.DropDownList}
- * @param {Array.<Object>} value The text setter.
- */
-org.apache.flex.html.staticControls.DropDownList.prototype.set_dataProvider =
-function(value) {
- this._dataProvider = value;
-
- var dp = this.element.options;
- var n = dp.length;
- for (var i = 0; i < n; i++)
- dp.remove(0);
-
- n = value.length;
- for (i = 0; i < n; i++)
- {
- var opt = document.createElement('option');
- opt.text = value[i];
- dp.add(opt);
- }
-};
/**
- * @expose
- * @this {org.apache.flex.html.staticControls.DropDownList}
- * @return {int} The selected index.
- */
-org.apache.flex.html.staticControls.DropDownList.prototype.get_selectedIndex =
-function() {
- return this.element.selectedIndex;
-};
-
-/**
- * @expose
- * @this {org.apache.flex.html.staticControls.DropDownList}
- * @param {int} value The selected index.
- */
-org.apache.flex.html.staticControls.DropDownList.prototype.set_selectedIndex =
-function(value) {
- this.element.selectedIndex = value;
-};
-
-/**
- * @expose
- * @this {org.apache.flex.html.staticControls.DropDownList}
- * @return {Object} The selected item.
- */
-org.apache.flex.html.staticControls.DropDownList.prototype.get_selectedItem =
-function() {
- return this._dataProvider[this.element.selectedIndex];
-};
-
-/**
- * @expose
- * @this {org.apache.flex.html.staticControls.DropDownList}
- * @param {Object} value The selected item.
- */
-org.apache.flex.html.staticControls.DropDownList.prototype.set_selectedItem =
-function(value) {
-
- var dp = this._dataProvider;
- var n = dp.length;
- for (var i = 0; i < n; i++)
- {
- if (dp[i] == value)
- break;
- }
- if (i < n)
- this.element.selectedIndex = i;
-};
-
-/**
- * @protected
- * @this {org.apache.flex.html.staticControls.DropDownList}
- * @return {Object} The selected item.
+ * @constructor
+ * @extends {org.apache.flex.core.ListBase}
*/
-org.apache.flex.html.staticControls.DropDownList.prototype.changeHandler =
-function() {
- var evt = this.createEvent('change');
- this.dispatchEvent(evt);
+org.apache.flex.html.staticControls.DropDownList = function() {
+ goog.base(this);
};
-
+goog.inherits(org.apache.flex.html.staticControls.DropDownList,
+ org.apache.flex.core.ListBase);
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Label.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Label.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Label.js
index 48fa9ae..875607a 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Label.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Label.js
@@ -16,16 +16,18 @@ goog.provide('org.apache.flex.html.staticControls.Label');
goog.require('org.apache.flex.core.UIBase');
+
+
/**
* @constructor
* @extends {org.apache.flex.core.UIBase}
*/
org.apache.flex.html.staticControls.Label = function() {
- org.apache.flex.core.UIBase.call(this);
+ goog.base(this);
};
-goog.inherits(
- org.apache.flex.html.staticControls.Label, org.apache.flex.core.UIBase
-);
+goog.inherits(org.apache.flex.html.staticControls.Label,
+ org.apache.flex.core.UIBase);
+
/**
* @override
@@ -33,25 +35,27 @@ goog.inherits(
* @param {Object} p The parent element.
*/
org.apache.flex.html.staticControls.Label.prototype.addToParent = function(p) {
- goog.base(this, 'addToParent', p);
+ goog.base(this, 'addToParent', p);
- this.positioner = this.element;
+ this.positioner = this.element;
};
+
/**
* @expose
* @this {org.apache.flex.html.staticControls.Label}
* @return {string} The text getter.
*/
org.apache.flex.html.staticControls.Label.prototype.get_text = function() {
- return this.element.innerHTML;
+ return this.element.innerHTML;
};
+
/**
* @expose
* @this {org.apache.flex.html.staticControls.Label}
* @param {string} value The text setter.
*/
org.apache.flex.html.staticControls.Label.prototype.set_text = function(value) {
- this.element.innerHTML = value;
+ this.element.innerHTML = value;
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/List.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/List.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/List.js
index 911b72b..09715de 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/List.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/List.js
@@ -14,25 +14,20 @@
goog.provide('org.apache.flex.html.staticControls.List');
-goog.require('org.apache.flex.core.UIBase');
+goog.require('org.apache.flex.core.ListBase');
+
+
/**
* @constructor
- * @extends {org.apache.flex.core.UIBase}
+ * @extends {org.apache.flex.core.ListBase}
*/
org.apache.flex.html.staticControls.List = function() {
- org.apache.flex.core.UIBase.call(this);
-
- /**
- * @private
- * @type {Array.<Object>}
- */
- this._dataProvider;
-
+ goog.base(this);
};
-goog.inherits(
- org.apache.flex.html.staticControls.List, org.apache.flex.core.UIBase
-);
+goog.inherits(org.apache.flex.html.staticControls.List,
+ org.apache.flex.core.ListBase);
+
/**
* @override
@@ -40,106 +35,7 @@ goog.inherits(
* @param {Object} p The parent element.
*/
org.apache.flex.html.staticControls.List.prototype.addToParent = function(p) {
- this.element = document.createElement('select');
- //this.element.onchange = org.apache.flex.FlexGlobal.createProxy(
- // this, this.changeHandler);
- this.element.size = 5;
-
- p.appendChild(this.element);
-
- this.positioner = this.element;
-};
-
-/**
- * @expose
- * @this {org.apache.flex.html.staticControls.List}
- * @return {Array.<Object>} The collection of data.
- */
-org.apache.flex.html.staticControls.List.prototype.get_dataProvider =
-function() {
- return this._dataProvider;
-};
-
-/**
- * @expose
- * @this {org.apache.flex.html.staticControls.List}
- * @param {Array.<Object>} value The text setter.
- */
-org.apache.flex.html.staticControls.List.prototype.set_dataProvider =
-function(value) {
- this._dataProvider = value;
-
- var dp = this.element.options;
- var n = dp.length;
- for (var i = 0; i < n; i++)
- dp.remove(0);
-
- n = value.length;
- for (i = 0; i < n; i++)
- {
- var opt = document.createElement('option');
- opt.text = value[i];
- dp.add(opt);
- }
-};
-
-/**
- * @expose
- * @this {org.apache.flex.html.staticControls.List}
- * @return {int} The selected index.
- */
-org.apache.flex.html.staticControls.List.prototype.get_selectedIndex =
-function() {
- return this.element.selectedIndex;
-};
-
-/**
- * @expose
- * @this {org.apache.flex.html.staticControls.List}
- * @param {int} value The selected index.
- */
-org.apache.flex.html.staticControls.List.prototype.set_selectedIndex =
-function(value) {
- this.element.selectedIndex = value;
-};
-
-/**
- * @expose
- * @this {org.apache.flex.html.staticControls.List}
- * @return {Object} The selected item.
- */
-org.apache.flex.html.staticControls.List.prototype.get_selectedItem =
-function() {
- return this._dataProvider[this.element.selectedIndex];
-};
-
-/**
- * @expose
- * @this {org.apache.flex.html.staticControls.List}
- * @param {Object} value The selected item.
- */
-org.apache.flex.html.staticControls.List.prototype.set_selectedItem =
-function(value) {
+ goog.base(this, 'addToParent', p);
- var dp = this._dataProvider;
- var n = dp.length;
- for (var i = 0; i < n; i++)
- {
- if (dp[i] == value)
- break;
- }
- if (i < n)
- this.element.selectedIndex = i;
+ this.element.size = 5;
};
-
-/**
- * @protected
- * @this {org.apache.flex.html.staticControls.List}
- * @return {Object} The selected item.
- */
-org.apache.flex.html.staticControls.List.prototype.changeHandler =
-function() {
- var evt = this.createEvent('change');
- this.dispatchEvent(evt);
-};
-
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/RadioButton.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/RadioButton.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/RadioButton.js
index 8953ce9..1df194f 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/RadioButton.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/RadioButton.js
@@ -16,88 +16,102 @@ goog.provide('org.apache.flex.html.staticControls.RadioButton');
goog.require('org.apache.flex.core.UIBase');
-var rbCount = 0;
+
/**
* @constructor
* @extends {org.apache.flex.core.UIBase}
*/
org.apache.flex.html.staticControls.RadioButton = function() {
- org.apache.flex.core.UIBase.call(this);
+ goog.base(this);
};
-goog.inherits(
- org.apache.flex.html.staticControls.RadioButton, org.apache.flex.core.UIBase
-);
+goog.inherits(org.apache.flex.html.staticControls.RadioButton,
+ org.apache.flex.core.UIBase);
+
/**
* @override
* @this {org.apache.flex.html.staticControls.RadioButton}
* @param {Object} p The parent element.
*/
-org.apache.flex.html.staticControls.RadioButton.prototype.addToParent =
+org.apache.flex.html.staticControls.RadioButton.prototype.addToParent =
function(p) {
- this.element = document.createElement('label');
-
- var rb = document.createElement('input');
- rb.type = 'radio';
- this.element.appendChild(rb);
- this.element.appendChild(document.createTextNode("radio button"));
+ var rb;
+
+ this.element = document.createElement('label');
- p.appendChild(this.element);
+ rb = document.createElement('input');
+ rb.type = 'radio';
+ this.element.appendChild(rb);
+ this.element.appendChild(document.createTextNode('radio button'));
- this.positioner = this.element;
+ p.appendChild(this.element);
+
+ this.positioner = this.element;
};
+
/**
* @expose
* @this {org.apache.flex.html.staticControls.RadioButton}
* @return {string} The groupName getter.
*/
-org.apache.flex.html.staticControls.RadioButton.prototype.get_groupName = function() {
- return this.element.childNodes.item(0).name;
+org.apache.flex.html.staticControls.RadioButton.prototype.get_groupName =
+ function() {
+ return this.element.childNodes.item(0).name;
};
+
/**
* @expose
* @this {org.apache.flex.html.staticControls.RadioButton}
* @param {string} value The groupName setter.
*/
-org.apache.flex.html.staticControls.RadioButton.prototype.set_groupName = function(value) {
- this.element.childNodes.item(0).name = value;
+org.apache.flex.html.staticControls.RadioButton.prototype.set_groupName =
+ function(value) {
+ this.element.childNodes.item(0).name = value;
};
+
/**
* @expose
* @this {org.apache.flex.html.staticControls.RadioButton}
* @return {string} The text getter.
*/
-org.apache.flex.html.staticControls.RadioButton.prototype.get_text = function() {
- return this.element.childNodes.item(1).nodeValue;
+org.apache.flex.html.staticControls.RadioButton.prototype.get_text =
+ function() {
+ return this.element.childNodes.item(1).nodeValue;
};
+
/**
* @expose
* @this {org.apache.flex.html.staticControls.RadioButton}
* @param {string} value The text setter.
*/
-org.apache.flex.html.staticControls.RadioButton.prototype.set_text = function(value) {
- this.element.childNodes.item(1).nodeValue = value;
+org.apache.flex.html.staticControls.RadioButton.prototype.set_text =
+ function(value) {
+ this.element.childNodes.item(1).nodeValue = value;
};
+
/**
* @expose
* @this {org.apache.flex.html.staticControls.RadioButton}
* @return {bool} The selected getter.
*/
-org.apache.flex.html.staticControls.RadioButton.prototype.get_selected = function() {
- return this.element.childNodes.item(0).checked;
+org.apache.flex.html.staticControls.RadioButton.prototype.get_selected =
+ function() {
+ return this.element.childNodes.item(0).checked;
};
+
/**
* @expose
* @this {org.apache.flex.html.staticControls.RadioButton}
* @param {bool} value The selected setter.
*/
-org.apache.flex.html.staticControls.RadioButton.prototype.set_selected = function(value) {
- this.element.childNodes.item(0).checked = value;
+org.apache.flex.html.staticControls.RadioButton.prototype.set_selected =
+ function(value) {
+ this.element.childNodes.item(0).checked = value;
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TextArea.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TextArea.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TextArea.js
index 6ff9499..342ab25 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TextArea.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TextArea.js
@@ -16,45 +16,50 @@ goog.provide('org.apache.flex.html.staticControls.TextArea');
goog.require('org.apache.flex.core.UIBase');
+
+
/**
* @constructor
* @extends {org.apache.flex.core.UIBase}
*/
org.apache.flex.html.staticControls.TextArea = function() {
- org.apache.flex.core.UIBase.call(this);
+ goog.base(this);
};
-goog.inherits(
- org.apache.flex.html.staticControls.TextArea, org.apache.flex.core.UIBase
-);
+goog.inherits(org.apache.flex.html.staticControls.TextArea,
+ org.apache.flex.core.UIBase);
+
/**
* @override
* @this {org.apache.flex.html.staticControls.TextArea}
* @param {Object} p The parent element.
*/
-org.apache.flex.html.staticControls.TextArea.prototype.addToParent =
+org.apache.flex.html.staticControls.TextArea.prototype.addToParent =
function(p) {
- this.element = document.createElement('textarea');
+ this.element = document.createElement('textarea');
- p.appendChild(this.element);
+ p.appendChild(this.element);
- this.positioner = this.element;
+ this.positioner = this.element;
};
+
/**
* @expose
* @this {org.apache.flex.html.staticControls.TextArea}
* @return {string} The text getter.
*/
org.apache.flex.html.staticControls.TextArea.prototype.get_text = function() {
- return this.element.value
+ return this.element.value;
};
+
/**
* @expose
* @this {org.apache.flex.html.staticControls.TextArea}
* @param {string} value The text setter.
*/
-org.apache.flex.html.staticControls.TextArea.prototype.set_text = function(value) {
- this.element.value = value;
+org.apache.flex.html.staticControls.TextArea.prototype.set_text =
+ function(value) {
+ this.element.value = value;
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TextButton.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TextButton.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TextButton.js
index 624ed48..7479328 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TextButton.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TextButton.js
@@ -16,16 +16,18 @@ goog.provide('org.apache.flex.html.staticControls.TextButton');
goog.require('org.apache.flex.core.UIBase');
+
+
/**
* @constructor
* @extends {org.apache.flex.core.UIBase}
*/
org.apache.flex.html.staticControls.TextButton = function() {
- org.apache.flex.core.UIBase.call(this);
+ goog.base(this);
};
-goog.inherits(
- org.apache.flex.html.staticControls.TextButton, org.apache.flex.core.UIBase
-);
+goog.inherits(org.apache.flex.html.staticControls.TextButton,
+ org.apache.flex.core.UIBase);
+
/**
* @override
@@ -34,23 +36,25 @@ goog.inherits(
*/
org.apache.flex.html.staticControls.TextButton.prototype.addToParent =
function(p) {
- this.element = document.createElement('button');
- this.element.setAttribute('type', 'button');
+ this.element = document.createElement('button');
+ this.element.setAttribute('type', 'button');
- p.appendChild(this.element);
+ p.appendChild(this.element);
- this.positioner = this.element;
+ this.positioner = this.element;
};
+
/**
* @expose
* @this {org.apache.flex.html.staticControls.TextButton}
* @return {string} The text getter.
*/
org.apache.flex.html.staticControls.TextButton.prototype.get_text = function() {
- return this.element.innerHTML;
+ return this.element.innerHTML;
};
+
/**
* @expose
* @this {org.apache.flex.html.staticControls.TextButton}
@@ -58,5 +62,5 @@ org.apache.flex.html.staticControls.TextButton.prototype.get_text = function() {
*/
org.apache.flex.html.staticControls.TextButton.prototype.set_text =
function(value) {
- this.element.innerHTML = value;
+ this.element.innerHTML = value;
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TextInput.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TextInput.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TextInput.js
index 8945d93..f568e17 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TextInput.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TextInput.js
@@ -16,46 +16,51 @@ goog.provide('org.apache.flex.html.staticControls.TextInput');
goog.require('org.apache.flex.core.UIBase');
+
+
/**
* @constructor
* @extends {org.apache.flex.core.UIBase}
*/
org.apache.flex.html.staticControls.TextInput = function() {
- org.apache.flex.core.UIBase.call(this);
+ goog.base(this);
};
-goog.inherits(
- org.apache.flex.html.staticControls.TextInput, org.apache.flex.core.UIBase
-);
+goog.inherits(org.apache.flex.html.staticControls.TextInput,
+ org.apache.flex.core.UIBase);
+
/**
* @override
* @this {org.apache.flex.html.staticControls.TextInput}
* @param {Object} p The parent element.
*/
-org.apache.flex.html.staticControls.TextInput.prototype.addToParent =
+org.apache.flex.html.staticControls.TextInput.prototype.addToParent =
function(p) {
- this.element = document.createElement('input');
- this.element.setAttribute('type', 'input');
+ this.element = document.createElement('input');
+ this.element.setAttribute('type', 'input');
- p.appendChild(this.element);
+ p.appendChild(this.element);
- this.positioner = this.element;
+ this.positioner = this.element;
};
+
/**
* @expose
* @this {org.apache.flex.html.staticControls.TextInput}
* @return {string} The text getter.
*/
org.apache.flex.html.staticControls.TextInput.prototype.get_text = function() {
- return this.element.value
+ return this.element.value;
};
+
/**
* @expose
* @this {org.apache.flex.html.staticControls.TextInput}
* @param {string} value The text setter.
*/
-org.apache.flex.html.staticControls.TextInput.prototype.set_text = function(value) {
- this.element.value = value;
+org.apache.flex.html.staticControls.TextInput.prototype.set_text =
+ function(value) {
+ this.element.value = value;
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7b74f50/frameworks/js/FlexJS/src/org/apache/flex/html5/staticControls/CheckBox.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html5/staticControls/CheckBox.js b/frameworks/js/FlexJS/src/org/apache/flex/html5/staticControls/CheckBox.js
index aebd0ca..7fc70e3 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html5/staticControls/CheckBox.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html5/staticControls/CheckBox.js
@@ -16,70 +16,79 @@ goog.provide('org.apache.flex.html5.staticControls.CheckBox');
goog.require('org.apache.flex.core.UIBase');
-var cbCount = 0;
+
/**
* @constructor
* @extends {org.apache.flex.core.UIBase}
*/
org.apache.flex.html5.staticControls.CheckBox = function() {
- org.apache.flex.core.UIBase.call(this);
+ goog.base(this);
};
-goog.inherits(
- org.apache.flex.html5.staticControls.CheckBox, org.apache.flex.core.UIBase
-);
+goog.inherits(org.apache.flex.html5.staticControls.CheckBox,
+ org.apache.flex.core.UIBase);
+
/**
* @override
* @this {org.apache.flex.html5.staticControls.CheckBox}
* @param {Object} p The parent element.
*/
-org.apache.flex.html5.staticControls.CheckBox.prototype.addToParent =
+org.apache.flex.html5.staticControls.CheckBox.prototype.addToParent =
function(p) {
- this.element = document.createElement('label');
-
- var cb = document.createElement('input');
- cb.type = 'checkbox';
- this.element.appendChild(cb);
- this.element.appendChild(document.createTextNode("check box"));
-
- p.appendChild(this.element);
-
- this.positioner = this.element;
+ var cb;
+
+ this.element = document.createElement('label');
+
+ cb = document.createElement('input');
+ cb.type = 'checkbox';
+ this.element.appendChild(cb);
+ this.element.appendChild(document.createTextNode('check box'));
+
+ p.appendChild(this.element);
+
+ this.positioner = this.element;
};
+
/**
* @expose
* @this {org.apache.flex.html5.staticControls.CheckBox}
* @return {string} The text getter.
*/
org.apache.flex.html5.staticControls.CheckBox.prototype.get_text = function() {
- return this.element.childNodes.item(1).nodeValue;
+ return this.element.childNodes.item(1).nodeValue;
};
+
/**
* @expose
* @this {org.apache.flex.html5.staticControls.CheckBox}
* @param {string} value The text setter.
*/
-org.apache.flex.html5.staticControls.CheckBox.prototype.set_text = function(value) {
- this.element.childNodes.item(1).nodeValue = value;
+org.apache.flex.html5.staticControls.CheckBox.prototype.set_text =
+ function(value) {
+ this.element.childNodes.item(1).nodeValue = value;
};
+
/**
* @expose
* @this {org.apache.flex.html5.staticControls.CheckBox}
* @return {bool} The selected getter.
*/
-org.apache.flex.html5.staticControls.CheckBox.prototype.get_selected = function() {
- return this.element.childNodes.item(0).checked;
+org.apache.flex.html5.staticControls.CheckBox.prototype.get_selected =
+ function() {
+ return this.element.childNodes.item(0).checked;
};
+
/**
* @expose
* @this {org.apache.flex.html5.staticControls.CheckBox}
* @param {bool} value The selected setter.
*/
-org.apache.flex.html5.staticControls.CheckBox.prototype.set_selected = function(value) {
- this.element.childNodes.item(0).checked = value;
+org.apache.flex.html5.staticControls.CheckBox.prototype.set_selected =
+ function(value) {
+ this.element.childNodes.item(0).checked = value;
};