You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by hi...@apache.org on 2021/12/22 21:33:12 UTC

[royale-asjs] branch develop updated: Rename bead TriStateCheckBoxStatesValue to TriStateCheckBoxState. Added beads TriStateCheckBoxTooltipState and ComboBoxReadOnly.

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

hiedra 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 8f68677  Rename bead TriStateCheckBoxStatesValue to TriStateCheckBoxState. Added beads TriStateCheckBoxTooltipState and ComboBoxReadOnly.
8f68677 is described below

commit 8f6867782afa8752a313aff6ea3c4d4b1ae5039d
Author: Maria José Esteve <hi...@local.iest.com>
AuthorDate: Wed Dec 22 22:15:54 2021 +0100

    Rename bead TriStateCheckBoxStatesValue to TriStateCheckBoxState.
    Added beads TriStateCheckBoxTooltipState and ComboBoxReadOnly.
---
 .../Jewel/src/main/resources/jewel-manifest.xml    |   4 +-
 .../beads/controls/combobox/ComboBoxReadOnly.as    |  93 +++++++++++++++++++
 ...BoxStatesValues.as => TriStateCheckBoxState.as} |  10 +-
 .../TriStateCheckBoxTooltipState.as                | 102 +++++++++++++++++++++
 4 files changed, 203 insertions(+), 6 deletions(-)

diff --git a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
index 5ec114b..5b72817 100644
--- a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
+++ b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
@@ -220,10 +220,12 @@
     <component id="ComboUpperCase" class="org.apache.royale.jewel.beads.controls.combobox.ComboUpperCase"/>
     <component id="ComboLowerCase" class="org.apache.royale.jewel.beads.controls.combobox.ComboLowerCase"/>
     <component id="ComboBoxDisabled" class="org.apache.royale.jewel.beads.controls.combobox.ComboBoxDisabled"/>
+    <component id="ComboBoxReadOnly" class="org.apache.royale.jewel.beads.controls.combobox.ComboBoxReadOnly"/>
     <component id="ComboBoxTruncateText" class="org.apache.royale.jewel.beads.controls.combobox.ComboBoxTruncateText"/>
     <component id="ComboBoxListCloseOnClick" class="org.apache.royale.jewel.beads.controls.combobox.ComboBoxListCloseOnClick" />
     <component id="TriStateCheckBoxLabelState" class="org.apache.royale.jewel.beads.controls.tristatecheckbox.TriStateCheckBoxLabelState"/>
-    <component id="TriStateCheckBoxStatesValues" class="org.apache.royale.jewel.beads.controls.tristatecheckbox.TriStateCheckBoxStatesValues"/>
+    <component id="TriStateCheckBoxState" class="org.apache.royale.jewel.beads.controls.tristatecheckbox.TriStateCheckBoxState"/>
+    <component id="TriStateCheckBoxTooltipState" class="org.apache.royale.jewel.beads.controls.tristatecheckbox.TriStateCheckBoxTooltipState"/>
 
     <component id="LayoutChildren" class="org.apache.royale.jewel.beads.layouts.LayoutChildren"/>
     <component id="BasicLayout" class="org.apache.royale.jewel.beads.layouts.BasicLayout"/>
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/combobox/ComboBoxReadOnly.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/combobox/ComboBoxReadOnly.as
new file mode 100644
index 0000000..be54551
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/combobox/ComboBoxReadOnly.as
@@ -0,0 +1,93 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.combobox
+{
+	COMPILE::JS
+	{
+	import org.apache.royale.core.HTMLElementWrapper;
+	import org.apache.royale.core.UIBase;
+	import org.apache.royale.jewel.beads.views.ComboBoxView;
+	}
+	import org.apache.royale.core.IUIBase;
+	import org.apache.royale.jewel.beads.controls.ReadOnly;
+	
+	/**
+	 *  The ComboBoxReadOnly bead class is a specialty ReadOnly bead that can be used to lock a Jewel ComboBox.
+	 *  
+	 *  Based on the ComboBoxDisabled bead for the Jewel ComboBox control.
+	 * 
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9.6
+	 */
+	public class ComboBoxReadOnly extends ReadOnly
+	{
+		/**
+		 *  constructor.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.9
+		 */
+		public function ComboBoxReadOnly()
+		{
+		}
+
+		COMPILE::JS
+		protected var lastTextInputElementTabVal:String = null;
+		COMPILE::JS
+		protected var lastButtonElementTabVal:String = null;
+
+		override protected function updateHost():void
+		{
+			COMPILE::JS
+			{
+			var view:ComboBoxView = (_strand as UIBase).view as ComboBoxView;
+
+			if (view) {
+				var pos:HTMLElement = (_strand as IUIBase).positioner;
+				
+				if(!initialized)
+				{
+					initialized = true;
+					lastElementTabVal = (_strand as HTMLElementWrapper).element.getAttribute("tabindex");
+					lastTextInputElementTabVal = view.textinput.element.getAttribute("tabindex");
+					lastButtonElementTabVal = view.button.element.getAttribute("tabindex");
+				}
+				
+                if(readOnly) {
+					setReadOnlyAndTabIndex(pos, true);
+					setReadOnlyAndTabIndex(view.textinput.positioner, true);
+					setReadOnlyAndTabIndex(view.textinput.element);
+					setReadOnlyAndTabIndex(view.button.positioner, true);
+					setReadOnlyAndTabIndex(view.button.element);
+				} else {
+					removeReadOnlyAndTabIndex(pos, true);
+					removeReadOnlyAndTabIndex(view.textinput.positioner, true);
+					removeReadOnlyAndTabIndex(view.textinput.element, false, lastTextInputElementTabVal);
+					removeReadOnlyAndTabIndex(view.button.positioner, true);
+					removeReadOnlyAndTabIndex(view.button.element, false, lastButtonElementTabVal);
+				}
+            }
+			}
+		}
+	}
+}
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/tristatecheckbox/TriStateCheckBoxStatesValues.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/tristatecheckbox/TriStateCheckBoxState.as
similarity index 90%
rename from frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/tristatecheckbox/TriStateCheckBoxStatesValues.as
rename to frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/tristatecheckbox/TriStateCheckBoxState.as
index afe8f33..b4a3994 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/tristatecheckbox/TriStateCheckBoxStatesValues.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/tristatecheckbox/TriStateCheckBoxState.as
@@ -27,13 +27,13 @@ package org.apache.royale.jewel.beads.controls.tristatecheckbox
 
 
 	/**
-	 * The TriStateCheckBoxStatesValues bead allows to set a custom value for each state.
+	 * The TriStateCheckBoxState bead allows to set a custom value for each state.
 	 */
     COMPILE::JS
-	public class TriStateCheckBoxStatesValues implements IBead
+	public class TriStateCheckBoxState implements IBead
 	{
 
-		public function TriStateCheckBoxStatesValues()
+		public function TriStateCheckBoxState()
 		{
 		}
 
@@ -83,10 +83,10 @@ package org.apache.royale.jewel.beads.controls.tristatecheckbox
 	}
 
     COMPILE::SWF
-	public class TriStateCheckBoxStatesValues
+	public class TriStateCheckBoxState
 	{
 
-		public function TriStateCheckBoxStatesValues()
+		public function TriStateCheckBoxState()
 		{
 		}
 	}
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/tristatecheckbox/TriStateCheckBoxTooltipState.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/tristatecheckbox/TriStateCheckBoxTooltipState.as
new file mode 100644
index 0000000..58f4c06
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/tristatecheckbox/TriStateCheckBoxTooltipState.as
@@ -0,0 +1,102 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.tristatecheckbox
+{
+	import org.apache.royale.core.IStrand;
+	import org.apache.royale.events.Event;
+	import org.apache.royale.jewel.beads.controls.ToolTip;
+	import org.apache.royale.jewel.TriStateCheckBox;
+
+	
+	public class TriStateCheckBoxTooltipState extends ToolTip
+	{
+		
+		public function TriStateCheckBoxTooltipState()
+		{
+		}
+		/**                         	
+		 *  @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
+		{
+			super.strand = value;
+
+            listenOnStrand("change", toolTipChangeHandler);
+		}
+
+		private function get hostBase():TriStateCheckBox
+		{
+			return _strand as TriStateCheckBox;
+		}
+		
+		protected function toolTipChangeHandler(event:Event):void
+		{
+			updateHost();
+		}
+		
+		protected function updateHost():void
+		{
+			if (!hostBase)
+				return;
+            
+            var _lastTooltip:String;
+			if(hostBase.isIndeterminate())
+				_lastTooltip = _indeterminateTooltip;
+			else if(hostBase.isUnChecked())
+				_lastTooltip = _uncheckedTooltip;
+			else
+				_lastTooltip = _checkedTooltip;
+
+			if(_lastTooltip != toolTip)
+				toolTip = _lastTooltip;
+				
+        }
+
+		private var _indeterminateTooltip:String;
+		public function get indeterminateTooltip():String { return _indeterminateTooltip; }
+		public function set indeterminateTooltip(value:String):void 		
+		{
+			_indeterminateTooltip = value;
+            updateHost();
+		}
+
+		private var _uncheckedTooltip:String;
+		public function get uncheckedTooltip():String { return _uncheckedTooltip; }
+		public function set uncheckedTooltip(value:String):void 		
+		{
+			_uncheckedTooltip = value;
+            updateHost();
+		}
+
+		private var _checkedTooltip:String;
+		public function get checkedTooltip():String { return _checkedTooltip; }
+		public function set checkedTooltip(value:String):void 		
+		{
+			_checkedTooltip = value;
+            updateHost();
+		}
+		
+	}
+}