You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2020/02/27 21:42:28 UTC
[royale-asjs] 01/02: implement IDropInListItemRenderer on DateField
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit d87342cf6d04343933812efae06bea6f9760c857
Author: Alex Harui <ah...@apache.org>
AuthorDate: Thu Feb 27 13:31:53 2020 -0800
implement IDropInListItemRenderer on DateField
---
.../src/main/royale/mx/controls/DateField.as | 54 ++++----
.../royale/mx/controls/listClasses/ListData.as | 144 +++++++++++++++++++++
2 files changed, 172 insertions(+), 26 deletions(-)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/DateField.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/DateField.as
index 19d7d72..5634293 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/DateField.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/DateField.as
@@ -30,9 +30,12 @@ import flash.geom.Point;
import flash.geom.Rectangle;
import flash.ui.Keyboard; */
-//import mx.controls.dataGridClasses.DataGridListData;
+import mx.controls.dataGridClasses.DataGridListData;
import mx.controls.beads.DateFieldView;
import mx.controls.listClasses.BaseListData;
+import mx.controls.listClasses.IDropInListItemRenderer;
+import mx.controls.listClasses.IListItemRenderer;
+import mx.controls.listClasses.ListData;
import mx.core.ClassFactory;
import mx.core.IDataRenderer;
import mx.core.IFactory;
@@ -404,10 +407,9 @@ include "../styles/metadata/TextStyles.as" */
* @playerversion AIR 1.1
* @productversion Flex 3
*/
-public class DateField extends ComboBase
-
+public class DateField extends ComboBase implements IDataRenderer,IFocusManagerComponent, IDropInListItemRenderer, IListItemRenderer
{
- /* implements IDataRenderer,IFocusManagerComponent, IDropInListItemRenderer, IListItemRenderer */
+
// include "../core/Version.as";
//--------------------------------------------------------------------------
@@ -883,10 +885,10 @@ public class DateField extends ComboBase
* @private
* Storage for the data property
*/
- /* private var _data:Object;
+ private var _data:Object;
[Bindable("dataChange")]
- [Inspectable(environment="none")] */
+ [Inspectable(environment="none")]
/**
* The <code>data</code> property lets you pass a value
@@ -906,15 +908,15 @@ public class DateField extends ComboBase
* @playerversion AIR 1.1
* @productversion Flex 3
*/
- /* public function get data():Object
+ public function get data():Object
{
return _data;
- } */
+ }
/**
* @private
*/
- /* public function set data(value:Object):void
+ public function set data(value:Object):void
{
var newDate:Date;
@@ -932,14 +934,14 @@ public class DateField extends ComboBase
else
newDate = _data as Date;
- if (!selectedDateSet)
- {
+ //if (!selectedDateSet)
+ //{
selectedDate = newDate;
- selectedDateSet = false;
- }
+ // selectedDateSet = false;
+ //}
dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
- } */
+ }
//----------------------------------
// dayNames
@@ -1502,10 +1504,10 @@ public class DateField extends ComboBase
* @private
* Storage for the listData property
*/
- /* private var _listData:BaseListData;
+ private var _listData:Object;
[Bindable("dataChange")]
- [Inspectable(environment="none")] */
+ [Inspectable(environment="none")]
/**
* When a component is used as a drop-in item renderer or drop-in
@@ -1527,18 +1529,18 @@ public class DateField extends ComboBase
* @playerversion AIR 1.1
* @productversion Flex 3
*/
- /* public function get listData():BaseListData
+ public function get listData():Object
{
return _listData;
- } */
+ }
/**
* @private
*/
- /* public function set listData(value:BaseListData):void
+ public function set listData(value:Object):void
{
_listData = value;
- } */
+ }
//----------------------------------
// maxYear
@@ -1765,9 +1767,9 @@ public class DateField extends ComboBase
* @private
* Storage for the parseFunction property.
*/
- /* private var _parseFunction:Function = DateField.stringToDate;
+ private var _parseFunction:Function = DateField.stringToDate;
- [Bindable("parseFunctionChanged")] */
+ [Bindable("parseFunctionChanged")]
/**
* Function used to parse the date entered as text
@@ -1804,20 +1806,20 @@ public class DateField extends ComboBase
* @playerversion AIR 1.1
* @productversion Flex 3
*/
- /* public function get parseFunction():Function
+ public function get parseFunction():Function
{
return _parseFunction;
- } */
+ }
/**
* @private
*/
- /* public function set parseFunction(value:Function):void
+ public function set parseFunction(value:Function):void
{
_parseFunction = value;
dispatchEvent(new Event("parseFunctionChanged"));
- } */
+ }
//----------------------------------
// selectableRange
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/ListData.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/ListData.as
new file mode 100644
index 0000000..de8ef55
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/ListData.as
@@ -0,0 +1,144 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 mx.controls.listClasses
+{
+
+import mx.core.IUIComponent;
+
+/**
+ * The ListData class defines the data type of the <code>listData</code>
+ * property implemented by drop-in item renderers or drop-in item editors
+ * for the List control.
+ * All drop-in item renderers and drop-in item editors must implement
+ * the IDropInListItemRenderer interface, which defines
+ * the <code>listData</code> property.
+ *
+ * <p>While the properties of this class are writable,
+ * you should consider them to be read only.
+ * They are initialized by the List class,
+ * and read by an item renderer or item editor.
+ * Changing these values can lead to unexpected results.</p>
+ *
+ * @see mx.controls.listClasses.IDropInListItemRenderer
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+public class ListData extends BaseListData
+{
+// include "../../core/Version.as";
+
+ //--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * Constructor.
+ *
+ * @param text Text representation of the item data.
+ *
+ * @param icon A Class or String object representing the icon
+ * for the item in the List control.
+ *
+ * @param labelField The name of the field of the data provider
+ * containing the label data of the List component.
+ *
+ * @param uid A unique identifier for the item.
+ *
+ * @param owner A reference to the List control.
+ *
+ * @param rowIndex The index of the item in the data provider
+ * for the List control.
+ *
+ * @param columnIndex The index of the column in the currently visible columns of the
+ * control.
+ *
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function ListData(text:String, icon:Class, labelField:String,
+ uid:String, owner:IUIComponent, rowIndex:int = 0,
+ columnIndex:int = 0)
+ {
+ super(text, uid, owner, rowIndex, columnIndex);
+
+ this.icon = icon;
+ this.labelField = labelField;
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // Properties
+ //
+ //--------------------------------------------------------------------------
+
+ //----------------------------------
+ // icon
+ //----------------------------------
+
+ [Bindable("__NoChangeEvent__")]
+
+ /**
+ * A Class representing the icon for the item in the List control computed
+ * from the list class's <code>itemToIcon()</code> method
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public var icon:Class;
+
+ //----------------------------------
+ // labelField
+ //----------------------------------
+
+ [Bindable("__NoChangeEvent__")]
+
+ /**
+ * The value of the <code>labelField</code> property in the list class.
+ * This is the value normally used to calculate which property should
+ * be taken from the item in the data provider for the text displayed
+ * in the item renderer, but is also used by DateField and other
+ * components to indicate which field to take from the data provider item
+ * that contains a Date or other non-text property.
+ *
+ * <p>For example, if a data provider item contains a "hiredDate" property,
+ * the <code>labelField</code> property can be set to "hiredDate"
+ * and the <code>itemRenderer</code> property
+ * can be set to DateField. The DateField control then uses the hiredDate
+ * property.</p>
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public var labelField:String;
+}
+
+}