flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - Replaced Sprite in Container with ContainerContentArea (UIBase) for use as actualParent. Cleaned up sizing issues for NumericStepper and Slider.
Date Wed, 24 Jul 2013 14:51:20 GMT
Updated Branches:
  refs/heads/develop 8f4e7e533 -> c3f2a66b8


Replaced Sprite in Container with ContainerContentArea (UIBase) for use as actualParent. Cleaned
up sizing issues for NumericStepper and Slider.


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

Branch: refs/heads/develop
Commit: c3f2a66b8bb543cc6eaf5d0851715371b6bd74a1
Parents: 8f4e7e5
Author: Peter Ent <pent@apache.org>
Authored: Wed Jul 24 10:51:03 2013 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Wed Jul 24 10:51:03 2013 -0400

----------------------------------------------------------------------
 .../html/staticControls/ContainerContentArea.as | 30 ++++++++++++++++++++
 .../html/staticControls/beads/ContainerView.as  |  8 ++++--
 .../staticControls/beads/NumericStepperView.as  |  1 +
 .../flex/html/staticControls/beads/PanelView.as |  1 -
 .../html/staticControls/beads/SliderView.as     | 27 +++++++++++++-----
 .../html/staticControls/beads/SpinnerView.as    | 15 ++++++++++
 6 files changed, 71 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c3f2a66b/frameworks/as/src/org/apache/flex/html/staticControls/ContainerContentArea.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/html/staticControls/ContainerContentArea.as
b/frameworks/as/src/org/apache/flex/html/staticControls/ContainerContentArea.as
new file mode 100644
index 0000000..fd846a4
--- /dev/null
+++ b/frameworks/as/src/org/apache/flex/html/staticControls/ContainerContentArea.as
@@ -0,0 +1,30 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.flex.html.staticControls
+{
+	import org.apache.flex.core.UIBase;
+	
+	public class ContainerContentArea extends UIBase
+	{
+		public function ContainerContentArea()
+		{
+			super();
+		}
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c3f2a66b/frameworks/as/src/org/apache/flex/html/staticControls/beads/ContainerView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/html/staticControls/beads/ContainerView.as
b/frameworks/as/src/org/apache/flex/html/staticControls/beads/ContainerView.as
index 97f2fe5..950baaa 100644
--- a/frameworks/as/src/org/apache/flex/html/staticControls/beads/ContainerView.as
+++ b/frameworks/as/src/org/apache/flex/html/staticControls/beads/ContainerView.as
@@ -20,12 +20,14 @@ package org.apache.flex.html.staticControls.beads
 {
 	import flash.display.DisplayObjectContainer;
 	import flash.display.Sprite;
-
+	
 	import org.apache.flex.core.IBead;
-    import org.apache.flex.core.IBeadView;
+	import org.apache.flex.core.IBeadView;
 	import org.apache.flex.core.IStrand;
+	import org.apache.flex.core.UIBase;
 	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.html.staticControls.Container;
+	import org.apache.flex.html.staticControls.ContainerContentArea;
 	
 	public class ContainerView implements IBeadView
 	{
@@ -97,7 +99,7 @@ package org.apache.flex.html.staticControls.beads
 			if ((!isNaN(pl) && pl > 0 ||
 				!isNaN(pt) && pt > 0))
 			{
-				actualParent = new Sprite();
+				actualParent = new ContainerContentArea();
 				DisplayObjectContainer(value).addChild(actualParent);
 				Container(value).setActualParent(actualParent);
 				actualParent.x = pl;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c3f2a66b/frameworks/as/src/org/apache/flex/html/staticControls/beads/NumericStepperView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/html/staticControls/beads/NumericStepperView.as
b/frameworks/as/src/org/apache/flex/html/staticControls/beads/NumericStepperView.as
index e7e2eae..a07dae0 100644
--- a/frameworks/as/src/org/apache/flex/html/staticControls/beads/NumericStepperView.as
+++ b/frameworks/as/src/org/apache/flex/html/staticControls/beads/NumericStepperView.as
@@ -58,6 +58,7 @@ package org.apache.flex.html.staticControls.beads
 			spinner.addBead( UIBase(value).model );
 			IParent(value).addElement(spinner);
 			spinner.width = 17;
+			input.height = spinner.height; // should be spinner.height = input.height but the spinner
buttons won't get small enough
 			
 			// listen for changes to the text input field which will reset the
 			// value. ideally, we should either set the input to accept only

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c3f2a66b/frameworks/as/src/org/apache/flex/html/staticControls/beads/PanelView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/html/staticControls/beads/PanelView.as b/frameworks/as/src/org/apache/flex/html/staticControls/beads/PanelView.as
index 7884845..53c314c 100644
--- a/frameworks/as/src/org/apache/flex/html/staticControls/beads/PanelView.as
+++ b/frameworks/as/src/org/apache/flex/html/staticControls/beads/PanelView.as
@@ -86,7 +86,6 @@ package org.apache.flex.html.staticControls.beads
 			
 			actualParent.x = metrics.left;
 			actualParent.y = titleBar.y + titleBar.height;
-			actualParent.width = UIBase(_strand).width - (metrics.left + metrics.right);
 			
 			if( controlBar ) {
 				controlBar.x = metrics.left;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c3f2a66b/frameworks/as/src/org/apache/flex/html/staticControls/beads/SliderView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/html/staticControls/beads/SliderView.as b/frameworks/as/src/org/apache/flex/html/staticControls/beads/SliderView.as
index 49581ba..fd44591 100644
--- a/frameworks/as/src/org/apache/flex/html/staticControls/beads/SliderView.as
+++ b/frameworks/as/src/org/apache/flex/html/staticControls/beads/SliderView.as
@@ -19,6 +19,7 @@
 package org.apache.flex.html.staticControls.beads
 {
 	import flash.display.DisplayObject;
+	import flash.display.Sprite;
 	
 	import org.apache.flex.core.IBead;
 	import org.apache.flex.core.IBeadModel;
@@ -44,6 +45,9 @@ package org.apache.flex.html.staticControls.beads
 		{
 			_strand = value;
 			
+			bkg = new Sprite();
+			UIBase(_strand).addChild(bkg);
+			
 			_track = new Button();
 			Button(_track).addBead(new (ValuesManager.valuesImpl.getValue(_strand, "iTrackView"))
as IBead);
 			
@@ -79,6 +83,7 @@ package org.apache.flex.html.staticControls.beads
 			if( needsSizing ) sizeChangeHandler(null);
 		}
 		
+		private var bkg:Sprite;
 		private var _track:DisplayObject;
 		private var _thumb:DisplayObject;
 		
@@ -97,16 +102,24 @@ package org.apache.flex.html.staticControls.beads
 			var w:Number = UIBase(_strand).width;
 			var h:Number = UIBase(_strand).height;
 			
-			_track.width = UIBase(_strand).width;
-			_track.height = 5;
-			_track.x = 0;
-			_track.y = (UIBase(_strand).height - _track.height)/2;
+			bkg.graphics.clear();
+			bkg.graphics.beginFill(0xFF8800);
+			bkg.graphics.drawRect(0,0,w,h);
+			bkg.graphics.endFill();
 			
 			_thumb.width = 20;
 			_thumb.height = UIBase(_strand).height;
 			
 			_thumb.x = 10;
-			_thumb.y = 0;//(UIBase(_strand).height - _thumb.height)/2;
+			_thumb.y = 0;
+			
+			// the track is inset 1/2 of the thumbwidth so the thumb can
+			// overlay the track on either end with the thumb center being
+			// on the track's edge
+			_track.width = UIBase(_strand).width - _thumb.width;
+			_track.height = 5;
+			_track.x = _thumb.width/2;
+			_track.y = (UIBase(_strand).height - _track.height)/2;
 		}
 		
 		private function modelChangeHandler( event:Event ) : void
@@ -117,9 +130,9 @@ package org.apache.flex.html.staticControls.beads
 		private function setThumbPositionFromValue( value:Number ) : void
 		{
 			var p:Number = (value-rangeModel.minimum)/(rangeModel.maximum-rangeModel.minimum);
-			var xloc:Number = p*(UIBase(_strand).width);
+			var xloc:Number = p*(UIBase(_strand).width - _thumb.width);
 			
-			_thumb.x = xloc - _thumb.width/2;
+			_thumb.x = xloc;
 		}
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c3f2a66b/frameworks/as/src/org/apache/flex/html/staticControls/beads/SpinnerView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/html/staticControls/beads/SpinnerView.as b/frameworks/as/src/org/apache/flex/html/staticControls/beads/SpinnerView.as
index f65e951..0590f71 100644
--- a/frameworks/as/src/org/apache/flex/html/staticControls/beads/SpinnerView.as
+++ b/frameworks/as/src/org/apache/flex/html/staticControls/beads/SpinnerView.as
@@ -25,6 +25,8 @@ package org.apache.flex.html.staticControls.beads
 	import org.apache.flex.core.IRangeModel;
 	import org.apache.flex.core.IStrand;
 	import org.apache.flex.core.UIBase;
+	import org.apache.flex.events.Event;
+	import org.apache.flex.events.IEventDispatcher;
 	import org.apache.flex.html.staticControls.Button;
 	import org.apache.flex.html.staticControls.beads.controllers.ButtonAutoRepeatController;
 	
@@ -56,6 +58,9 @@ package org.apache.flex.html.staticControls.beads
 			UIBase(_strand).addChild(_decrement);
 			UIBase(_strand).addChild(_increment);
 			rangeModel = _strand.getBeadByType(IBeadModel) as IRangeModel;
+			
+			IEventDispatcher(value).addEventListener("widthChanged",sizeChangeHandler);
+			IEventDispatcher(value).addEventListener("heightChanged",sizeChangeHandler);
 		}
 		
 		private var _decrement:DisplayObject;
@@ -69,5 +74,15 @@ package org.apache.flex.html.staticControls.beads
 		{
 			return _increment;
 		}
+		
+		private function sizeChangeHandler( event:Event ) : void
+		{
+			_increment.width = UIBase(_strand).width;
+			_increment.height = UIBase(_strand).height/2;
+			_increment.y      = 0;
+			_decrement.width = UIBase(_strand).width;
+			_decrement.height = UIBase(_strand).height/2;
+			_decrement.y      = _increment.height;
+		}
 	}
 }
\ No newline at end of file


Mime
View raw message