flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [19/55] [abbrv] git commit: [flex-asjs] [refs/heads/develop] - Converted Formatters project.
Date Thu, 17 Dec 2015 07:54:29 GMT
Converted Formatters project.


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

Branch: refs/heads/develop
Commit: e2a806e31c6ddb636ddad4f148d715693f0d5c02
Parents: 7b7a676
Author: Peter Ent <pent@apache.org>
Authored: Wed Dec 9 14:03:00 2015 -0500
Committer: Peter Ent <pent@apache.org>
Committed: Wed Dec 9 14:03:00 2015 -0500

----------------------------------------------------------------------
 .../Formatters/as/src/FormattersClasses.as      |   4 +
 .../flex/html/accessories/CurrencyFormatter.as  | 215 +++++++++++++++++++
 .../html/accessories/DateFormatMMDDYYYYBead.as  | 158 ++++++++++++++
 .../flex/html/accessories/NumberFormatter.as    | 210 ++++++++++++++++++
 .../flex/html/beads/FormatableLabelView.as      |  90 ++++++++
 .../flex/html/beads/FormatableTextInputView.as  |  91 ++++++++
 .../flex/html/accessories/CurrencyFormatter.as  | 215 -------------------
 .../html/accessories/DateFormatMMDDYYYYBead.as  | 158 --------------
 .../flex/html/accessories/NumberFormatter.as    | 210 ------------------
 .../flex/html/beads/FormatableLabelView.as      |  90 --------
 .../flex/html/beads/FormatableTextInputView.as  |  91 --------
 frameworks/projects/Formatters/build.xml        | 104 ++++-----
 .../projects/Formatters/compile-asjs-config.xml |   5 +-
 .../projects/Formatters/compile-config.xml      |   2 -
 14 files changed, 822 insertions(+), 821 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e2a806e3/frameworks/projects/Formatters/as/src/FormattersClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Formatters/as/src/FormattersClasses.as b/frameworks/projects/Formatters/as/src/FormattersClasses.as
index 66f88ca..4c3646a 100644
--- a/frameworks/projects/Formatters/as/src/FormattersClasses.as
+++ b/frameworks/projects/Formatters/as/src/FormattersClasses.as
@@ -28,6 +28,10 @@ package
 internal class FormattersClasses
 {	
 	import org.apache.flex.core.FormatBase; FormatBase;
+	
+	import org.apache.flex.html.accessories.DateFormatMMDDYYYYBead; DateFormatMMDDYYYYBead;
+	import org.apache.flex.html.beads.FormatableLabelView; FormatableLabelView;
+	import org.apache.flex.html.beads.FormatableTextInputView; FormatableTextInputView;
 }
 
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e2a806e3/frameworks/projects/Formatters/as/src/org/apache/flex/html/accessories/CurrencyFormatter.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Formatters/as/src/org/apache/flex/html/accessories/CurrencyFormatter.as b/frameworks/projects/Formatters/as/src/org/apache/flex/html/accessories/CurrencyFormatter.as
new file mode 100644
index 0000000..208b5ff
--- /dev/null
+++ b/frameworks/projects/Formatters/as/src/org/apache/flex/html/accessories/CurrencyFormatter.as
@@ -0,0 +1,215 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.html.accessories
+{
+	import org.apache.flex.core.IBeadModel;
+	import org.apache.flex.core.IFormatBead;
+	import org.apache.flex.core.IStrand;
+	import org.apache.flex.events.Event;
+	import org.apache.flex.events.EventDispatcher;
+	import org.apache.flex.events.IEventDispatcher;
+	
+	/**
+	 * The CurrencyFormatter class formats a value in separated groups. The formatter listens
+	 * to a property on a model and when the property changes, formats it and dispatches a
+	 * formatChanged event.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	public class CurrencyFormatter extends EventDispatcher implements IFormatBead
+	{
+		/**
+		 *  constructor
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function CurrencyFormatter()
+		{
+			super();
+		}
+		
+		private var _strand:IStrand;
+		
+		/**
+		 *  @copy org.apache.flex.core.IBead#strand
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function set strand(value:IStrand):void
+		{
+			_strand = value;
+			
+			// Listen for the beadsAdded event which signals when all of a strand's
+			// beads have been added.
+			IEventDispatcher(value).addEventListener("beadsAdded",handleBeadsAdded);
+		}
+		
+		/**
+		 * @private
+		 */
+		private function handleBeadsAdded(event:Event):void
+		{
+			// Listen for the change in the model
+			var model:IBeadModel = _strand.getBeadByType(IBeadModel) as IBeadModel;
+			model.addEventListener(eventName,propertyChangeHandler);
+			model.addEventListener(propertyName+"Change",propertyChangeHandler);
+			
+			// format the current value of that property
+			propertyChangeHandler(null);
+		}
+		
+		private var _propertyName:String;
+		private var _eventName:String;
+		private var _formattedResult:String;
+		private var _fractionalDigits:Number = 2;
+        private var _currencySymbol:String = "$";
+		
+		/**
+		 *  The name of the property on the model to format.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get propertyName():String
+		{
+			if (_propertyName == null) {
+				return "text";
+			}
+			return _propertyName;
+		}
+		public function set propertyName(value:String):void
+		{
+			_propertyName = value;
+		}
+		
+		/**
+		 *  The event dispatched by the model when the property changes. The
+		 *  default is propertyName+"Changed".
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get eventName():String
+		{
+			if (_eventName == null) {
+				return _propertyName+"Changed";
+			}
+			return _eventName;
+		}
+		public function set eventName(value:String):void
+		{
+			_eventName = value;
+		}
+		
+        /**
+		 *  Number of digits after the decimal separator
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get fractionalDigits():int
+		{
+			return _fractionalDigits;
+		}
+		public function set fractionalDigits(value:int):void
+		{
+            _fractionalDigits = value;
+		}
+		
+        /**
+         *  The currency symbol, such as "$"
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public function get currencySymbol():String
+        {
+            return _currencySymbol;
+        }
+        public function set currencySymbol(value:String):void
+        {
+            _currencySymbol = value;
+        }
+
+        /**
+		 *  The formatted string.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get formattedString():String
+		{
+			return _formattedResult;
+		}
+		
+		/**
+		 * @private
+		 */
+		private function propertyChangeHandler(event:Event):void
+		{
+			// When the property changes, fetch it from the model and
+			// format it, storing the result in _formattedResult.
+			var model:IBeadModel = _strand.getBeadByType(IBeadModel) as IBeadModel;
+			var value:Object = model[propertyName];
+			_formattedResult = format(value);
+			
+			// Dispatch the formatChanged event so any bead that's interested in
+			// the formatted string knows to use it.
+			var newEvent:Event = new Event("formatChanged");
+			this.dispatchEvent(newEvent);
+		}
+		
+        /**
+         *  Computes the formatted string.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+		public function format(value:Object):String
+		{
+			if (value == null) return "";
+			
+			var num:Number = Number(value);
+            var source:String = num.toFixed(fractionalDigits);
+			
+			return currencySymbol + source;
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e2a806e3/frameworks/projects/Formatters/as/src/org/apache/flex/html/accessories/DateFormatMMDDYYYYBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Formatters/as/src/org/apache/flex/html/accessories/DateFormatMMDDYYYYBead.as b/frameworks/projects/Formatters/as/src/org/apache/flex/html/accessories/DateFormatMMDDYYYYBead.as
new file mode 100644
index 0000000..94d7f20
--- /dev/null
+++ b/frameworks/projects/Formatters/as/src/org/apache/flex/html/accessories/DateFormatMMDDYYYYBead.as
@@ -0,0 +1,158 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.html.accessories
+{
+	import org.apache.flex.core.IBead;
+	import org.apache.flex.core.IDateChooserModel;
+	import org.apache.flex.core.IFormatBead;
+	import org.apache.flex.core.IStrand;
+    import org.apache.flex.core.IStrandWithModel;
+	import org.apache.flex.events.Event;
+	import org.apache.flex.events.EventDispatcher;
+	import org.apache.flex.html.TextInput;
+	import org.apache.flex.html.beads.DateFieldView;
+	
+	/**
+	 * The DateFormatBead class formats the display of a DateField using MM/DD/YYYY format.
+	 *  
+     *  @flexjsignoreimport org.apache.flex.core.IStrandWithModel
+     * 
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	public class DateFormatMMDDYYYYBead extends EventDispatcher implements IBead, IFormatBead
+	{
+		/**
+		 * constructor.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function DateFormatMMDDYYYYBead()
+		{
+		}
+		
+		private var _propertyName:String;
+		private var _eventName:String;
+		private var _formattedResult:String;
+		
+		/**
+		 *  The name of the property on the model holding the value to be formatted.
+		 *  The default is selectedDate.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get propertyName():String
+		{
+			if (_propertyName == null) {
+				return "selectedDate";
+			}
+			return _propertyName;
+		}
+		public function set propertyName(value:String):void
+		{
+			_propertyName = value;
+		}
+		
+		/**
+		 *  The name of the event dispatched when the property changes. The
+		 *  default is selectedDateChanged.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get eventName():String
+		{
+			if (_eventName == null) {
+				return _propertyName+"Changed";
+			}
+			return _eventName;
+		}
+		public function set eventName(value:String):void
+		{
+			_eventName = value;
+		}
+		
+		/**
+		 *  The formatted result.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get formattedString():String
+		{
+			return _formattedResult;
+		}
+		
+		private var _strand:IStrand;
+		
+		/**
+		 *  @copy org.apache.flex.core.IBead#strand
+		 *  
+         *  @flexjsignorecoercion org.apache.flex.core.IStrandWithModel
+         * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function set strand(value:IStrand):void
+		{
+			_strand = value;
+			
+			var model:IDateChooserModel = IStrandWithModel(_strand).model as IDateChooserModel;
+			model.addEventListener("selectedDateChanged",handleTextChange);
+		}
+		
+		/**
+		 * @private
+         * 
+         * @flexjsignorecoercion org.apache.flex.core.IStrandWithModel
+		 */
+		private function handleTextChange(event:Event):void
+		{
+			var model:IDateChooserModel = IStrandWithModel(_strand).model as IDateChooserModel;
+			/*var view:DateFieldView = _strand.getBeadByType(DateFieldView) as DateFieldView;
+			var input:TextInput = view.textInput;*/
+			
+			var d:Date = model.selectedDate;
+			var month:String = String(d.getMonth()+1);
+			if (Number(month)<10) month = "0"+month;
+			var date:String = String(d.getDate());
+			if (Number(date)<10) date = "0"+date;
+			var fmt:String = month+"/"+date+"/"+String(d.getFullYear());
+			/*input.text = fmt;*/
+			_formattedResult = month+"/"+date+"/"+String(d.getFullYear());
+			
+			dispatchEvent( new Event("formatChanged") );
+		}
+		
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e2a806e3/frameworks/projects/Formatters/as/src/org/apache/flex/html/accessories/NumberFormatter.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Formatters/as/src/org/apache/flex/html/accessories/NumberFormatter.as b/frameworks/projects/Formatters/as/src/org/apache/flex/html/accessories/NumberFormatter.as
new file mode 100644
index 0000000..0d1b613
--- /dev/null
+++ b/frameworks/projects/Formatters/as/src/org/apache/flex/html/accessories/NumberFormatter.as
@@ -0,0 +1,210 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.html.accessories
+{
+	import org.apache.flex.core.IBeadModel;
+	import org.apache.flex.core.IFormatBead;
+	import org.apache.flex.core.IStrand;
+	import org.apache.flex.events.Event;
+	import org.apache.flex.events.EventDispatcher;
+	import org.apache.flex.events.IEventDispatcher;
+	
+	/**
+	 * The NumberFormatter class formats a value in separated groups. The formatter listens
+	 * to a property on a model and when the property changes, formats it and dispatches a
+	 * formatChanged event.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	public class NumberFormatter extends EventDispatcher implements IFormatBead
+	{
+		/**
+		 *  constructor
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function NumberFormatter()
+		{
+			super();
+		}
+		
+		private var _strand:IStrand;
+		
+		/**
+		 *  @copy org.apache.flex.core.IBead#strand
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function set strand(value:IStrand):void
+		{
+			_strand = value;
+			
+			// Listen for the beadsAdded event which signals when all of a strand's
+			// beads have been added.
+			IEventDispatcher(value).addEventListener("beadsAdded",handleBeadsAdded);
+		}
+		
+		/**
+		 * @private
+		 */
+		private function handleBeadsAdded(event:Event):void
+		{
+			// Listen for the change in the model
+			var model:IBeadModel = _strand.getBeadByType(IBeadModel) as IBeadModel;
+			model.addEventListener(eventName,propertyChangeHandler);
+			model.addEventListener(propertyName+"Change",propertyChangeHandler);
+			
+			// format the current value of that property
+			propertyChangeHandler(null);
+		}
+		
+		private var _propertyName:String;
+		private var _eventName:String;
+		private var _formattedResult:String;
+		private var _groupSize:Number = 3;
+		private var _thousandsSeparator:String = ",";
+		
+		/**
+		 *  The name of the property on the model to format.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get propertyName():String
+		{
+			if (_propertyName == null) {
+				return "text";
+			}
+			return _propertyName;
+		}
+		public function set propertyName(value:String):void
+		{
+			_propertyName = value;
+		}
+		
+		/**
+		 *  The event dispatched by the model when the property changes. The
+		 *  default is propertyName+"Changed".
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get eventName():String
+		{
+			if (_eventName == null) {
+				return _propertyName+"Changed";
+			}
+			return _eventName;
+		}
+		public function set eventName(value:String):void
+		{
+			_eventName = value;
+		}
+		
+		/**
+		 *  Character to use to separate thousands groups. The default is
+		 *  the comma (,).
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get thousandsSeparator():String
+		{
+			return _thousandsSeparator;
+		}
+		public function set thousandsSeparator(value:String):void
+		{
+			_thousandsSeparator = value;
+		}
+		
+		/**
+		 *  The formatted string.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get formattedString():String
+		{
+			return _formattedResult;
+		}
+		
+		/**
+		 * @private
+		 */
+		private function propertyChangeHandler(event:Event):void
+		{
+			// When the property changes, fetch it from the model and
+			// format it, storing the result in _formattedResult.
+			var model:IBeadModel = _strand.getBeadByType(IBeadModel) as IBeadModel;
+			var value:Object = model[propertyName];
+			_formattedResult = format(value);
+			
+			// Dispatch the formatChanged event so any bead that's interested in
+			// the formatted string knows to use it.
+			var newEvent:Event = new Event("formatChanged");
+			this.dispatchEvent(newEvent);
+		}
+		
+		/**
+		 * @private
+		 */
+		private function format(value:Object):String
+		{
+			if (value == null) return "";
+			
+			var num:Number = Number(value);
+			var source:String = String(value);
+			var parts:Array = source.split(thousandsSeparator);
+			source = parts.join("");
+			
+			var l:int = source.length;
+			var result:String = "";
+			var group:int = 0;
+			
+			for(var i:int=l-1; i >= 0; i--)
+			{
+				if (group == _groupSize && result.length > 0) {
+					result = thousandsSeparator + result;
+					group = 0;
+				}
+				result = source.charAt(i) + result;
+				group++;
+			}
+			
+			return result;
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e2a806e3/frameworks/projects/Formatters/as/src/org/apache/flex/html/beads/FormatableLabelView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Formatters/as/src/org/apache/flex/html/beads/FormatableLabelView.as b/frameworks/projects/Formatters/as/src/org/apache/flex/html/beads/FormatableLabelView.as
new file mode 100644
index 0000000..03b6ccd
--- /dev/null
+++ b/frameworks/projects/Formatters/as/src/org/apache/flex/html/beads/FormatableLabelView.as
@@ -0,0 +1,90 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.html.beads
+{
+	import org.apache.flex.core.IFormatBead;
+	import org.apache.flex.core.IStrand;
+	import org.apache.flex.events.Event;
+	import org.apache.flex.events.IEventDispatcher;
+	
+	/**
+	 *  The FormatableLabelView class is a View bead that is capable of working
+	 *  with a format bead to display a formatted value. When the format bead has
+	 *  created a formatted string, it dispatches a formatChanged event that the
+	 *  FormatableLabelView class intercepts and displays in the label.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	public class FormatableLabelView extends TextFieldView
+	{
+		/**
+		 *  constructor
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function FormatableLabelView()
+		{
+			super();
+		}
+		
+		private var _formatter:IFormatBead;
+		
+		/**
+		 *  @copy org.apache.flex.core.IBead#strand
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		override public function set strand(value:IStrand):void
+		{
+			super.strand = value;
+			IEventDispatcher(value).addEventListener("beadsAdded",handleBeadsAdded);
+		}
+		
+		/**
+		 * @private
+		 */
+		private function handleBeadsAdded(event:Event):void
+		{
+			_formatter = _strand.getBeadByType(IFormatBead) as IFormatBead;
+			_formatter.addEventListener("formatChanged",formatReadyHandler);
+			
+			// process any text set in the label at this moment
+			text = _formatter.formattedString;
+		}
+		
+		/**
+		 * @private
+		 */
+		private function formatReadyHandler(event:Event):void
+		{
+			if (_formatter) {
+				text = _formatter.formattedString;
+			}
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e2a806e3/frameworks/projects/Formatters/as/src/org/apache/flex/html/beads/FormatableTextInputView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Formatters/as/src/org/apache/flex/html/beads/FormatableTextInputView.as b/frameworks/projects/Formatters/as/src/org/apache/flex/html/beads/FormatableTextInputView.as
new file mode 100644
index 0000000..926253c
--- /dev/null
+++ b/frameworks/projects/Formatters/as/src/org/apache/flex/html/beads/FormatableTextInputView.as
@@ -0,0 +1,91 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.html.beads
+{
+	import org.apache.flex.core.IFormatBead;
+	import org.apache.flex.core.IStrand;
+	import org.apache.flex.events.Event;
+	import org.apache.flex.events.IEventDispatcher;
+
+	/**
+	 *  The FormatableTextInputView class is a View bead that extends TextInputWithBorderView
+	 *  and is capable of working with a format bead. When a format bead dispatches a
+	 *  formatChanged event, the FormatableTextInputView bead copies the formatted string to
+	 *  to the text field.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	public class FormatableTextInputView extends TextInputWithBorderView
+	{
+		/**
+		 *  constructor
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function FormatableTextInputView()
+		{
+			super();
+		}
+		
+		private var _formatter:IFormatBead;
+		
+		/**
+		 *  @copy org.apache.flex.core.IBead#strand
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		override public function set strand(value:IStrand):void
+		{
+			super.strand = value;
+			IEventDispatcher(value).addEventListener("beadsAdded",handleBeadsAdded);
+		}
+		
+		/**
+		 * @private
+		 */
+		private function handleBeadsAdded(event:Event):void
+		{
+			_formatter = _strand.getBeadByType(IFormatBead) as IFormatBead;
+			if (_formatter) {
+				_formatter.addEventListener("formatChanged",formatChangedHandler);
+			}
+		}
+		
+		/**
+		 * @private
+		 */
+		private function formatChangedHandler(event:Event):void
+		{
+			this.textField.text = _formatter.formattedString;
+			
+			// move the cursor to the end
+			var l:int = this.textField.text.length;
+			this.textField.setSelection(l,l);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e2a806e3/frameworks/projects/Formatters/asjs/src/org/apache/flex/html/accessories/CurrencyFormatter.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Formatters/asjs/src/org/apache/flex/html/accessories/CurrencyFormatter.as b/frameworks/projects/Formatters/asjs/src/org/apache/flex/html/accessories/CurrencyFormatter.as
deleted file mode 100644
index 208b5ff..0000000
--- a/frameworks/projects/Formatters/asjs/src/org/apache/flex/html/accessories/CurrencyFormatter.as
+++ /dev/null
@@ -1,215 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  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.html.accessories
-{
-	import org.apache.flex.core.IBeadModel;
-	import org.apache.flex.core.IFormatBead;
-	import org.apache.flex.core.IStrand;
-	import org.apache.flex.events.Event;
-	import org.apache.flex.events.EventDispatcher;
-	import org.apache.flex.events.IEventDispatcher;
-	
-	/**
-	 * The CurrencyFormatter class formats a value in separated groups. The formatter listens
-	 * to a property on a model and when the property changes, formats it and dispatches a
-	 * formatChanged event.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10.2
-	 *  @playerversion AIR 2.6
-	 *  @productversion FlexJS 0.0
-	 */
-	public class CurrencyFormatter extends EventDispatcher implements IFormatBead
-	{
-		/**
-		 *  constructor
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function CurrencyFormatter()
-		{
-			super();
-		}
-		
-		private var _strand:IStrand;
-		
-		/**
-		 *  @copy org.apache.flex.core.IBead#strand
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function set strand(value:IStrand):void
-		{
-			_strand = value;
-			
-			// Listen for the beadsAdded event which signals when all of a strand's
-			// beads have been added.
-			IEventDispatcher(value).addEventListener("beadsAdded",handleBeadsAdded);
-		}
-		
-		/**
-		 * @private
-		 */
-		private function handleBeadsAdded(event:Event):void
-		{
-			// Listen for the change in the model
-			var model:IBeadModel = _strand.getBeadByType(IBeadModel) as IBeadModel;
-			model.addEventListener(eventName,propertyChangeHandler);
-			model.addEventListener(propertyName+"Change",propertyChangeHandler);
-			
-			// format the current value of that property
-			propertyChangeHandler(null);
-		}
-		
-		private var _propertyName:String;
-		private var _eventName:String;
-		private var _formattedResult:String;
-		private var _fractionalDigits:Number = 2;
-        private var _currencySymbol:String = "$";
-		
-		/**
-		 *  The name of the property on the model to format.
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function get propertyName():String
-		{
-			if (_propertyName == null) {
-				return "text";
-			}
-			return _propertyName;
-		}
-		public function set propertyName(value:String):void
-		{
-			_propertyName = value;
-		}
-		
-		/**
-		 *  The event dispatched by the model when the property changes. The
-		 *  default is propertyName+"Changed".
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function get eventName():String
-		{
-			if (_eventName == null) {
-				return _propertyName+"Changed";
-			}
-			return _eventName;
-		}
-		public function set eventName(value:String):void
-		{
-			_eventName = value;
-		}
-		
-        /**
-		 *  Number of digits after the decimal separator
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function get fractionalDigits():int
-		{
-			return _fractionalDigits;
-		}
-		public function set fractionalDigits(value:int):void
-		{
-            _fractionalDigits = value;
-		}
-		
-        /**
-         *  The currency symbol, such as "$"
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
-        public function get currencySymbol():String
-        {
-            return _currencySymbol;
-        }
-        public function set currencySymbol(value:String):void
-        {
-            _currencySymbol = value;
-        }
-
-        /**
-		 *  The formatted string.
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function get formattedString():String
-		{
-			return _formattedResult;
-		}
-		
-		/**
-		 * @private
-		 */
-		private function propertyChangeHandler(event:Event):void
-		{
-			// When the property changes, fetch it from the model and
-			// format it, storing the result in _formattedResult.
-			var model:IBeadModel = _strand.getBeadByType(IBeadModel) as IBeadModel;
-			var value:Object = model[propertyName];
-			_formattedResult = format(value);
-			
-			// Dispatch the formatChanged event so any bead that's interested in
-			// the formatted string knows to use it.
-			var newEvent:Event = new Event("formatChanged");
-			this.dispatchEvent(newEvent);
-		}
-		
-        /**
-         *  Computes the formatted string.
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
-		public function format(value:Object):String
-		{
-			if (value == null) return "";
-			
-			var num:Number = Number(value);
-            var source:String = num.toFixed(fractionalDigits);
-			
-			return currencySymbol + source;
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e2a806e3/frameworks/projects/Formatters/asjs/src/org/apache/flex/html/accessories/DateFormatMMDDYYYYBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Formatters/asjs/src/org/apache/flex/html/accessories/DateFormatMMDDYYYYBead.as b/frameworks/projects/Formatters/asjs/src/org/apache/flex/html/accessories/DateFormatMMDDYYYYBead.as
deleted file mode 100644
index 94d7f20..0000000
--- a/frameworks/projects/Formatters/asjs/src/org/apache/flex/html/accessories/DateFormatMMDDYYYYBead.as
+++ /dev/null
@@ -1,158 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  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.html.accessories
-{
-	import org.apache.flex.core.IBead;
-	import org.apache.flex.core.IDateChooserModel;
-	import org.apache.flex.core.IFormatBead;
-	import org.apache.flex.core.IStrand;
-    import org.apache.flex.core.IStrandWithModel;
-	import org.apache.flex.events.Event;
-	import org.apache.flex.events.EventDispatcher;
-	import org.apache.flex.html.TextInput;
-	import org.apache.flex.html.beads.DateFieldView;
-	
-	/**
-	 * The DateFormatBead class formats the display of a DateField using MM/DD/YYYY format.
-	 *  
-     *  @flexjsignoreimport org.apache.flex.core.IStrandWithModel
-     * 
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10.2
-	 *  @playerversion AIR 2.6
-	 *  @productversion FlexJS 0.0
-	 */
-	public class DateFormatMMDDYYYYBead extends EventDispatcher implements IBead, IFormatBead
-	{
-		/**
-		 * constructor.
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function DateFormatMMDDYYYYBead()
-		{
-		}
-		
-		private var _propertyName:String;
-		private var _eventName:String;
-		private var _formattedResult:String;
-		
-		/**
-		 *  The name of the property on the model holding the value to be formatted.
-		 *  The default is selectedDate.
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function get propertyName():String
-		{
-			if (_propertyName == null) {
-				return "selectedDate";
-			}
-			return _propertyName;
-		}
-		public function set propertyName(value:String):void
-		{
-			_propertyName = value;
-		}
-		
-		/**
-		 *  The name of the event dispatched when the property changes. The
-		 *  default is selectedDateChanged.
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function get eventName():String
-		{
-			if (_eventName == null) {
-				return _propertyName+"Changed";
-			}
-			return _eventName;
-		}
-		public function set eventName(value:String):void
-		{
-			_eventName = value;
-		}
-		
-		/**
-		 *  The formatted result.
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function get formattedString():String
-		{
-			return _formattedResult;
-		}
-		
-		private var _strand:IStrand;
-		
-		/**
-		 *  @copy org.apache.flex.core.IBead#strand
-		 *  
-         *  @flexjsignorecoercion org.apache.flex.core.IStrandWithModel
-         * 
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function set strand(value:IStrand):void
-		{
-			_strand = value;
-			
-			var model:IDateChooserModel = IStrandWithModel(_strand).model as IDateChooserModel;
-			model.addEventListener("selectedDateChanged",handleTextChange);
-		}
-		
-		/**
-		 * @private
-         * 
-         * @flexjsignorecoercion org.apache.flex.core.IStrandWithModel
-		 */
-		private function handleTextChange(event:Event):void
-		{
-			var model:IDateChooserModel = IStrandWithModel(_strand).model as IDateChooserModel;
-			/*var view:DateFieldView = _strand.getBeadByType(DateFieldView) as DateFieldView;
-			var input:TextInput = view.textInput;*/
-			
-			var d:Date = model.selectedDate;
-			var month:String = String(d.getMonth()+1);
-			if (Number(month)<10) month = "0"+month;
-			var date:String = String(d.getDate());
-			if (Number(date)<10) date = "0"+date;
-			var fmt:String = month+"/"+date+"/"+String(d.getFullYear());
-			/*input.text = fmt;*/
-			_formattedResult = month+"/"+date+"/"+String(d.getFullYear());
-			
-			dispatchEvent( new Event("formatChanged") );
-		}
-		
-	}
-}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e2a806e3/frameworks/projects/Formatters/asjs/src/org/apache/flex/html/accessories/NumberFormatter.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Formatters/asjs/src/org/apache/flex/html/accessories/NumberFormatter.as b/frameworks/projects/Formatters/asjs/src/org/apache/flex/html/accessories/NumberFormatter.as
deleted file mode 100644
index 0d1b613..0000000
--- a/frameworks/projects/Formatters/asjs/src/org/apache/flex/html/accessories/NumberFormatter.as
+++ /dev/null
@@ -1,210 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  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.html.accessories
-{
-	import org.apache.flex.core.IBeadModel;
-	import org.apache.flex.core.IFormatBead;
-	import org.apache.flex.core.IStrand;
-	import org.apache.flex.events.Event;
-	import org.apache.flex.events.EventDispatcher;
-	import org.apache.flex.events.IEventDispatcher;
-	
-	/**
-	 * The NumberFormatter class formats a value in separated groups. The formatter listens
-	 * to a property on a model and when the property changes, formats it and dispatches a
-	 * formatChanged event.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10.2
-	 *  @playerversion AIR 2.6
-	 *  @productversion FlexJS 0.0
-	 */
-	public class NumberFormatter extends EventDispatcher implements IFormatBead
-	{
-		/**
-		 *  constructor
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function NumberFormatter()
-		{
-			super();
-		}
-		
-		private var _strand:IStrand;
-		
-		/**
-		 *  @copy org.apache.flex.core.IBead#strand
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function set strand(value:IStrand):void
-		{
-			_strand = value;
-			
-			// Listen for the beadsAdded event which signals when all of a strand's
-			// beads have been added.
-			IEventDispatcher(value).addEventListener("beadsAdded",handleBeadsAdded);
-		}
-		
-		/**
-		 * @private
-		 */
-		private function handleBeadsAdded(event:Event):void
-		{
-			// Listen for the change in the model
-			var model:IBeadModel = _strand.getBeadByType(IBeadModel) as IBeadModel;
-			model.addEventListener(eventName,propertyChangeHandler);
-			model.addEventListener(propertyName+"Change",propertyChangeHandler);
-			
-			// format the current value of that property
-			propertyChangeHandler(null);
-		}
-		
-		private var _propertyName:String;
-		private var _eventName:String;
-		private var _formattedResult:String;
-		private var _groupSize:Number = 3;
-		private var _thousandsSeparator:String = ",";
-		
-		/**
-		 *  The name of the property on the model to format.
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function get propertyName():String
-		{
-			if (_propertyName == null) {
-				return "text";
-			}
-			return _propertyName;
-		}
-		public function set propertyName(value:String):void
-		{
-			_propertyName = value;
-		}
-		
-		/**
-		 *  The event dispatched by the model when the property changes. The
-		 *  default is propertyName+"Changed".
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function get eventName():String
-		{
-			if (_eventName == null) {
-				return _propertyName+"Changed";
-			}
-			return _eventName;
-		}
-		public function set eventName(value:String):void
-		{
-			_eventName = value;
-		}
-		
-		/**
-		 *  Character to use to separate thousands groups. The default is
-		 *  the comma (,).
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function get thousandsSeparator():String
-		{
-			return _thousandsSeparator;
-		}
-		public function set thousandsSeparator(value:String):void
-		{
-			_thousandsSeparator = value;
-		}
-		
-		/**
-		 *  The formatted string.
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function get formattedString():String
-		{
-			return _formattedResult;
-		}
-		
-		/**
-		 * @private
-		 */
-		private function propertyChangeHandler(event:Event):void
-		{
-			// When the property changes, fetch it from the model and
-			// format it, storing the result in _formattedResult.
-			var model:IBeadModel = _strand.getBeadByType(IBeadModel) as IBeadModel;
-			var value:Object = model[propertyName];
-			_formattedResult = format(value);
-			
-			// Dispatch the formatChanged event so any bead that's interested in
-			// the formatted string knows to use it.
-			var newEvent:Event = new Event("formatChanged");
-			this.dispatchEvent(newEvent);
-		}
-		
-		/**
-		 * @private
-		 */
-		private function format(value:Object):String
-		{
-			if (value == null) return "";
-			
-			var num:Number = Number(value);
-			var source:String = String(value);
-			var parts:Array = source.split(thousandsSeparator);
-			source = parts.join("");
-			
-			var l:int = source.length;
-			var result:String = "";
-			var group:int = 0;
-			
-			for(var i:int=l-1; i >= 0; i--)
-			{
-				if (group == _groupSize && result.length > 0) {
-					result = thousandsSeparator + result;
-					group = 0;
-				}
-				result = source.charAt(i) + result;
-				group++;
-			}
-			
-			return result;
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e2a806e3/frameworks/projects/Formatters/asjs/src/org/apache/flex/html/beads/FormatableLabelView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Formatters/asjs/src/org/apache/flex/html/beads/FormatableLabelView.as b/frameworks/projects/Formatters/asjs/src/org/apache/flex/html/beads/FormatableLabelView.as
deleted file mode 100644
index 03b6ccd..0000000
--- a/frameworks/projects/Formatters/asjs/src/org/apache/flex/html/beads/FormatableLabelView.as
+++ /dev/null
@@ -1,90 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  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.html.beads
-{
-	import org.apache.flex.core.IFormatBead;
-	import org.apache.flex.core.IStrand;
-	import org.apache.flex.events.Event;
-	import org.apache.flex.events.IEventDispatcher;
-	
-	/**
-	 *  The FormatableLabelView class is a View bead that is capable of working
-	 *  with a format bead to display a formatted value. When the format bead has
-	 *  created a formatted string, it dispatches a formatChanged event that the
-	 *  FormatableLabelView class intercepts and displays in the label.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10.2
-	 *  @playerversion AIR 2.6
-	 *  @productversion FlexJS 0.0
-	 */
-	public class FormatableLabelView extends TextFieldView
-	{
-		/**
-		 *  constructor
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function FormatableLabelView()
-		{
-			super();
-		}
-		
-		private var _formatter:IFormatBead;
-		
-		/**
-		 *  @copy org.apache.flex.core.IBead#strand
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		override public function set strand(value:IStrand):void
-		{
-			super.strand = value;
-			IEventDispatcher(value).addEventListener("beadsAdded",handleBeadsAdded);
-		}
-		
-		/**
-		 * @private
-		 */
-		private function handleBeadsAdded(event:Event):void
-		{
-			_formatter = _strand.getBeadByType(IFormatBead) as IFormatBead;
-			_formatter.addEventListener("formatChanged",formatReadyHandler);
-			
-			// process any text set in the label at this moment
-			text = _formatter.formattedString;
-		}
-		
-		/**
-		 * @private
-		 */
-		private function formatReadyHandler(event:Event):void
-		{
-			if (_formatter) {
-				text = _formatter.formattedString;
-			}
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e2a806e3/frameworks/projects/Formatters/asjs/src/org/apache/flex/html/beads/FormatableTextInputView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Formatters/asjs/src/org/apache/flex/html/beads/FormatableTextInputView.as b/frameworks/projects/Formatters/asjs/src/org/apache/flex/html/beads/FormatableTextInputView.as
deleted file mode 100644
index 926253c..0000000
--- a/frameworks/projects/Formatters/asjs/src/org/apache/flex/html/beads/FormatableTextInputView.as
+++ /dev/null
@@ -1,91 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  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.html.beads
-{
-	import org.apache.flex.core.IFormatBead;
-	import org.apache.flex.core.IStrand;
-	import org.apache.flex.events.Event;
-	import org.apache.flex.events.IEventDispatcher;
-
-	/**
-	 *  The FormatableTextInputView class is a View bead that extends TextInputWithBorderView
-	 *  and is capable of working with a format bead. When a format bead dispatches a
-	 *  formatChanged event, the FormatableTextInputView bead copies the formatted string to
-	 *  to the text field.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10.2
-	 *  @playerversion AIR 2.6
-	 *  @productversion FlexJS 0.0
-	 */
-	public class FormatableTextInputView extends TextInputWithBorderView
-	{
-		/**
-		 *  constructor
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function FormatableTextInputView()
-		{
-			super();
-		}
-		
-		private var _formatter:IFormatBead;
-		
-		/**
-		 *  @copy org.apache.flex.core.IBead#strand
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		override public function set strand(value:IStrand):void
-		{
-			super.strand = value;
-			IEventDispatcher(value).addEventListener("beadsAdded",handleBeadsAdded);
-		}
-		
-		/**
-		 * @private
-		 */
-		private function handleBeadsAdded(event:Event):void
-		{
-			_formatter = _strand.getBeadByType(IFormatBead) as IFormatBead;
-			if (_formatter) {
-				_formatter.addEventListener("formatChanged",formatChangedHandler);
-			}
-		}
-		
-		/**
-		 * @private
-		 */
-		private function formatChangedHandler(event:Event):void
-		{
-			this.textField.text = _formatter.formattedString;
-			
-			// move the cursor to the end
-			var l:int = this.textField.text.length;
-			this.textField.setSelection(l,l);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e2a806e3/frameworks/projects/Formatters/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Formatters/build.xml b/frameworks/projects/Formatters/build.xml
index 1e3dab5..04a7bd2 100644
--- a/frameworks/projects/Formatters/build.xml
+++ b/frameworks/projects/Formatters/build.xml
@@ -28,31 +28,18 @@
     <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
     <property name="FALCON_HOME" value="${env.FALCON_HOME}"/>
     <property name="FALCONJX_HOME" value="${env.FALCONJX_HOME}"/>
-    <property name="gjslint" value="gjslint" />
-    <property name="jshint" value="jshint" />
-    <condition property="no.lint" value="true">
-        <os family="windows"/>
-    </condition>
-    
+
     <target name="main" depends="clean,compile,test" description="Clean build of Formatters.swc">
     </target>
-    
-    <target name="all" depends="main,compile-asjs,lint-js,test-js" description="Full build of Formatters.swc">
+
+    <target name="all" depends="clean,compile-asjs,compile-extern-swc,copy-js,compile,test" description="Full build of Formatters.swc">
     </target>
-    
+
     <target name="test" unless="is.jenkins">
         <!-- no tests yet
          <ant dir="as/tests" />
-         <ant dir="asjs/tests" />
-         -->
-    </target>
-    
-    <target name="test-js" unless="is.jenkins">
-        <!-- no tests yet
-         <ant dir="js/tests" />
          -->
     </target>
-
     
     <target name="clean">
         <delete failonerror="false">
@@ -85,7 +72,7 @@
             Link in the classes (and their dependencies) for the MXML tags
             listed in this project's manifest.xml.
             Also link the additional classes (and their dependencies)
-            listed in FormatterClasses.as,
+            listed in FormattersClasses.as,
             because these aren't referenced by the manifest classes.
             Keep the standard metadata when compiling.
             Include the appropriate CSS files and assets in the SWC.
@@ -99,11 +86,13 @@
             <load-config filename="compile-config.xml" />
             <arg value="+playerglobal.version=${playerglobal.version}" />
             <arg value="+env.AIR_HOME=${env.AIR_HOME}" />
+            <arg value="-define=COMPILE::AS3,true" />
+            <arg value="-define=COMPILE::JS,false" />
         </compc>
     </target>
 
-    <target name="compile-asjs" >
-        <echo message="Cross-compiling Formatters/asjs"/>
+    <target name="compile-asjs">
+        <echo message="Cross-compiling Formatters"/>
         <echo message="FALCONJX_HOME: ${FALCONJX_HOME}"/>
         <java jar="${FALCONJX_HOME}/lib/compc.jar" fork="true" >
             <jvmarg value="-Xmx384m" />
@@ -118,45 +107,56 @@
             <arg value="+playerglobal.version=${playerglobal.version}" />
             <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" />
             <arg value="+env.AIR_HOME=${env.AIR_HOME}" />
+            <arg value="-external-library-path+=${FALCONJX_HOME}/../externs/js/out/bin/js.swc" />
+            <!-- this is not on external-library path otherwise goog.requires are not generated -->
+            <arg value="-library-path+=${FALCONJX_HOME}/../externs/GCL/out/bin/GCL.swc" />
+            <arg value="-define=COMPILE::AS3,false" />
+            <arg value="-define=COMPILE::JS,true" />
         </java>
     </target>
 
-    <target name="lint-js" depends="gjslint, jshint, copy-js" />
-    <target name="copy-js" >
+    <target name="compile-extern-swc" description="Compiles .as files into .swc used for cross-compiling other projects">
+        <echo message="Compiling externs/Formatters.swc"/>
+        <echo message="FLEX_HOME: ${FLEX_HOME}"/>
+        <echo message="FALCON_HOME: ${FALCON_HOME}"/>
+        <!-- make JS output folder now so include-file doesn't error -->
+        <mkdir dir="${FLEXJS_HOME}/frameworks/externs"/>
+        
+        <!-- Load the <compc> task. We can't do this at the <project> level -->
+        <!-- because targets that run before flexTasks.jar gets built would fail. -->
+        <taskdef resource="flexTasks.tasks" classpathref="lib.path"/>
+        <!--
+         Link in the classes (and their dependencies) for the MXML tags
+         listed in this project's manifest.xml.
+         Also link the additional classes (and their dependencies)
+         listed in CoreClasses.as,
+         because these aren't referenced by the manifest classes.
+         Keep the standard metadata when compiling.
+         Include the appropriate CSS files and assets in the SWC.
+         Don't include any resources in the SWC.
+         Write a bundle list of referenced resource bundles
+         into the file bundles.properties in this directory.
+         -->
+        <compc fork="true"
+            output="${FLEXJS_HOME}/frameworks/externs/Formatters.swc">
+            <jvmarg line="${compc.jvm.args}"/>
+            <load-config filename="compile-asjs-config.xml" />
+            <arg value="+playerglobal.version=${playerglobal.version}" />
+            <arg value="+env.AIR_HOME=${env.AIR_HOME}" />
+            <arg value="-external-library-path+=${FALCONJX_HOME}/../externs/js/out/bin/js.swc" />
+            <!-- this is not on external-library path otherwise goog.requires are not generated -->
+            <arg value="-library-path+=${FALCONJX_HOME}/../externs/GCL/out/bin/GCL.swc" />
+            <arg value="-define=COMPILE::AS3,false" />
+            <arg value="-define=COMPILE::JS,true" />
+        </compc>
+    </target>
+
+    <target name="copy-js">
         <copy todir="${FLEXJS_HOME}/frameworks/js/FlexJS/libs">
-            <fileset dir="${basedir}/js/src">
-                <include name="**/**" />
-            </fileset>
             <fileset dir="${basedir}/js/out">
-                <include name="**/**" />
+                <include name="**/**"/>
             </fileset>
         </copy>
     </target>
 
-    <target name="gjslint" unless="no.lint">
-        <echo>running gjslint</echo>
-        <exec executable="${gjslint}" dir="${basedir}" failonerror="true">
-            <arg value="--strict" />
-            <arg value="--disable" />
-            <arg value="006,100,214,300" />
-            <!-- 006: wrong indentation -->
-            <!-- 100: cannot have non-primitive value -->
-            <!-- 214: @fileoverview tag missing description -->
-            <!-- 300: missing newline at end of file -->
-            <arg value="--max_line_length" />
-            <arg value="120" />
-            <arg value="-r" />
-            <arg value="${basedir}/js/src" />
-        </exec>
-    </target>
-
-    <target name="jshint" unless="no.lint">
-        <echo>running jshint</echo>
-        <exec executable="${jshint}" dir="${basedir}" failonerror="true">
-            <arg value="--config" />
-            <arg value="${FLEX_HOME}/frameworks/js/jshint.properties" />
-            <arg value="${basedir}/js/src" />
-        </exec>
-    </target>
-
 </project>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e2a806e3/frameworks/projects/Formatters/compile-asjs-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Formatters/compile-asjs-config.xml b/frameworks/projects/Formatters/compile-asjs-config.xml
index d688c63..4632bc2 100644
--- a/frameworks/projects/Formatters/compile-asjs-config.xml
+++ b/frameworks/projects/Formatters/compile-asjs-config.xml
@@ -48,11 +48,10 @@
              will not be listed -->
             <path-element>../../libs/Core.swc</path-element>
             <path-element>../../libs/HTML.swc</path-element>
-            <path-element>../../libs/Formatters.swc</path-element>
         </library-path>
         
         <source-path>
-            <path-element>asjs/src</path-element>
+            <path-element>as/src</path-element>
         </source-path>
         
         <warn-no-constructor>false</warn-no-constructor>
@@ -62,7 +61,7 @@
     </include-file>
 
     <include-sources>
-        <path-element>asjs/src</path-element>
+        <path-element>as/src</path-element>
     </include-sources>
     
     <include-namespaces>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e2a806e3/frameworks/projects/Formatters/compile-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Formatters/compile-config.xml b/frameworks/projects/Formatters/compile-config.xml
index 6e59964..3fcc71c 100644
--- a/frameworks/projects/Formatters/compile-config.xml
+++ b/frameworks/projects/Formatters/compile-config.xml
@@ -55,7 +55,6 @@
         
         <source-path>
             <path-element>as/src</path-element>
-            <path-element>asjs/src</path-element>
         </source-path>
         
         <warn-no-constructor>false</warn-no-constructor>
@@ -72,7 +71,6 @@
 
     <include-classes>
         <class>FormattersClasses</class>
-        <class>FormattersASJSClasses</class>
     </include-classes>
     
     <include-namespaces>


Mime
View raw message