You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jm...@apache.org on 2017/04/17 04:24:48 UTC
[2/6] git commit: [flex-asjs] [refs/heads/develop] - move all code to
SimpleDateFormatBead and changed to allow different date formats
move all code to SimpleDateFormatBead and changed to allow different date formats
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/ee791117
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/ee791117
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/ee791117
Branch: refs/heads/develop
Commit: ee791117cf6fc79e7b329c755342b2623fe828d0
Parents: df2e0fb
Author: Justin Mclean <jm...@apache.org>
Authored: Mon Apr 17 13:23:31 2017 +1000
Committer: Justin Mclean <jm...@apache.org>
Committed: Mon Apr 17 13:23:31 2017 +1000
----------------------------------------------------------------------
.../html/accessories/DateFormatMMDDYYYYBead.as | 125 ++-----------------
1 file changed, 8 insertions(+), 117 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ee791117/frameworks/projects/Formatters/src/main/flex/org/apache/flex/html/accessories/DateFormatMMDDYYYYBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Formatters/src/main/flex/org/apache/flex/html/accessories/DateFormatMMDDYYYYBead.as b/frameworks/projects/Formatters/src/main/flex/org/apache/flex/html/accessories/DateFormatMMDDYYYYBead.as
index 682eaaa..5519eba 100644
--- a/frameworks/projects/Formatters/src/main/flex/org/apache/flex/html/accessories/DateFormatMMDDYYYYBead.as
+++ b/frameworks/projects/Formatters/src/main/flex/org/apache/flex/html/accessories/DateFormatMMDDYYYYBead.as
@@ -18,31 +18,21 @@
////////////////////////////////////////////////////////////////////////////////
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;
-
+ import org.apache.flex.html.accessories.SimpleDateFormatBead;
+
/**
* 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
+ public class DateFormatMMDDYYYYBead extends SimpleDateFormatBead
{
/**
* constructor.
- *
+ *
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
@@ -50,108 +40,9 @@ package org.apache.flex.html.accessories
*/
public function DateFormatMMDDYYYYBead()
{
+ format = "MM/DD/YYYY";
}
-
- 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 d:Date = model.selectedDate;
- if (d != null) {
- 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());
- _formattedResult = month+"/"+date+"/"+String(d.getFullYear());
-
- dispatchEvent( new Event("formatChanged") );
- }
- }
-
+
}
}
+