You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by yi...@apache.org on 2019/11/18 10:23:52 UTC

[royale-asjs] 01/03: Add TLC for MultiSelectionList

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

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

commit 1593350fa9457afd6a381065b53c1baa7d349016
Author: DESKTOP-RH4S838\Yishay <yi...@hotmail.com>
AuthorDate: Mon Nov 18 12:22:01 2019 +0200

    Add TLC for MultiSelectionList
---
 .../Basic/src/main/resources/basic-manifest.xml    |   1 +
 .../projects/Basic/src/main/resources/defaults.css |  13 ++
 .../org/apache/royale/html/MultiSelectionList.as   | 174 +++++++++++++++++++++
 3 files changed, 188 insertions(+)

diff --git a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
index d383b60..5769027 100644
--- a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
@@ -45,6 +45,7 @@
     <component id="HTMLText" class="org.apache.royale.html.HTMLText"/>
     <component id="DataContainer" class="org.apache.royale.html.DataContainer"/>
     <component id="List" class="org.apache.royale.html.List"/>
+    <component id="MultiSelectionList" class="org.apache.royale.html.MultiSelectionList"/>
     <component id="DynamicList" class="org.apache.royale.html.DynamicList"/>
     <component id="PopUpList" class="org.apache.royale.html.PopUpList"/>
     <component id="SimpleList" class="org.apache.royale.html.SimpleList"/>
diff --git a/frameworks/projects/Basic/src/main/resources/defaults.css b/frameworks/projects/Basic/src/main/resources/defaults.css
index 3d082e3..6a6c05d 100644
--- a/frameworks/projects/Basic/src/main/resources/defaults.css
+++ b/frameworks/projects/Basic/src/main/resources/defaults.css
@@ -388,6 +388,19 @@ VContainer
 	IBeadLayout: ClassReference("org.apache.royale.html.beads.layouts.VerticalLayout");
 }
 
+MultiSelectionList
+{
+	IBeadModel: ClassReference("org.apache.royale.html.beads.models.ArrayMultiSelectionModel");
+	IBeadView:  ClassReference("org.apache.royale.html.beads.MultiSelectionListView");			
+	IBeadController: ClassReference("org.apache.royale.html.beads.controllers.ListMultiSelectionMouseController");
+	IBeadLayout: ClassReference("org.apache.royale.html.beads.layouts.VerticalLayout");
+	IDataProviderItemRendererMapper: ClassReference("org.apache.royale.html.beads.DataItemRendererFactoryForArrayData");
+	IItemRendererClassFactory: ClassReference("org.apache.royale.core.ItemRendererClassFactory");
+	IItemRenderer: ClassReference("org.apache.royale.html.supportClasses.StringItemRenderer");
+	IViewport: ClassReference("org.apache.royale.html.supportClasses.ScrollingViewport");
+	IViewportModel: ClassReference("org.apache.royale.html.beads.models.ViewportModel");
+}
+
 List
 {
 	IBeadModel: ClassReference("org.apache.royale.html.beads.models.ArraySelectionModel");
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/MultiSelectionList.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/MultiSelectionList.as
new file mode 100644
index 0000000..7a2801d
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/MultiSelectionList.as
@@ -0,0 +1,174 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.html
+{
+	import org.apache.royale.core.IListPresentationModel;
+	import org.apache.royale.core.IRollOverModel;
+	import org.apache.royale.core.IMultiSelectionModel;
+
+	COMPILE::JS
+	{
+		import org.apache.royale.core.WrappedHTMLElement;
+	}
+
+	/**
+	 *  Indicates that the initialization of the list is complete.
+	 *
+	 *  @toplevel
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9.7
+	 */
+	[Event(name="initComplete", type="org.apache.royale.events.Event")]
+
+	/**
+	 * The change event is dispatched whenever the list's selection changes.
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9.7
+	 */
+	[Event(name="change", type="org.apache.royale.events.Event")]
+
+	/**
+	 *  The MultiSelectionList class is a component that displays multiple data items. The MultiSelectionList uses
+	 *  the following bead types:
+	 *
+	 *  org.apache.royale.core.IBeadModel: the data model, which includes the dataProvider, selectedItems, and
+	 *  so forth.
+	 *  org.apache.royale.core.IBeadView:  the bead that constructs the visual parts of the list.
+	 *  org.apache.royale.core.IBeadController: the bead that handles input and output.
+	 *  org.apache.royale.core.IBeadLayout: the bead responsible for the size and position of the itemRenderers.
+	 *  org.apache.royale.core.IDataProviderItemRendererMapper: the bead responsible for creating the itemRenders.
+	 *  org.apache.royale.core.IItemRenderer: the class or factory used to display an item in the list.
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9.7
+	 */
+	public class MultiSelectionList extends DataContainer
+	{
+		/**
+		 *  constructor.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.7
+		 */
+		public function MultiSelectionList()
+		{
+			super();
+			typeNames += " MultiSelectionList";
+		}
+
+		/**
+		 *  The index of the currently selected item. Changing this value
+		 *  also changes the selectedItems property.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.7
+		 *  @royaleignorecoercion org.apache.royale.core.IMultiSelectionModel
+		 */
+		[Bindable("change")]
+		public function get selectedIndices():Array
+		{
+			return IMultiSelectionModel(model).selectedIndices;
+		}
+
+		/**
+		 * @royaleignorecoercion org.apache.royale.core.IMultiSelectionModel
+		 */
+		public function set selectedIndices(value:Array):void
+		{
+			IMultiSelectionModel(model).selectedIndices = value;
+		}
+
+		/**
+		 *  The index of the item currently below the pointer.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.7
+		 *  @royaleignorecoercion org.apache.royale.core.IRollOverModel
+		 */
+		public function get rollOverIndex():int
+		{
+			return IRollOverModel(model).rollOverIndex;
+		}
+
+		/**
+		 * @royaleignorecoercion org.apache.royale.core.IRollOverModel
+		 */
+		public function set rollOverIndex(value:int):void
+		{
+			IRollOverModel(model).rollOverIndex = value;
+		}
+
+		/**
+		 *  The default height of each cell in every column
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.7
+		 *  @royaleignorecoercion org.apache.royale.core.IListPresentationModel
+		 */
+		public function get rowHeight():Number
+		{
+			return (presentationModel as IListPresentationModel).rowHeight;
+		}
+
+		public function set rowHeight(value:Number):void
+		{
+			(presentationModel as IListPresentationModel).rowHeight = value;
+		}
+
+		/**
+		 *  The items currently selected. Changing this value also
+		 *  changes the selectedIndices property.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.7
+		 *  @royaleignorecoercion org.apache.royale.core.IMultiSelectionModel
+		 */
+		[Bindable("change")]
+		public function get selectedItems():Array
+		{
+			return IMultiSelectionModel(model).selectedItems;
+		}
+
+		/**
+		 * @royaleignorecoercion org.apache.royale.core.IMultiSelectionModel
+		 */
+		public function set selectedItems(value:Array):void
+		{
+			IMultiSelectionModel(model).selectedItems = value;
+		}
+
+   	}
+}