You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2014/08/08 19:06:10 UTC

git commit: [flex-asjs] [refs/heads/develop] - Updated formatting beads with the introduction of a FormatBase that is implemented natively in JS and AS.

Repository: flex-asjs
Updated Branches:
  refs/heads/develop eadf66c82 -> 910d4d9c7


Updated formatting beads with the introduction of a FormatBase that is implemented natively in JS and AS.


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

Branch: refs/heads/develop
Commit: 910d4d9c7822ab4710087896acfaeff01eb40e49
Parents: eadf66c
Author: Peter Ent <pe...@apache.org>
Authored: Fri Aug 8 11:16:44 2014 -0400
Committer: Peter Ent <pe...@apache.org>
Committed: Fri Aug 8 11:16:44 2014 -0400

----------------------------------------------------------------------
 examples/DrawShapesTest/src/DrawShapesTest.mxml |  34 ---
 examples/DrawShapesTest/src/MyInitialView.mxml  |  63 ------
 .../src/org/apache/flex/core/IFormatBead.as     |  69 ------
 .../flex/html/accessories/NumberFormatter.as    | 210 +++++++++++++++++++
 .../flex/html/beads/FormatableTextInputView.as  |   4 +-
 .../as/projects/FlexJSUI/src/FlexJSUIClasses.as |   1 +
 .../src/org/apache/flex/core/FormatBase.as      | 115 ++++++++++
 .../src/org/apache/flex/core/IFormatBead.as     |  69 ++++++
 .../flex/html/accessories/TextPromptBead.as     |   2 +-
 .../apache/flex/html/beads/models/TextModel.as  |   5 +-
 .../src/org/apache/flex/core/FormatBase.js      | 144 +++++++++++++
 .../src/org/apache/flex/core/ITextModel.js      |  59 ++++++
 .../src/org/apache/flex/html/TextInput.js       |   2 +
 .../flex/html/beads/TextInputWithBorderView.js  |  44 ++++
 .../apache/flex/html/beads/models/TextModel.js  |  76 +++++++
 15 files changed, 727 insertions(+), 170 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/910d4d9c/examples/DrawShapesTest/src/DrawShapesTest.mxml
----------------------------------------------------------------------
diff --git a/examples/DrawShapesTest/src/DrawShapesTest.mxml b/examples/DrawShapesTest/src/DrawShapesTest.mxml
deleted file mode 100644
index af18e70..0000000
--- a/examples/DrawShapesTest/src/DrawShapesTest.mxml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!---
-//
-//  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.
-//
-////////////////////////////////////////////////////////////////////////////////
--->
-<basic:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
-				   xmlns:local="*"
-				   xmlns:models="models.*"
-				   xmlns:basic="library://ns.apache.org/flexjs/basic" 
-				   >
-	
-	<basic:valuesImpl>
-		<basic:SimpleCSSValuesImpl />
-	</basic:valuesImpl>
-	<basic:initialView>
-		<local:MyInitialView />
-	</basic:initialView>
-</basic:Application>
-

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/910d4d9c/examples/DrawShapesTest/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/DrawShapesTest/src/MyInitialView.mxml b/examples/DrawShapesTest/src/MyInitialView.mxml
deleted file mode 100644
index c1a7753..0000000
--- a/examples/DrawShapesTest/src/MyInitialView.mxml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-
-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.
-
--->
-<basic:ViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
-				xmlns:basic="library://ns.apache.org/flexjs/basic"
-				xmlns:svg="library:"
-				xmlns:local="*" 
-				xmlns:models="models.*"
->
-	<fx:Script>
-		<![CDATA[
-			
-			
-		]]>
-	</fx:Script>
-	
-	<basic:Label id="output" x="450" y="30" width="100" />
-	
-	<basic:BarChart id="barChart" x="20" y="20" width="400" height="200">
-		<basic:beads>
-			<basic:ConstantBinding
-				sourceID="applicationModel"
-				sourcePropertyName="productList"
-				destinationPropertyName="dataProvider" />
-			<basic:XAxisBead labelField="title" />
-		</basic:beads>
-		<basic:series>
-			<basic:BarChartSeries yField="sales" 
-								  fillColor="0xFF964D">
-				<basic:itemRenderer>
-                    <fx:Component>
-                        <basic:BoxItemRenderer />                        
-                    </fx:Component>
-				</basic:itemRenderer>
-			</basic:BarChartSeries>
-			<basic:BarChartSeries yField="detail" 
-								  fillColor="0x964DFF">
-				<basic:itemRenderer>
-                    <fx:Component>
-                        <basic:BoxItemRenderer />                        
-                    </fx:Component>
-				</basic:itemRenderer>
-			</basic:BarChartSeries>
-		</basic:series>
-	</basic:BarChart>
-	
-</basic:ViewBase>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/910d4d9c/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/IFormatBead.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/IFormatBead.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/IFormatBead.as
deleted file mode 100644
index 3880f5a..0000000
--- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/IFormatBead.as
+++ /dev/null
@@ -1,69 +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.core
-{
-	import org.apache.flex.events.IEventDispatcher;
-
-	/**
-	 *  The IFormatBead interface should be implemented by any bead that
-	 *  provides a formatting service. When the bead instance is created it
-	 *  should listen for change events and set its formattedString property
-	 *  for later retrieveal. 
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10.2
-	 *  @playerversion AIR 2.6
-	 *  @productversion FlexJS 0.0
-	 */
-	public interface IFormatBead extends IBead, IEventDispatcher
-	{
-		/**
-		 *  The name of the property for the source to be formatted. 
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		function get propertyName():String;
-		function set propertyName(value:String):void;
-		
-		/**
-		 *  The name of the event to listen for, indicating that propertyName
-		 *  property has changed. The default event is propertyName+"Changed". 
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		function get eventName():String;
-		function set eventName(value:String):void;
-		
-		/**
-		 *  The formatted result. 
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		function get formattedString():String;
-	}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/910d4d9c/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/accessories/NumberFormatter.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/accessories/NumberFormatter.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/accessories/NumberFormatter.as
new file mode 100644
index 0000000..0d1b613
--- /dev/null
+++ b/frameworks/as/projects/FlexJSJX/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/910d4d9c/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/beads/FormatableTextInputView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/beads/FormatableTextInputView.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/beads/FormatableTextInputView.as
index f6a5d57..d6d803d 100644
--- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/beads/FormatableTextInputView.as
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/beads/FormatableTextInputView.as
@@ -71,7 +71,9 @@ package org.apache.flex.html.beads
 		private function handleBeadsAdded(event:Event):void
 		{
 			_formatter = strand.getBeadByType(IFormatBead) as IFormatBead;
-			_formatter.addEventListener("formatChanged",formatChangedHandler);
+			if (_formatter) {
+				_formatter.addEventListener("formatChanged",formatChangedHandler);
+			}
 		}
 		
 		/**

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/910d4d9c/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as b/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
index b7c3627..b32e09d 100644
--- a/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
+++ b/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
@@ -103,6 +103,7 @@ internal class FlexJSUIClasses
 	import org.apache.flex.html.supportClasses.NonVirtualDataGroup; NonVirtualDataGroup;
     import org.apache.flex.core.ItemRendererClassFactory; ItemRendererClassFactory;  
 	import org.apache.flex.core.FilledRectangle; FilledRectangle;
+	import org.apache.flex.core.FormatBase; FormatBase;
 	import org.apache.flex.events.CustomEvent; CustomEvent;
 	import org.apache.flex.events.Event; Event;
 	import org.apache.flex.events.ValueEvent; ValueEvent;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/910d4d9c/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/FormatBase.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/FormatBase.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/FormatBase.as
new file mode 100644
index 0000000..1056978
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/FormatBase.as
@@ -0,0 +1,115 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.core
+{
+	import flash.events.Event;
+	
+	import org.apache.flex.events.Event;
+	import org.apache.flex.events.EventDispatcher;
+	import org.apache.flex.events.IEventDispatcher;
+	
+	public class FormatBase extends EventDispatcher implements IFormatBead
+	{
+		public function FormatBase()
+		{
+		}
+		
+		/**
+		 *  Retrieves the current value of the property from the strand.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get propertyValue():Object
+		{
+			var model:IBeadModel = _strand.getBeadByType(IBeadModel) as IBeadModel;
+			var value:Object = model[propertyName];
+			return value;
+		}
+		
+		private var _propertyName:String;
+		
+		/**
+		 *  The name of the property in the model holding the value to be
+		 *  formatted. The default is text.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get propertyName():String
+		{
+			if (_propertyName == null) {
+				_propertyName = "text";
+			}
+			return _propertyName;
+		}
+		public function set propertyName(value:String):void
+		{
+			_propertyName = value;
+		}
+		
+		private var _eventName:String;
+		
+		/**
+		 *  The name of the event dispatched 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;
+		}
+		
+		/**
+		 *  The resulting formatted value as a string.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get formattedString():String
+		{
+			// override to produce actual result
+			return null;
+		}
+		
+		private var _strand:IStrand;
+		
+		public function set strand(value:IStrand):void
+		{
+			_strand = value;
+		}
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/910d4d9c/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IFormatBead.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IFormatBead.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IFormatBead.as
new file mode 100644
index 0000000..3880f5a
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IFormatBead.as
@@ -0,0 +1,69 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.core
+{
+	import org.apache.flex.events.IEventDispatcher;
+
+	/**
+	 *  The IFormatBead interface should be implemented by any bead that
+	 *  provides a formatting service. When the bead instance is created it
+	 *  should listen for change events and set its formattedString property
+	 *  for later retrieveal. 
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	public interface IFormatBead extends IBead, IEventDispatcher
+	{
+		/**
+		 *  The name of the property for the source to be formatted. 
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		function get propertyName():String;
+		function set propertyName(value:String):void;
+		
+		/**
+		 *  The name of the event to listen for, indicating that propertyName
+		 *  property has changed. The default event is propertyName+"Changed". 
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		function get eventName():String;
+		function set eventName(value:String):void;
+		
+		/**
+		 *  The formatted result. 
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		function get formattedString():String;
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/910d4d9c/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/accessories/TextPromptBead.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/accessories/TextPromptBead.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/accessories/TextPromptBead.as
index 36bf732..b74eba7 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/accessories/TextPromptBead.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/accessories/TextPromptBead.as
@@ -89,7 +89,7 @@ package org.apache.flex.html.accessories
 			if (!model.hasOwnProperty("text")) {
 				throw new Error("Model requires a text property when used with TextPromptBead");
 			}
-			IEventDispatcher(model).addEventListener("textChange",handleTextChange);
+			IEventDispatcher(_strand).addEventListener("textChanged",handleTextChange);
 			
 			// create a TextField that displays the prompt - it shows
 			// and hides based on the model's content

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/910d4d9c/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/TextModel.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/TextModel.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/TextModel.as
index 65d4447..71cc55f 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/TextModel.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/TextModel.as
@@ -23,6 +23,7 @@ package org.apache.flex.html.beads.models
 	import org.apache.flex.core.ITextModel;
 	import org.apache.flex.events.Event;
 	import org.apache.flex.events.EventDispatcher;
+	import org.apache.flex.events.IEventDispatcher;
 		
     /**
      *  The TextModel class is most basic data model for a
@@ -88,7 +89,7 @@ package org.apache.flex.html.beads.models
 			if (value != _text)
 			{
 				_text = value;
-				dispatchEvent(new Event("textChange"));
+				IEventDispatcher(_strand).dispatchEvent(new Event("textChanged"));
 			}
 		}
 		
@@ -115,7 +116,7 @@ package org.apache.flex.html.beads.models
 			if (value != _html)
 			{
 				_html = value;
-				dispatchEvent(new Event("htmlChange"));
+				IEventDispatcher(_strand).dispatchEvent(new Event("htmlChanged"));
 			}
 		}
 	}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/910d4d9c/frameworks/js/FlexJS/src/org/apache/flex/core/FormatBase.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/FormatBase.js b/frameworks/js/FlexJS/src/org/apache/flex/core/FormatBase.js
new file mode 100644
index 0000000..e80f0af
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/FormatBase.js
@@ -0,0 +1,144 @@
+/**
+ * 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.
+ */
+
+/**
+ * @fileoverview
+ * @suppress {checkTypes}
+ */
+
+goog.provide('org.apache.flex.core.FormatBase');
+
+goog.require('org.apache.flex.core.IFormatBead');
+goog.require('org.apache.flex.events.EventDispatcher');
+
+
+
+/**
+ * @constructor
+ * @implements {org.apache.flex.core.IFormatBead}
+ * @extends {org.apache.flex.events.EventDispatcher}
+ */
+org.apache.flex.core.FormatBase = function() {
+  goog.base(this);
+};
+goog.inherits(org.apache.flex.core.FormatBase,
+    org.apache.flex.events.EventDispatcher);
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.core.FormatBase.prototype.FLEXJS_CLASS_INFO =
+    { names: [{ name: 'FormatBase',
+                qName: 'org.apache.flex.core.FormatBase' }],
+      interfaces: [org.apache.flex.core.IFormatBead] };
+
+
+/**
+ * @private
+ * @type {org.apache.flex.core.IStrand}
+ */
+org.apache.flex.core.FormatBase.prototype.strand_ = null;
+
+
+/**
+ * @expose
+ * @param {org.apache.flex.core.IStrand} value
+ */
+org.apache.flex.core.FormatBase.prototype.set_strand = function(value) {
+  this.strand_ = value;
+};
+
+
+/**
+ * @type {string}
+ */
+org.apache.flex.core.FormatBase.prototype._propertyName = 'text';
+
+
+/**
+ * @type {string}
+ */
+org.apache.flex.core.FormatBase.prototype._eventName = 'textChanged';
+
+
+/**
+ * @type {string}
+ */
+org.apache.flex.core.FormatBase.prototype._formattedResult = '';
+
+
+/**
+ * @expose
+ * @return {Object}
+ */
+org.apache.flex.core.FormatBase.prototype.get_propertyValue = function() {
+  var statement = 'this.strand_.get_' + this.get_propertyName() + '()';
+  var value = eval(statement);
+  return value;
+};
+
+
+/**
+ * @expose
+ * @return {string}
+ */
+org.apache.flex.core.FormatBase.prototype.get_propertyName = function() {
+  if (this._propertyName == null) {
+    this._propertyName = 'text';
+  }
+  return this._propertyName;
+};
+
+
+/**
+ * @expose
+ * @param {string} value
+ */
+org.apache.flex.core.FormatBase.prototype.set_propertyName = function(value) {
+  this._propertyName = value;
+};
+
+
+/**
+ * @expose
+ * @return {string}
+ */
+org.apache.flex.core.FormatBase.prototype.get_eventName = function() {
+  if (this._eventName == null) {
+    return this._propertyName + 'Changed';
+  }
+  return this._eventName;
+};
+
+
+/**
+ * @expose
+ * @param {string} value
+ */
+org.apache.flex.core.FormatBase.prototype.set_eventName = function(value) {
+  this._eventName = value;
+};
+
+
+/**
+ * @expose
+ * @return {string}
+ */
+org.apache.flex.core.FormatBase.prototype.get_formattedString = function() {
+  return null;
+};
+

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/910d4d9c/frameworks/js/FlexJS/src/org/apache/flex/core/ITextModel.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/ITextModel.js b/frameworks/js/FlexJS/src/org/apache/flex/core/ITextModel.js
new file mode 100644
index 0000000..85c1d97
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/ITextModel.js
@@ -0,0 +1,59 @@
+/**
+ * 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.
+ */
+
+/**
+ * org.apache.flex.core.ITextModel
+ *
+ * @fileoverview
+ *
+ * @suppress {checkTypes}
+ */
+
+goog.provide('org.apache.flex.core.ITextModel');
+
+goog.require('org.apache.flex.core.IBeadModel');
+
+
+
+/**
+ * @interface
+ * @extends {org.apache.flex.events.IEventDispatcher}
+ * @extends {org.apache.flex.core.IBeadModel}
+ */
+org.apache.flex.core.ITextModel = function() {
+};
+
+
+/**
+ * @expose
+ * @param {Object} value The text content.
+ */
+org.apache.flex.core.ITextModel.prototype.set_text = function(value) {};
+
+
+/**
+ * @expose
+ * @return {Object} The text content.
+ */
+org.apache.flex.core.ITextModel.prototype.get_text = function() {};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.core.ITextModel.prototype.FLEXJS_CLASS_INFO =
+{ names: [{ name: 'ITextModel', qName: 'org.apache.flex.core.ITextModel'}],
+  interfaces: [org.apache.flex.events.IEventDispatcher, org.apache.flex.core.IBeadModel] };

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/910d4d9c/frameworks/js/FlexJS/src/org/apache/flex/html/TextInput.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/TextInput.js b/frameworks/js/FlexJS/src/org/apache/flex/html/TextInput.js
index 74eab24..91bebd6 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/TextInput.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/TextInput.js
@@ -72,6 +72,7 @@ org.apache.flex.html.TextInput.prototype.get_text = function() {
  */
 org.apache.flex.html.TextInput.prototype.set_text = function(value) {
   this.element.value = value;
+  this.dispatchEvent(new org.apache.flex.events.Event('textChanged'));
 };
 
 
@@ -92,4 +93,5 @@ org.apache.flex.html.TextInput.prototype.inputChangeHandler_ = function(event) {
   event.stopPropagation();
 
   this.dispatchEvent(new org.apache.flex.events.Event(org.apache.flex.events.Event.EventType.CHANGE));
+  this.dispatchEvent(new org.apache.flex.events.Event('textChanged'));
 };

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/910d4d9c/frameworks/js/FlexJS/src/org/apache/flex/html/beads/TextInputWithBorderView.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/beads/TextInputWithBorderView.js b/frameworks/js/FlexJS/src/org/apache/flex/html/beads/TextInputWithBorderView.js
new file mode 100644
index 0000000..26109ee
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/beads/TextInputWithBorderView.js
@@ -0,0 +1,44 @@
+/**
+ * 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.beads.TextInputWithBorderView');
+
+
+
+/**
+ * @constructor
+ */
+org.apache.flex.html.beads.TextInputWithBorderView = function() {
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.html.beads.TextInputWithBorderView
+  .prototype.FLEXJS_CLASS_INFO =
+    { names: [{ name: 'TextInputWithBorderView',
+                qName: 'org.apache.flex.html.beads.TextInputWithBorderView'}] };
+
+
+/**
+ * @expose
+ * @param {Object} value The strand.
+ */
+org.apache.flex.html.beads.TextInputWithBorderView.prototype.
+    set_strand = function(value) {
+  this.strand_ = value;
+};

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/910d4d9c/frameworks/js/FlexJS/src/org/apache/flex/html/beads/models/TextModel.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/beads/models/TextModel.js b/frameworks/js/FlexJS/src/org/apache/flex/html/beads/models/TextModel.js
new file mode 100644
index 0000000..d19386e
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/beads/models/TextModel.js
@@ -0,0 +1,76 @@
+/**
+ * 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.beads.models.TextModel');
+
+goog.require('org.apache.flex.core.ITextModel');
+goog.require('org.apache.flex.events.EventDispatcher');
+
+
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.events.EventDispatcher}
+ * @implements {org.apache.flex.core.ITextModel}
+ */
+org.apache.flex.html.beads.models.TextModel =
+    function() {
+  org.apache.flex.html.beads.models.TextModel.base(this, 'constructor');
+  this.className = 'TextModel';
+};
+goog.inherits(
+    org.apache.flex.html.beads.models.TextModel,
+    org.apache.flex.events.EventDispatcher);
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.html.beads.models.TextModel.prototype.FLEXJS_CLASS_INFO =
+    { names: [{ name: 'TextModel',
+                qName: 'org.apache.flex.html.beads.models.TextModel' }],
+      interfaces: [org.apache.flex.core.ITextModel] };
+
+
+/**
+ * @expose
+ * @param {Object} value The strand.
+ */
+org.apache.flex.html.beads.models.TextModel.prototype.
+    set_strand = function(value) {
+  this.strand_ = value;
+};
+
+
+/**
+ * @expose
+ * @return {Object} value The text.
+ */
+org.apache.flex.html.beads.models.TextModel.prototype.
+    get_text = function() {
+  return this.text_;
+};
+
+
+/**
+ * @expose
+ * @param {Object} value The text.
+ */
+org.apache.flex.html.beads.models.TextModel.prototype.
+    set_text = function(value) {
+  this.text_ = value;
+  this.dispatchEvent('textChanged');
+};