flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - Added JavaScript Image component.
Date Wed, 11 Sep 2013 17:49:30 GMT
Updated Branches:
  refs/heads/develop 426c2e1eb -> 894c38fe2


Added JavaScript Image component.


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/894c38fe
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/894c38fe
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/894c38fe

Branch: refs/heads/develop
Commit: 894c38fe2bf5c67b5c855004b1647e040cd9ba6b
Parents: 426c2e1
Author: Peter Ent <pent@apache.org>
Authored: Wed Sep 11 13:49:17 2013 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Wed Sep 11 13:49:17 2013 -0400

----------------------------------------------------------------------
 .../apache/flex/html/staticControls/Image.js    | 75 ++++++++++++++++++++
 .../flex/html/staticControls/beads/ImageView.js | 53 ++++++++++++++
 .../staticControls/beads/models/ImageModel.js   | 61 ++++++++++++++++
 3 files changed, 189 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/894c38fe/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Image.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Image.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Image.js
new file mode 100644
index 0000000..3b02344
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Image.js
@@ -0,0 +1,75 @@
+/**
+ * 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.html.staticControls.Image');
+
+goog.require('org.apache.flex.core.UIBase');
+goog.require('org.apache.flex.html.staticControls.beads.ImageView');
+goog.require('org.apache.flex.html.staticControls.beads.models.ImageModel');
+
+
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.core.UIBase}
+ */
+org.apache.flex.html.staticControls.Image = function() {
+  goog.base(this);
+};
+goog.inherits(org.apache.flex.html.staticControls.Image,
+    org.apache.flex.core.UIBase);
+
+
+/**
+ * @override
+ * @this {org.apache.flex.html.staticControls.Container}
+ */
+org.apache.flex.html.staticControls.Image.prototype.createElement =
+    function(p) {
+
+  this.element = document.createElement('img');
+
+  this.positioner = this.element;
+  this.element.flexjs_wrapper = this;
+
+  this.model = new
+          org.apache.flex.html.staticControls.beads.models.ImageModel();
+
+  this.addBead(this.model);
+
+  this.addBead(new
+         org.apache.flex.html.staticControls.beads.ImageView());
+};
+
+
+/**
+ * @expose
+ * @this {org.apache.flex.html.staticControls.Image}
+ * @return {String} The source identifier for the Image.
+ */
+org.apache.flex.html.staticControls.Image.prototype.
+get_source = function() {
+  return this.model.get_source();
+};
+
+
+/**
+ * @expose
+ * @this {org.apache.flex.html.staticControls.Image}
+ * @param {String} value The source identifier for the Image.
+ */
+org.apache.flex.html.staticControls.Image.prototype.
+set_source = function(value) {
+   this.model.set_source(value);
+};

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/894c38fe/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/ImageView.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/ImageView.js
b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/ImageView.js
new file mode 100644
index 0000000..641ccba
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/ImageView.js
@@ -0,0 +1,53 @@
+/**
+ * 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.html.staticControls.beads.ImageView');
+
+
+goog.require('org.apache.flex.html.staticControls.beads.models.ImageModel');
+
+
+/**
+ * @constructor
+ */
+org.apache.flex.html.staticControls.beads.ImageView = function() {
+};
+
+
+/**
+ * @expose
+ * @this {org.apache.flex.html.staticControls.beads.ImageView}
+ * @param {Object} value The new host.
+ */
+org.apache.flex.html.staticControls.beads.ImageView.prototype.set_strand =
+    function(value) {
+
+  this.strand_ = value;
+
+  this.model = value.getBeadByType(
+        org.apache.flex.html.staticControls.beads.models.ImageModel);
+  this.model.addEventListener('sourceChanged',
+    goog.bind(this.sourceChangeHandler, this));
+};
+
+
+/**
+ * @expose
+ * @this {org.apache.flex.html.staticControls.beads.ImageView}
+ * @param {Object} event The event triggered by the source change.
+ */
+org.apache.flex.html.staticControls.beads.ImageView.prototype.
+sourceChangeHandler = function(event) {
+  this.strand_.element.src = this.model.get_source();
+};

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/894c38fe/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/models/ImageModel.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/models/ImageModel.js
b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/models/ImageModel.js
new file mode 100644
index 0000000..e66da0f
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/models/ImageModel.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.
+ */
+
+goog.provide('org.apache.flex.html.staticControls.beads.models.ImageModel');
+
+goog.require('org.apache.flex.events.EventDispatcher');
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.events.EventDispatcher}
+ */
+org.apache.flex.html.staticControls.beads.models.ImageModel =
+function() {
+  goog.base(this);
+};
+goog.inherits(
+  org.apache.flex.html.staticControls.beads.models.ImageModel,
+  org.apache.flex.events.EventDispatcher);
+
+
+/**
+ * @expose
+ * @this {org.apache.flex.html.staticControls.beads.models.ImageModel}
+ * @param {Object} value The strand.
+ */
+org.apache.flex.html.staticControls.beads.models.ImageModel.prototype.
+set_strand = function(value) {
+  this.strand_ = value;
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.html.staticControls.beads.models.ImageModel}
+ * @return {Object} value The image source.
+ */
+org.apache.flex.html.staticControls.beads.models.ImageModel.prototype.
+get_source = function() {
+  return this.source;
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.html.staticControls.beads.models.ImageModel}
+ * @param {Object} value The image source.
+ */
+org.apache.flex.html.staticControls.beads.models.ImageModel.prototype.
+set_source = function(value) {
+  this.source = value;
+  this.dispatchEvent('sourceChanged');
+};


Mime
View raw message