flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [07/12] git commit: [flex-asjs] [refs/heads/release0.8.0] - get NumericStepper to use a view and get Spinner to look good in NumericStepper
Date Sat, 13 May 2017 06:00:23 GMT
get NumericStepper to use a view and get Spinner to look good in NumericStepper


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/ec077428
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/ec077428
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/ec077428

Branch: refs/heads/release0.8.0
Commit: ec07742837d8d2840edf18ee310a0ec6c2ced362
Parents: 7b04b39
Author: Alex Harui <aharui@apache.org>
Authored: Fri May 12 19:39:21 2017 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Fri May 12 22:46:58 2017 -0700

----------------------------------------------------------------------
 .../Basic/src/main/flex/BasicClasses.as         |  5 +--
 .../flex/org/apache/flex/html/NumericStepper.as | 45 --------------------
 .../main/flex/org/apache/flex/html/Spinner.as   |  1 -
 .../flex/html/beads/NumericStepperView.as       | 17 +++++++-
 .../org/apache/flex/html/beads/SpinnerView.as   | 14 ++++--
 .../Basic/src/main/resources/defaults.css       | 25 ++++++++---
 6 files changed, 44 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ec077428/frameworks/projects/Basic/src/main/flex/BasicClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/BasicClasses.as b/frameworks/projects/Basic/src/main/flex/BasicClasses.as
index c7655cc..c733960 100644
--- a/frameworks/projects/Basic/src/main/flex/BasicClasses.as
+++ b/frameworks/projects/Basic/src/main/flex/BasicClasses.as
@@ -63,10 +63,7 @@ internal class BasicClasses
 	import org.apache.flex.html.beads.BinaryImageLoader; BinaryImageLoader;
 	import org.apache.flex.html.beads.models.BinaryImageModel; BinaryImageModel;
 	import org.apache.flex.html.beads.ListView; ListView;
-	COMPILE::SWF
-	{
-	    import org.apache.flex.html.beads.NumericStepperView; NumericStepperView;
-	}
+	import org.apache.flex.html.beads.NumericStepperView; NumericStepperView;
     import org.apache.flex.html.beads.PanelView; PanelView;
 	import org.apache.flex.html.supportClasses.PanelLayoutProxy; PanelLayoutProxy;
     import org.apache.flex.html.beads.SliderView; SliderView;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ec077428/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/NumericStepper.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/NumericStepper.as
b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/NumericStepper.as
index 876c597..d39caf7 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/NumericStepper.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/NumericStepper.as
@@ -165,56 +165,11 @@ package org.apache.flex.html
             positioner = element;
             //positioner.style.position = 'relative';
 
-            input = new TextInput();
-            input.className = "NumericStepperInput";
-            input.typeNames = "NumericStepperInput";
-            addElement(input);
-            input.positioner.style.display = 'inline-block';
-            input.positioner.style.width = '100px';
-
-            spinner = new Spinner();
-			spinner.addBead(model as IBead);
-            addElement(spinner);
-
-            /* TODO: ajh move to view and css */
-            spinner.positioner.style.display = 'inline-block';
-            goog.events.listen(spinner, 'valueChange',
-                spinnerChange);
-
             element.flexjs_wrapper = this;
             className = 'NumericStepper';
 
-            input.text = String(spinner.value);
-
-			IEventDispatcher(model).addEventListener("valueChange",modelChangeHandler);
-			IEventDispatcher(model).addEventListener("minimumChange",modelChangeHandler);
-			IEventDispatcher(model).addEventListener("maximumChange",modelChangeHandler);
-			IEventDispatcher(model).addEventListener("stepSizeChange",modelChangeHandler);
-			IEventDispatcher(model).addEventListener("snapIntervalChange",modelChangeHandler);
-
             return element;
         }
 
-        /**
-         * @param event The input event.
-         */
-        COMPILE::JS
-        private function spinnerChange(event:Event):void
-        {
-            var newValue:Number = spinner.value;
-            value = newValue;
-            input.text = String(spinner.value);
-            dispatchEvent(new Event('valueChange'));
-        };
-
-        /**
-         * @private
-         */
-        COMPILE::JS
-        private function modelChangeHandler(event:Event):void
-        {
-            input.text = String(model.value);
-        }
-
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ec077428/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Spinner.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Spinner.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Spinner.as
index 2cc160e..8c93e8d 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Spinner.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Spinner.as
@@ -156,7 +156,6 @@ package org.apache.flex.html
         {
             element = document.createElement('div') as WrappedHTMLElement;
             positioner = element;
-            //positioner.style.position = 'relative';
 
             element.style.verticalAlign = 'middle';
             element.flexjs_wrapper = this;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ec077428/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/NumericStepperView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/NumericStepperView.as
b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/NumericStepperView.as
index 6ebdbf4..032e46e 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/NumericStepperView.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/NumericStepperView.as
@@ -79,19 +79,29 @@ package org.apache.flex.html.beads
             
 			// add an input field
 			input = new TextInput();
+            input.className = "NumericStepperInput";
+            input.typeNames = "NumericStepperInput";
 			IParent(value).addElement(input);
-			
+			COMPILE::JS
+			{
+	            input.positioner.style.display = 'inline-block';
+    	        input.positioner.style.width = '100px';
+			}
 			// add a spinner
 			spinner = new Spinner();
 			spinner.addBead( UIBase(value).model as IBead );
 			IParent(value).addElement(spinner);
 			spinner.height = input.height;
+			COMPILE::JS
+			{
+	            spinner.positioner.style.display = 'inline-block';
+			}
 			
 			// listen for changes to the text input field which will reset the
 			// value. ideally, we should either set the input to accept only
 			// numeric values or, barring that, reject non-numeric entries. we
 			// cannot do that right now however.
-			input.model.addEventListener("textChange",inputChangeHandler);
+			input.addEventListener("change",inputChangeHandler);
 			
 			// listen for change events on the spinner so the value can be updated as
 			// as resizing the component
@@ -123,8 +133,11 @@ package org.apache.flex.html.beads
 			input.x = 2;
 			input.y = (UIBase(_strand).height - input.height)/2;
 			input.width = UIBase(_strand).width-spinner.width-2;
+			COMPILE::SWF
+			{
 			spinner.x = input.width+2;
 			spinner.y = 0;
+			}
 		}
 		
 		/**

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ec077428/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SpinnerView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SpinnerView.as
b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SpinnerView.as
index ecb2502..4023036 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SpinnerView.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SpinnerView.as
@@ -102,19 +102,20 @@ COMPILE::JS {
 				UIBase(_strand).addChild(_decrement);
 				UIBase(_strand).addChild(_increment);
 				rangeModel = _strand.getBeadByType(IBeadModel) as IRangeModel;
-
-				IEventDispatcher(value).addEventListener("widthChanged",sizeChangeHandler);
-				IEventDispatcher(value).addEventListener("heightChanged",sizeChangeHandler);
 			}
+			IEventDispatcher(value).addEventListener("widthChanged",sizeChangeHandler);
+			IEventDispatcher(value).addEventListener("heightChanged",sizeChangeHandler);
 			COMPILE::JS {
 				var host:UIBase = value as UIBase;
 
 				_increment = new SpinnerButton();
 				_increment.text = '\u25B2';
+				_increment.positioner.style.display = 'block';
 				host.addElement(_increment);
 
 				_decrement = new SpinnerButton();
 				_decrement.text = '\u25BC';
+				_decrement.positioner.style.display = 'block';
 				host.addElement(_decrement);
 
 // add this in CSS!
@@ -164,17 +165,22 @@ COMPILE::JS {
 		/**
 		 * @private
 		 */
-		COMPILE::SWF
 		private function sizeChangeHandler( event:Event ) : void
 		{
             var w:Number = UIBase(_strand).width;
             var h:Number =  UIBase(_strand).height / 2;
 			_increment.width = w;
 			_increment.height = h;
+			COMPILE::SWF
+			{
 			_increment.y      = 0;
+			}
 			_decrement.width = w;
 			_decrement.height = h;
+			COMPILE::SWF
+			{
 			_decrement.y      = h;
+			}
 		}
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ec077428/frameworks/projects/Basic/src/main/resources/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/resources/defaults.css b/frameworks/projects/Basic/src/main/resources/defaults.css
index 7a13798..7e2695f 100644
--- a/frameworks/projects/Basic/src/main/resources/defaults.css
+++ b/frameworks/projects/Basic/src/main/resources/defaults.css
@@ -409,6 +409,13 @@ Tree
 NumericStepper
 {
 	IBeadModel: ClassReference("org.apache.flex.html.beads.models.RangeModel");
+	IBeadView: ClassReference("org.apache.flex.html.beads.NumericStepperView");
+	
+	padding: 0px;
+	border-style: solid;
+	border-color: #000000;
+	border-width: 1px;
+	background-color: #FFFFFF;
 }
 
 Panel
@@ -436,6 +443,11 @@ Panel .TitleBar
 	border-bottom: solid 1px #333333;
 }
 
+.PanelContent
+{
+	background-color: #FFFFFF;
+}
+
 SimpleList
 {
 	IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
@@ -460,8 +472,14 @@ Spinner
 {
 	IBeadModel: ClassReference("org.apache.flex.html.beads.models.RangeModel");
 	IBeadView:  ClassReference("org.apache.flex.html.beads.SpinnerView");
+	width: 16px;
 }
 
+.SpinnerButton
+{
+	padding: 1px;
+	font-size: 6px;
+}
 
 StringItemRenderer
 {
@@ -752,13 +770,6 @@ global
 	
 	NumericStepper
 	{
-		IBeadView: ClassReference("org.apache.flex.html.beads.NumericStepperView");
-		
-		padding: 0px;
-		border-style: solid;
-		border-color: #000000;
-		border-width: 1px;
-		background-color: #FFFFFF;
 		iBorderBead: ClassReference('org.apache.flex.html.beads.SingleLineBorderBead');
 		iBackgroundBead: ClassReference('org.apache.flex.html.beads.SolidBackgroundBead');
 	}


Mime
View raw message