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

harbs 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 ea4b108617 DataItemRenderer
ea4b108617 is described below

commit ea4b108617511660d58ef62739cd30b8a3f2d10f
Author: Harbs <[email protected]>
AuthorDate: Thu Feb 26 15:58:33 2026 +0200

    DataItemRenderer
---
 .../Style/src/main/resources/basic-manifest.xml    |   1 +
 .../projects/Style/src/main/royale/StyleClasses.as |   1 +
 .../org/apache/royale/style/DataItemRenderer.as    | 113 ++++++++++++
 .../royale/style/support/UIItemRendererBase.as     | 190 +++++++++++++++++++++
 4 files changed, 305 insertions(+)

diff --git a/frameworks/projects/Style/src/main/resources/basic-manifest.xml 
b/frameworks/projects/Style/src/main/resources/basic-manifest.xml
index 7238933c1a..aa01bdeeda 100644
--- a/frameworks/projects/Style/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/Style/src/main/resources/basic-manifest.xml
@@ -25,6 +25,7 @@
   <component id="List" class="org.apache.royale.style.List"/>
   <component id="MultiSelectionList" 
class="org.apache.royale.style.MultiSelectionList"/>
   <component id="Tree" class="org.apache.royale.style.Tree"/>
+  <component id="DataItemRenderer" 
class="org.apache.royale.style.DataItemRenderer"/>
 
   <component id="BackgroundStyle" 
class="org.apache.royale.style.stylebeads.BackgroundStyle"/>
   <component id="ContainerPosition" 
class="org.apache.royale.style.stylebeads.ContainerPosition"/>
diff --git a/frameworks/projects/Style/src/main/royale/StyleClasses.as 
b/frameworks/projects/Style/src/main/royale/StyleClasses.as
index feb357d886..30b5087e06 100644
--- a/frameworks/projects/Style/src/main/royale/StyleClasses.as
+++ b/frameworks/projects/Style/src/main/royale/StyleClasses.as
@@ -56,6 +56,7 @@ package
                import org.apache.royale.style.util.StyleManager; StyleManager;
                import org.apache.royale.style.util.ThemeManager; ThemeManager;
                import org.apache.royale.style.util.ContentAlign; ContentAlign;
+               import org.apache.royale.style.support.UIItemRendererBase; 
UIItemRendererBase;
 
        }
 
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/DataItemRenderer.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/DataItemRenderer.as
new file mode 100644
index 0000000000..542a389757
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/DataItemRenderer.as
@@ -0,0 +1,113 @@
+// 
//////////////////////////////////////////////////////////////////////////////
+// 
+// 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.royale.style
+{
+       import org.apache.royale.core.IBeadController;
+       import org.apache.royale.core.IHasDataField;
+       import org.apache.royale.style.support.UIItemRendererBase;
+
+       /**
+        *  The DataItemRenderer class is the base class for most 
itemRenderers. This class
+        *  extends org.apache.royale.style.support.UIItemRendererBase and
+        *  includes row and column index values.
+        *
+        *  @langversion 3.0
+        *  @playerversion Flash 10.2
+        *  @playerversion AIR 2.6
+        *  @productversion Royale 0.0
+        */
+       public class DataItemRenderer extends UIItemRendererBase implements 
IHasDataField
+       {
+               /**
+                *  constructor.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion Royale 0.0
+                */
+               public function DataItemRenderer()
+               {
+                       super();
+               }
+
+               private var _columnIndex:int;
+
+               /**
+                *  The index of the column the itemRenderer represents.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion Royale 0.0
+                */
+               public function get columnIndex():int
+               {
+                       return _columnIndex;
+               }
+               public function set columnIndex(value:int):void
+               {
+                       _columnIndex = value;
+               }
+
+               private var _rowIndex:int;
+
+               /**
+                *  The index of the row the itemRenderer represents.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion Royale 0.0
+                */
+               public function get rowIndex():int
+               {
+                       return _rowIndex;
+               }
+               public function set rowIndex(value:int):void
+               {
+                       _rowIndex = value;
+               }
+
+               private var _dataField:String;
+
+               /**
+                *  The name of the field within the data the itemRenderer 
should use.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion Royale 0.0
+                */
+               public function get dataField():String
+               {
+                       return _dataField;
+               }
+               public function set dataField(value:String):void
+               {
+                       _dataField = value;
+               }
+
+               /**
+                * This should be an implementation like 
ItemRendererMouseController
+                */
+               protected var controller:IBeadController;
+
+       }
+}
diff --git 
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/support/UIItemRendererBase.as
 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/support/UIItemRendererBase.as
new file mode 100644
index 0000000000..4793d9ba7d
--- /dev/null
+++ 
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/support/UIItemRendererBase.as
@@ -0,0 +1,190 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.royale.style.support
+{
+       import org.apache.royale.core.ValuesManager;
+       import org.apache.royale.events.Event;
+       import org.apache.royale.utils.MXMLDataInterpreter;
+       import org.apache.royale.core.ILabelFieldItemRenderer;
+       import org.apache.royale.core.IHasLabelField;
+       import org.apache.royale.style.StyleUIBase;
+
+       [DefaultProperty("mxmlContent")]
+
+       /**
+        *  Indicates that the initialization of the container is complete.
+        *
+        *  @langversion 3.0
+        *  @productversion Royale 0.9.13
+        */
+       [Event(name="initComplete", type="org.apache.royale.events.Event")]
+
+       /**
+        *  The UIItemRendererBase class is the base class for all 
itemRenderers. An itemRenderer is used to
+        *  display a single datum within a collection of data. Components such 
as a List use itemRenderers to
+        *  show their dataProviders.
+        *
+        *  @langversion 3.0
+        *  @productversion Royale 0.9.13
+        */
+       public class UIItemRendererBase extends StyleUIBase implements 
ILabelFieldItemRenderer, IHasLabelField
+       {
+               /**
+                *  constructor.
+                *
+                *  @langversion 3.0
+                *  @productversion Royale 0.9.13
+                */
+               public function UIItemRendererBase()
+               {
+                       super();
+               }
+
+               private var _initialized:Boolean = false;
+
+               /**
+                * @private
+                */
+               override public function addedToParent():void
+               {
+                       if (!_initialized)
+                       {
+                               
MXMLDataInterpreter.generateMXMLProperties(this, mxmlProperties);
+                               MXMLDataInterpreter.generateMXMLInstances(this, 
this, MXMLDescriptor);
+                       }
+                       super.addedToParent();
+
+                       if (!_initialized)
+                       {
+                               // very common for item renderers to be resized 
by their containers,
+                               addEventListener("widthChanged", 
sizeChangeHandler);
+                               addEventListener("heightChanged", 
sizeChangeHandler);
+                               addEventListener("sizeChanged", 
sizeChangeHandler);
+
+                               // each MXML file can also have styles in 
fx:Style block
+                               ValuesManager.valuesImpl.init(this);
+
+                               dispatchEvent(new Event("initBindings"));
+                               dispatchEvent(new Event("initComplete"));
+                               _initialized = true;
+                       }
+               }
+
+               /**
+                *  @copy 
org.apache.royale.core.ItemRendererClassFactory#mxmlContent
+                *
+                *  @langversion 3.0
+                *  @productversion Royale 0.9.13
+                *
+                *  @royalesuppresspublicvarwarning
+                */
+               public var mxmlContent:Array;
+
+               /**
+                * @private
+                */
+               public function get MXMLDescriptor():Array
+               {
+                       return null;
+               }
+
+               private var mxmlProperties:Array;
+
+               /**
+                * @private
+                */
+               public function generateMXMLAttributes(data:Array):void
+               {
+                       mxmlProperties = data;
+               }
+
+               private var _data:Object;
+
+               [Bindable("__NoChangeEvent__")]
+
+               /**
+                *  The data being represented by this itemRenderer. This can 
be something simple like a String or
+                *  a Number or something very complex.
+                *
+                *  @langversion 3.0
+                *  @productversion Royale 0.9.13
+                */
+               public function get data():Object
+               {
+                       return _data;
+               }
+               public function set data(value:Object):void
+               {
+                       _data = value;
+               }
+
+               private var _labelField:String = "label";
+
+               /**
+                * The name of the field within the data to use as a label. 
Some itemRenderers use this field to
+                * identify the value they should show while other 
itemRenderers ignore this if they are showing
+                * complex information.
+                */
+               public function get labelField():String
+               {
+                       return _labelField;
+               }
+               public function set labelField(value:String):void
+               {
+                       _labelField = value;
+               }
+
+               private var _index:int;
+
+               /**
+                *  The position with the dataProvider being shown by the 
itemRenderer instance.
+                *
+                *  @langversion 3.0
+                *  @productversion Royale 0.9.13
+                */
+               public function get index():int
+               {
+                       return _index;
+               }
+               public function set index(value:int):void
+               {
+                       _index = value;
+               }
+
+               /**
+                * @private
+                */
+               private function sizeChangeHandler(event:Event):void
+               {
+                       adjustSize();
+               }
+
+               /**
+                *  This function is called whenever the itemRenderer changes 
size. Sub-classes should override
+                *  this method an handle the size change.
+                *
+                *  @langversion 3.0
+                *  @productversion Royale 0.9.13
+                */
+               public function adjustSize():void
+               {
+                       // handle in subclass
+               }
+       }
+}

Reply via email to