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

[royale-asjs] branch develop updated: Move prompt in DropDownList to a bead as usual with the rest of prompts in other components

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

carlosrovira 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 2362ad4  Move prompt in DropDownList to a bead as usual with the rest of prompts in other components
2362ad4 is described below

commit 2362ad498bef4547aa06c546625be98bd943087b
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Thu Nov 1 19:52:32 2018 +0100

    Move prompt in DropDownList to a bead as usual with the rest of prompts in other components
---
 .../Jewel/src/main/resources/jewel-manifest.xml    |  1 +
 .../royale/org/apache/royale/jewel/DropDownList.as | 19 -----
 .../dropdownlist/DropDownListTextPrompt.as         | 85 ++++++++++++++++++++++
 .../royale/jewel/beads/views/DropDownListView.as   | 12 +--
 4 files changed, 89 insertions(+), 28 deletions(-)

diff --git a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
index d2189c5..3f62585 100644
--- a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
+++ b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
@@ -117,6 +117,7 @@
     
     <component id="ResponsiveDrawer" class="org.apache.royale.jewel.beads.controls.drawer.ResponsiveDrawer"/>
     
+    <component id="DropDownListTextPrompt" class="org.apache.royale.jewel.beads.controls.dropdownlist.DropDownListTextPrompt"/>
     <component id="ComboBoxTextPrompt" class="org.apache.royale.jewel.beads.controls.combobox.ComboBoxTextPrompt"/>
     <component id="DateFieldTextPrompt" class="org.apache.royale.jewel.beads.controls.datefield.DateFieldTextPrompt"/>
     <component id="TextPrompt" class="org.apache.royale.jewel.beads.controls.textinput.TextPrompt"/>
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DropDownList.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DropDownList.as
index 904424b..df99ae0 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DropDownList.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DropDownList.as
@@ -82,25 +82,6 @@ package org.apache.royale.jewel
             typeNames = "jewel dropdownlist";
 		}
 
-        private var _prompt:String = "";
-        /**
-         *  The prompt for the DropDownList control.
-         *
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion Royale 0.9.4
-         */
-        public function get prompt():String
-        {
-            return _prompt;
-        }
-
-        public function set prompt(value:String):void
-        {
-            _prompt = value;
-        }
-
         protected var _dropDown:Select;
 
         public function get dropDown():Select
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/dropdownlist/DropDownListTextPrompt.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/dropdownlist/DropDownListTextPrompt.as
new file mode 100644
index 0000000..8533278
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/dropdownlist/DropDownListTextPrompt.as
@@ -0,0 +1,85 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.jewel.beads.controls.dropdownlist
+{
+	import org.apache.royale.core.IStrand;
+	import org.apache.royale.events.Event;
+	import org.apache.royale.events.IEventDispatcher;
+	import org.apache.royale.jewel.beads.controls.textinput.TextPrompt;
+	import org.apache.royale.jewel.beads.views.DropDownListView;
+	
+	/**
+	 *  The DropDownListTextPrompt class is a specialty bead that can be used with
+	 *  any DropDownList control. It fills the prompt property in the DropDownListView
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9.4
+	 */
+	public class DropDownListTextPrompt extends TextPrompt
+	{
+		/**
+		 *  constructor.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.4
+		 */
+		public function DropDownListTextPrompt()
+		{
+		}
+		
+		private var _strand:IStrand;
+		
+		/**
+		 *  @copy org.apache.royale.core.IBead#strand
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.4
+		 *  @royaleignorecoercion org.apache.royale.events.IEventDispatcher
+		 */
+		override public function set strand(value:IStrand):void
+		{
+			_strand = value;
+			IEventDispatcher(_strand).addEventListener("beadsAdded", addPrompt);
+		}	
+
+		/**
+		 *  add prompt when beads are added and we can access the view to retrieve the textinput
+		 *   
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.4
+		 *  @royaleignorecoercion org.apache.royale.events.IEventDispatcher
+		 *  @royaleignorecoercion org.apache.royale.jewel.beads.controls.dropdownlist.DropDownListView
+		 */
+		private function addPrompt(event:Event):void
+        {
+			IEventDispatcher(_strand).removeEventListener("beadsAdded", addPrompt);
+
+			var viewBead:DropDownListView = _strand.getBeadByType(DropDownListView) as DropDownListView;
+			viewBead.prompt = prompt;
+		}
+	}
+}
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/DropDownListView.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/DropDownListView.as
index a7c4c61..66822fa 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/DropDownListView.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/DropDownListView.as
@@ -48,21 +48,15 @@ package org.apache.royale.jewel.beads.views
         private var dropDownList:DropDownList; 
         
         /**
-         *  The prompt in the main dropDownList class
+         *  The prompt
          * 
          *  @langversion 3.0
          *  @playerversion Flash 10.2
          *  @playerversion AIR 2.6
          *  @productversion Royale 0.9.4
+         *  @royalesuppresspublicvarwarning
          */
-        public function get prompt():String
-        {
-        	return dropDownList.prompt;
-        }
-        public function set prompt(value:String):void
-        {
-        	dropDownList.prompt = value;
-        }
+        public var prompt:String = "";
 
         /**
          *  @copy org.apache.royale.core.IBead#strand