You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by al...@apache.org on 2021/01/13 11:24:12 UTC

[royale-asjs] branch develop updated: MXDataGridItemRenderer and MXItemRenderer added

This is an automated email from the ASF dual-hosted git repository.

alinakazi pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 30a7134  MXDataGridItemRenderer and MXItemRenderer added
30a7134 is described below

commit 30a71340454d2da92805da3b45787e9c795dca27
Author: alinakazi <al...@gmail.com>
AuthorDate: Wed Jan 13 16:23:56 2021 +0500

    MXDataGridItemRenderer and MXItemRenderer added
---
 .../src/main/resources/spark-royale-manifest.xml   |   4 +-
 .../dataGridClasses/MXDataGridItemRenderer.as      | 103 +++++++++++++
 .../spark/controls/listClasses/MXItemRenderer.as   | 171 +++++++++++++++++++++
 3 files changed, 277 insertions(+), 1 deletion(-)

diff --git a/frameworks/projects/SparkRoyale/src/main/resources/spark-royale-manifest.xml b/frameworks/projects/SparkRoyale/src/main/resources/spark-royale-manifest.xml
index 7e9f645..0d80fd7 100644
--- a/frameworks/projects/SparkRoyale/src/main/resources/spark-royale-manifest.xml
+++ b/frameworks/projects/SparkRoyale/src/main/resources/spark-royale-manifest.xml
@@ -145,5 +145,7 @@
     <component id="SelfItemRenderer" class="spark.components.beads.SelfItemRenderer"/>
     <component id="SelfItemRendererInitializer" class="spark.components.beads.SelfItemRendererInitializer"/>
 
-	
+    <!-- MXItemRenderer -->
+	<component id="MXItemRenderer" class="spark.controls.listClasses.MXItemRenderer"/>
+    <component id="MXDataGridItemRenderer" class="spark.controls.dataGridClasses.MXDataGridItemRenderer"/>
 </componentPackage>
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/controls/dataGridClasses/MXDataGridItemRenderer.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/controls/dataGridClasses/MXDataGridItemRenderer.as
new file mode 100644
index 0000000..524705d
--- /dev/null
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/controls/dataGridClasses/MXDataGridItemRenderer.as
@@ -0,0 +1,103 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 spark.controls.dataGridClasses
+{
+import spark.controls.listClasses.MXItemRenderer;
+import mx.controls.dataGridClasses.DataGridListData;
+
+//--------------------------------------
+//  Excluded APIs
+//--------------------------------------
+
+[Exclude(name="listData", kind="property")]
+
+/**
+ *  The MXDataGridItemRenderer class defines the Spark item renderer class 
+ *  for use with the MX DataGrid control.
+ *  This class lets you use the Spark item renderer architecture with the 
+ *  MX DataGrid control. 
+ * 
+ *  @mxml
+ *
+ *  <p>The <code>&lt;s:MXDataGridItemRenderer&gt;</code> tag inherits all of the tag 
+ *  attributes of its superclass and adds the following tag attributes:</p>
+ *
+ *  <pre>
+ *  &lt;s:MXItemRenderer
+ *    <strong>Properties</strong>
+ *  /&gt;
+ *  </pre>
+ *  
+ *  @see mx.controls.DataGrid
+ *  @includeExample examples/MXDataGridItemRenderer.mxml
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ */
+public class MXDataGridItemRenderer extends MXItemRenderer
+{    
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+    
+    /**
+     *  Constructor.
+     * 
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public function MXDataGridItemRenderer()
+    {
+        super();
+    }
+    
+    //----------------------------------
+    //  dataGridListData
+    //----------------------------------
+
+    [Bindable("dataChange")]
+    
+    /**
+     *  The implementation of the <code>listData</code> property
+     *  as defined by the IDropInListItemRenderer interface.
+     *  Use this property to access information about the 
+     *  data item displayed by the item renderer.     
+     *
+     *  @see mx.controls.listClasses.IDropInListItemRenderer
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get dataGridListData():DataGridListData
+    {
+        return listData as DataGridListData;
+    }
+
+
+}
+}
\ No newline at end of file
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/controls/listClasses/MXItemRenderer.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/controls/listClasses/MXItemRenderer.as
new file mode 100644
index 0000000..073ab43
--- /dev/null
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/controls/listClasses/MXItemRenderer.as
@@ -0,0 +1,171 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 spark.controls.listClasses
+{
+import org.apache.royale.events.Event;
+
+import mx.controls.listClasses.ListBase;
+import mx.controls.listClasses.BaseListData;
+import mx.controls.listClasses.IDropInListItemRenderer;
+import mx.controls.listClasses.IListItemRenderer;
+import mx.managers.IFocusManagerComponent;
+import mx.styles.StyleManager;
+import spark.components.supportClasses.ItemRenderer;
+
+/**
+ *  The MXItemRenderer class is the base class for Spark item renderers  
+ *  and item editors used in MX list-based controls. 
+ *  This class lets you use the Spark item renderer architecture with the 
+ *  MX DataGrid, MX AdvancedDataGrid, and MX Tree controls. 
+ *
+ *  <p><b>Note: </b>Many MX controls support item renderers or item editors. 
+ *  However, only the MX DataGrid, MX AdvancedDataGrid, and MX Tree controls 
+ *  support the MXItemRenderer class. 
+ *  Therefore, continue to use MX item renderers and item editors with 
+ *  MX controls other than DataGrid, AdvancedDataGrid, and Tree.</p>
+ * 
+ *  @mxml
+ *
+ *  <p>The <code>&lt;s:MXItemRenderer&gt;</code> tag inherits all of the tag 
+ *  attributes of its superclass and adds the following tag attributes:</p>
+ *
+ *  <pre>
+ *  &lt;s:MXItemRenderer
+ *    <strong>Properties</strong>
+ *  /&gt;
+ *  </pre>
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ */
+public class MXItemRenderer extends ItemRenderer implements IListItemRenderer, IDropInListItemRenderer
+{    
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+    
+    /**
+     *  Constructor.
+     * 
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public function MXItemRenderer()
+    {
+        super();
+        focusEnabled = false;
+    }
+    
+    //--------------------------------------------------------------------------
+    //
+    //  Variables
+    //
+    //--------------------------------------------------------------------------
+    
+    
+    //----------------------------------
+    //  listData
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the listData property.
+     */
+    private var _listData:BaseListData;
+
+    [Bindable("dataChange")]
+    
+    /**
+     *  The implementation of the <code>listData</code> property
+     *  as defined by the IDropInListItemRenderer interface.
+     *
+     *  @see mx.controls.listClasses.IDropInListItemRenderer
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get listData():BaseListData
+    {
+        return _listData;
+    }
+
+    /**
+     *  @private
+     */
+    public function set listData(value:BaseListData):void
+    {
+        _listData = value;
+
+        invalidateProperties();
+    }
+
+    //----------------------------------
+    //  editor
+    //----------------------------------
+
+    /**
+     *  If supplied, the component that will receive focus as the editor.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public var editor:IFocusManagerComponent;
+
+    //----------------------------------
+    //  text
+    //----------------------------------
+
+    /**
+     *  The <code>text</code> property of
+     *  the component specified by <code>editorID</code>.
+     *  This is a convenience property to
+     *  let the item editor of the MX control, 
+     *  specified by the <code>itemEditor</code> property, 
+     *  pull the value from most item editors
+     *  without having to propagate a property
+     *  to the MXItemRenderer.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public function get text():String
+    {
+        if (editor && ("text" in editor))
+            return editor["text"];
+
+        return null;
+    }
+
+  
+
+}
+}
\ No newline at end of file