flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlosrov...@apache.org
Subject [02/13] git commit: [flex-asjs] [refs/heads/feature/createjs-checkbox] - implement visible property in JS
Date Thu, 02 May 2013 23:55:31 GMT
implement visible property in JS


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

Branch: refs/heads/feature/createjs-checkbox
Commit: 80e4bb7a0a13bd8d7b681b0cb28d697eff43c71a
Parents: b75fc5d
Author: Alex Harui <aharui@apache.org>
Authored: Wed May 1 11:17:06 2013 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Wed May 1 11:18:25 2013 -0700

----------------------------------------------------------------------
 .../js/FlexJS/src/org/apache/flex/core/UIBase.js   |   40 +++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/80e4bb7a/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..41e5e6d 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/UIBase.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/UIBase.js
@@ -30,6 +30,12 @@ org.apache.flex.core.UIBase = function() {
      */
     this.positioner;
 
+    /**
+     * @private
+     * @type {string}
+     */
+    this.lastDisplay;
+
 };
 goog.inherits(org.apache.flex.core.UIBase,
     org.apache.flex.core.HTMLElementWrapper);
@@ -170,3 +176,37 @@ org.apache.flex.core.UIBase.prototype.set_model = function(value) {
     }
 };
 
+/**
+ * @expose
+ * @this {org.apache.flex.core.UIBase}
+ * @return {object} True if visible.
+ */
+org.apache.flex.core.UIBase.prototype.get_visible = function() {
+    return this.element.style.display != 'none';
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.core.UIBase}
+ * @param {object} value The new model.
+ */
+org.apache.flex.core.UIBase.prototype.set_visible = function(value) {
+    var oldValue = this.element.style.display != 'none';
+    if (value != oldValue)
+    {
+        if (!value)
+        {
+            this.lastDisplay = this.element.style.display;
+            this.element.style.display = 'none';
+            this.dispatchEvent(new org.apache.flex.events.Event('hide'));
+        }
+        else
+        {
+            if (this.lastDisplay)
+                this.element.style.display = this.lastDisplay;
+            else
+                this.element.style.display = 'block';
+            this.dispatchEvent(new org.apache.flex.events.Event('show'));
+        }
+    }
+};


Mime
View raw message