flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [1/9] git commit: [flex-asjs] [refs/heads/develop] - complete JS ToggleTextButton implementation
Date Tue, 04 Aug 2015 22:04:36 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 6175542e8 -> 75e4c27b5


complete JS ToggleTextButton implementation


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

Branch: refs/heads/develop
Commit: 8af934c950f37624deba5af863706bd7941e9d92
Parents: 6175542
Author: Alex Harui <aharui@apache.org>
Authored: Mon Aug 3 12:30:36 2015 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Tue Aug 4 13:54:15 2015 -0700

----------------------------------------------------------------------
 frameworks/projects/HTML/as/defaults.css        | 28 ++++++++++++++
 .../org/apache/flex/html/ToggleTextButton.js    | 40 +++++++++++++++++---
 2 files changed, 63 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8af934c9/frameworks/projects/HTML/as/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/defaults.css b/frameworks/projects/HTML/as/defaults.css
index d0a4390..67660f8 100644
--- a/frameworks/projects/HTML/as/defaults.css
+++ b/frameworks/projects/HTML/as/defaults.css
@@ -225,6 +225,34 @@ TitleBar
     border-width: 1px;
 }
 
+.toggleTextButton
+{
+  background-color: #f8f8f8;
+  border: 1px solid #808080;
+  padding: 4px;
+}
+
+.toggleTextButton:hover
+{
+  background-color: #e8e8e8;
+  border: 1px solid #808080;
+  padding: 4px;
+}
+
+.toggleTextButton_Selected
+{
+  background-color: #d8d8d8;
+  border: 1px solid #808080;
+  padding: 4px;
+}
+
+.toggleTextButton_Selected:hover
+{
+  background-color: #e8e8e8;
+  border: 1px solid #808080;
+  padding: 4px;
+}
+
 ToolTip
 {
     background-color: #FFFFCC;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8af934c9/frameworks/projects/HTML/js/src/org/apache/flex/html/ToggleTextButton.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/js/src/org/apache/flex/html/ToggleTextButton.js b/frameworks/projects/HTML/js/src/org/apache/flex/html/ToggleTextButton.js
index a05dfbb..2f8bafa 100644
--- a/frameworks/projects/HTML/js/src/org/apache/flex/html/ToggleTextButton.js
+++ b/frameworks/projects/HTML/js/src/org/apache/flex/html/ToggleTextButton.js
@@ -25,7 +25,7 @@ goog.require('org.apache.flex.html.Button');
 org.apache.flex.html.ToggleTextButton = function() {
   org.apache.flex.html.ToggleTextButton.base(this, 'constructor');
 
-
+  this.typeNames = 'toggleTextButton';
 
   /**
    * @private
@@ -71,13 +71,24 @@ Object.defineProperties(org.apache.flex.html.ToggleTextButton.prototype,
{
               this.selected_ = value;
 
               var className = this.className;
+              var typeNames = this.typeNames;
               if (value) {
-                 if (className.indexOf(this.SELECTED) == className.length - this.SELECTED.length)
-                   this.className = className.substring(0, className.length - this.SELECTED.length);
+                if (typeNames.indexOf(this.SELECTED) == -1) {
+                  this.typeNames = typeNames + this.SELECTED;
+                  if (className)
+                    this.element.className = this.typeNames + ' ' + className;
+                  else
+                    this.element.className = this.typeNames;
+                }
               }
               else {
-                if (className.indexOf(this.SELECTED) == -1)
-                  this.className = className + this.SELECTED;
+                if (typeNames.indexOf(this.SELECTED) == typeNames.length - this.SELECTED.length)
{
+                  this.typeNames = typeNames.substring(0, typeNames.length - this.SELECTED.length);
+                  if (className)
+                    this.element.className = this.typeNames + ' ' + className;
+                  else
+                    this.element.className = this.typeNames;
+                }
               }
            }
         }
@@ -90,3 +101,22 @@ Object.defineProperties(org.apache.flex.html.ToggleTextButton.prototype,
{
  */
 org.apache.flex.html.ToggleTextButton.prototype.SELECTED = '_Selected';
 
+
+/**
+ * @override
+ */
+org.apache.flex.html.ToggleTextButton.prototype.createElement = function() {
+  org.apache.flex.html.ToggleTextButton.base(this, 'createElement');
+  this.addEventListener('click', goog.bind(this.clickHandler_, this));
+  return this.element;
+};
+
+
+/**
+ * @private.
+ * @param {Object} e The event object.
+ */
+org.apache.flex.html.ToggleTextButton.prototype.clickHandler_ = function(e) {
+  this.selected = !this.selected;
+};
+


Mime
View raw message