Repository: flex-asjs
Updated Branches:
  refs/heads/develop e1f17c928 -> 5f6234ef4


Adding ToggleTextButton to jQuery group.


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

Branch: refs/heads/develop
Commit: 5f6234ef441f6cae8bb7893e0c636bd35c265d04
Parents: e1f17c9
Author: Peter Ent <[email protected]>
Authored: Mon Jan 26 10:59:56 2015 -0500
Committer: Peter Ent <[email protected]>
Committed: Mon Jan 26 10:59:56 2015 -0500

----------------------------------------------------------------------
 .../as/projects/FlexJSUI/jquery-manifest.xml    |   1 +
 .../org/apache/flex/jquery/ToggleTextButton.as  |  89 +++++++++++
 .../org/apache/flex/jquery/ToggleTextButton.js  | 151 +++++++++++++++++++
 3 files changed, 241 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5f6234ef/frameworks/as/projects/FlexJSUI/jquery-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/jquery-manifest.xml 
b/frameworks/as/projects/FlexJSUI/jquery-manifest.xml
index e94c165..78b053d 100644
--- a/frameworks/as/projects/FlexJSUI/jquery-manifest.xml
+++ b/frameworks/as/projects/FlexJSUI/jquery-manifest.xml
@@ -25,5 +25,6 @@
     <component id="TextButton" class="org.apache.flex.jquery.TextButton"/>
     <component id="CheckBox" class="org.apache.flex.jquery.CheckBox"/>
     <component id="RadioButton" class="org.apache.flex.jquery.RadioButton"/>
+    <component id="ToggleTextButton" 
class="org.apache.flex.jquery.ToggleTextButton"/>
 
 </componentPackage>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5f6234ef/frameworks/as/projects/FlexJSUI/src/org/apache/flex/jquery/ToggleTextButton.as
----------------------------------------------------------------------
diff --git 
a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/jquery/ToggleTextButton.as
 
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/jquery/ToggleTextButton.as
new file mode 100644
index 0000000..b76846c
--- /dev/null
+++ 
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/jquery/ToggleTextButton.as
@@ -0,0 +1,89 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.jquery
+{
+       import org.apache.flex.core.IStrand;
+    import org.apache.flex.core.IToggleButtonModel;
+       import org.apache.flex.core.IUIBase;
+       import org.apache.flex.core.UIButtonBase;
+       import org.apache.flex.core.ValuesManager;
+       import org.apache.flex.events.IEventDispatcher;
+       
+    //--------------------------------------
+    //  Events
+    //--------------------------------------
+    
+    /**
+     *  Dispatched when the user clicks on a button.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion FlexJS 0.0
+     */
+       [Event(name="click", type="org.apache.flex.events.Event")]
+
+    /**
+     *  The ToggleButton class is a TextButton that supports
+     *  a selected property.
+     * 
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion FlexJS 0.0
+     */
+       public class ToggleTextButton extends TextButton implements IStrand, 
IEventDispatcher, IUIBase
+       {
+        /**
+         *  Constructor.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+               public function ToggleTextButton()
+               {
+                       super();
+               }
+        
+        /**
+         *  <code>true</code> if the Button is selected.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public function get selected():Boolean
+        {
+            return IToggleButtonModel(model).selected;
+        }
+        
+        /**
+         *  @private
+         */
+        public function set selected(value:Boolean):void
+        {
+            IToggleButtonModel(model).selected = value;
+        }
+        
+        
+       }
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5f6234ef/frameworks/js/FlexJS/src/org/apache/flex/jquery/ToggleTextButton.js
----------------------------------------------------------------------
diff --git 
a/frameworks/js/FlexJS/src/org/apache/flex/jquery/ToggleTextButton.js 
b/frameworks/js/FlexJS/src/org/apache/flex/jquery/ToggleTextButton.js
new file mode 100644
index 0000000..5cad5a7
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/jquery/ToggleTextButton.js
@@ -0,0 +1,151 @@
+/**
+ * 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.jquery.ToggleTextButton');
+
+goog.require('org.apache.flex.html.Button');
+
+
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.html.Button}
+ */
+org.apache.flex.jquery.ToggleTextButton = function() {
+  org.apache.flex.jquery.ToggleTextButton.base(this, 'constructor');
+
+
+
+  /**
+   * @private
+   * @type {boolean}
+   */
+  this.selected_ = false;
+};
+goog.inherits(org.apache.flex.jquery.ToggleTextButton,
+    org.apache.flex.html.Button);
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.jquery.ToggleTextButton.prototype.FLEXJS_CLASS_INFO =
+    { names: [{ name: 'ToggleTextButton',
+                qName: 'org.apache.flex.jquery.ToggleTextButton'}] };
+
+
+/**
+ * @expose
+ * Used to provide ids to the ToggleTextButton.
+ */
+org.apache.flex.jquery.ToggleTextButton.toggleCounter = 0;
+
+
+/**
+ * @override
+ */
+org.apache.flex.jquery.ToggleTextButton.prototype.createElement =
+    function() {
+
+  // the radio itself
+  this.input = document.createElement('input');
+  this.input.type = 'checkbox';
+  this.input.name = 'checkbox';
+  this.input.id = '_toggle_' + 
org.apache.flex.jquery.ToggleTextButton.toggleCounter++;
+
+  this.labelFor = document.createElement('label');
+  this.labelFor.htmlFor = this.input.id;
+
+  this.positioner = document.createElement('div');
+  this.positioner.appendChild(this.input);
+  this.positioner.appendChild(this.labelFor);
+  this.element = this.input;
+
+  this.input.flexjs_wrapper = this;
+  this.labelFor.flexjs_wrapper = this;
+  this.positioner.flexjs_wrapper = this;
+
+  return this.element;
+};
+
+
+/**
+ * @override
+ */
+org.apache.flex.jquery.ToggleTextButton.prototype.addedToParent =
+    function() {
+  org.apache.flex.jquery.ToggleTextButton.base(this, 'addedToParent');
+  $(this.element).button();
+};
+
+
+/**
+ * @expose
+ * @return {string} The text getter.
+ */
+org.apache.flex.jquery.ToggleTextButton.prototype.get_text = function() {
+  return this.labelFor.innerHTML;
+};
+
+
+/**
+ * @expose
+ * @param {string} value The text setter.
+ */
+org.apache.flex.jquery.ToggleTextButton.prototype.set_text =
+    function(value) {
+  this.labelFor.innerHTML = value;
+};
+
+
+/**
+ * @expose
+ * @return {boolean} The selected getter.
+ */
+org.apache.flex.jquery.ToggleTextButton.prototype.get_selected =
+    function() {
+  return this.input.selected_;
+};
+
+
+/**
+ * @expose
+ * @param {boolean} value The selected setter.
+ */
+org.apache.flex.jquery.ToggleTextButton.prototype.set_selected =
+    function(value) {
+  if (this.input.selected_ != value) {
+    this.inputselected_ = value;
+/*
+    var className = this.className;
+    if (value) {
+      if (className.indexOf(this.SELECTED) == className.length - 
this.SELECTED.length)
+        this.set_className(className.substring(0, className.length - 
this.SELECTED.length));
+    }
+    else {
+      if (className.indexOf(this.SELECTED) == -1)
+        this.set_className(className + this.SELECTED);
+    }
+*/
+  }
+};
+
+
+/**
+ * @type {string} The selected setter.
+ */
+org.apache.flex.jquery.ToggleTextButton.prototype.SELECTED = '_Selected';
+

Reply via email to