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] - Updated Panel to accept children for a ControlBar. Created IUIBase as a common interface for UI components and modified TextButton and Button to implement to the IUIBase interface.
Date Thu, 30 May 2013 14:26:43 GMT
Updated Branches:
  refs/heads/develop 1451dceee -> 4673d3da1


Updated Panel to accept children for a ControlBar. Created IUIBase as a common interface for
UI components and modified TextButton and Button to implement to the IUIBase interface.


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

Branch: refs/heads/develop
Commit: 4673d3da1256e918506a51780c5226e9a81169e2
Parents: 1451dce
Author: Peter Ent <pent@apache.org>
Authored: Thu May 30 10:26:30 2013 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Thu May 30 10:26:30 2013 -0400

----------------------------------------------------------------------
 frameworks/as/defaults.css                         |    5 ++
 frameworks/as/src/org/apache/flex/core/IUIBase.as  |   33 +++++++++++++++
 frameworks/as/src/org/apache/flex/core/UIBase.as   |    2 +-
 .../org/apache/flex/html/staticControls/Button.as  |   15 +++++--
 .../apache/flex/html/staticControls/ControlBar.as  |   21 +++++++++
 .../apache/flex/html/staticControls/TextButton.as  |    4 +-
 .../flex/html/staticControls/beads/PanelBead.as    |   26 +++++++++++
 7 files changed, 99 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4673d3da/frameworks/as/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/as/defaults.css b/frameworks/as/defaults.css
index ea7974b..bc39a75 100644
--- a/frameworks/as/defaults.css
+++ b/frameworks/as/defaults.css
@@ -125,6 +125,11 @@ TitleBar
     ILayoutBead: ClassReference("org.apache.flex.html.staticControls.beads.layouts.NonVirtualHorizontalLayout");
 }
 
+ControlBar
+{
+    ILayoutBead: ClassReference("org.apache.flex.html.staticControls.beads.layouts.NonVirtualHorizontalLayout");
+}
+
 Panel
 {
     IPanelModel: ClassReference("org.apache.flex.html.staticControls.beads.models.PanelModel");

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4673d3da/frameworks/as/src/org/apache/flex/core/IUIBase.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/core/IUIBase.as b/frameworks/as/src/org/apache/flex/core/IUIBase.as
new file mode 100644
index 0000000..1042315
--- /dev/null
+++ b/frameworks/as/src/org/apache/flex/core/IUIBase.as
@@ -0,0 +1,33 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.core
+{
+	public interface IUIBase
+	{
+		function get model():IBeadModel;
+		
+		function get id():String;
+		function set id(value:String):void;
+		
+		function get className():String;
+		function set className(value:String):void;
+		
+		function addToParent(p:Object):void;
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4673d3da/frameworks/as/src/org/apache/flex/core/UIBase.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/core/UIBase.as b/frameworks/as/src/org/apache/flex/core/UIBase.as
index d368b14..bad368d 100644
--- a/frameworks/as/src/org/apache/flex/core/UIBase.as
+++ b/frameworks/as/src/org/apache/flex/core/UIBase.as
@@ -24,7 +24,7 @@ package org.apache.flex.core
 	import org.apache.flex.events.Event;
 	import org.apache.flex.events.IEventDispatcher;
 	
-	public class UIBase extends Sprite implements IInitModel, IStrand, IEventDispatcher
+	public class UIBase extends Sprite implements IInitModel, IStrand, IEventDispatcher, IUIBase
 	{
 		public function UIBase()
 		{

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4673d3da/frameworks/as/src/org/apache/flex/html/staticControls/Button.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/html/staticControls/Button.as b/frameworks/as/src/org/apache/flex/html/staticControls/Button.as
index d27e860..f5bc308 100644
--- a/frameworks/as/src/org/apache/flex/html/staticControls/Button.as
+++ b/frameworks/as/src/org/apache/flex/html/staticControls/Button.as
@@ -28,13 +28,15 @@ package org.apache.flex.html.staticControls
 	import org.apache.flex.core.IInitModel;
 	import org.apache.flex.core.IInitSkin;
 	import org.apache.flex.core.IStrand;
+	import org.apache.flex.core.IUIBase;
+	import org.apache.flex.core.UIBase;
 	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.events.Event;
 	import org.apache.flex.events.IEventDispatcher;
 	
 	[Event(name="click", type="org.apache.flex.events.Event")]
 
-	public class Button extends SimpleButton implements IStrand, IInitSkin, IInitModel, IEventDispatcher
+	public class Button extends SimpleButton implements IStrand, IInitSkin, IInitModel, IEventDispatcher,
IUIBase
 	{
 		public function Button(upState:DisplayObject=null, overState:DisplayObject=null, downState:DisplayObject=null,
hitTestState:DisplayObject=null)
 		{
@@ -105,7 +107,7 @@ package org.apache.flex.html.staticControls
 		}
 
 		private var _model:IBeadModel;
-		protected function get model():IBeadModel
+		public function get model():IBeadModel
 		{
 			return _model;
 		}
@@ -189,9 +191,14 @@ package org.apache.flex.html.staticControls
 			_height = $height;
 		}
 		
-		public function addToParent(p:DisplayObjectContainer):void
+		public function addToParent(p:Object):void
 		{
-			p.addChild(this);
+			if( p is UIBase ) {
+				UIBase(p).internalAddChild(this);
+			}
+			else if( p is DisplayObjectContainer ) {
+				p.addChild(this);
+			}
 		}
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4673d3da/frameworks/as/src/org/apache/flex/html/staticControls/ControlBar.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/html/staticControls/ControlBar.as b/frameworks/as/src/org/apache/flex/html/staticControls/ControlBar.as
index 426edbf..70ef494 100644
--- a/frameworks/as/src/org/apache/flex/html/staticControls/ControlBar.as
+++ b/frameworks/as/src/org/apache/flex/html/staticControls/ControlBar.as
@@ -18,19 +18,40 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.html.staticControls
 {
+	import org.apache.flex.core.IBead;
 	import org.apache.flex.core.IContainer;
 	import org.apache.flex.core.IInitSkin;
+	import org.apache.flex.core.IUIBase;
+	import org.apache.flex.core.ValuesManager;
+	import org.apache.flex.events.Event;
+	import org.apache.flex.html.staticControls.beads.layouts.NonVirtualHorizontalLayout;
 
 	public class ControlBar extends Container implements IContainer, IInitSkin
 	{
 		public function ControlBar()
 		{
 			super();
+			
+			className = "ControlBar";
 		}
 		
 		override public function initSkin():void
 		{
 			super.initSkin();	
+			
+			if( getBeadByType(NonVirtualHorizontalLayout) == null ) {
+				var layout:IBead = new (ValuesManager.valuesImpl.getValue(this, "iLayoutBead")) as IBead;
+				addBead(layout);
+			}
+		}
+		
+		public function transferChildren( list:Array ) : void
+		{
+			for each(var comp:IUIBase in list) {
+				comp.addToParent(this);
+			}
+			
+			childrenAdded();
 		}
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4673d3da/frameworks/as/src/org/apache/flex/html/staticControls/TextButton.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/html/staticControls/TextButton.as b/frameworks/as/src/org/apache/flex/html/staticControls/TextButton.as
index 55f0baa..07eff1d 100644
--- a/frameworks/as/src/org/apache/flex/html/staticControls/TextButton.as
+++ b/frameworks/as/src/org/apache/flex/html/staticControls/TextButton.as
@@ -19,11 +19,11 @@
 package org.apache.flex.html.staticControls
 {
 	import flash.display.DisplayObject;
-
+	
 	import org.apache.flex.core.IBead;
-	import org.apache.flex.core.ITextModel;
 	import org.apache.flex.core.IInitModel;
 	import org.apache.flex.core.IInitSkin;
+	import org.apache.flex.core.ITextModel;
 	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.html.staticControls.beads.ITextButtonBead;
 	

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4673d3da/frameworks/as/src/org/apache/flex/html/staticControls/beads/PanelBead.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/org/apache/flex/html/staticControls/beads/PanelBead.as b/frameworks/as/src/org/apache/flex/html/staticControls/beads/PanelBead.as
index 8ffa633..185ba0e 100644
--- a/frameworks/as/src/org/apache/flex/html/staticControls/beads/PanelBead.as
+++ b/frameworks/as/src/org/apache/flex/html/staticControls/beads/PanelBead.as
@@ -24,11 +24,13 @@ package org.apache.flex.html.staticControls.beads
 	
 	import org.apache.flex.core.IBead;
 	import org.apache.flex.core.IStrand;
+	import org.apache.flex.core.IUIBase;
 	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.events.Event;
 	import org.apache.flex.events.IEventDispatcher;
 	import org.apache.flex.html.staticControls.Container;
 	import org.apache.flex.html.staticControls.ControlBar;
+	import org.apache.flex.html.staticControls.Panel;
 	import org.apache.flex.html.staticControls.TitleBar;
 	
 	public class PanelBead implements IBead, IContainerBead
@@ -46,6 +48,12 @@ package org.apache.flex.html.staticControls.beads
 			return _titleBar;
 		}
 		
+		private var _controlBar:ControlBar;
+		public function get controlBar():ControlBar
+		{
+			return _controlBar;
+		}
+		
 		private var _strand:IStrand;
 		
 		public function set strand(value:IStrand):void
@@ -53,6 +61,15 @@ package org.apache.flex.html.staticControls.beads
 			_strand = value;
 			
 			Container(_strand).addChild(titleBar);
+			
+			var controlBarItems:Array = Panel(_strand).controlBar;
+			if( controlBarItems && controlBarItems.length > 0 ) {
+				_controlBar = new ControlBar();
+				_controlBar.initModel();
+				_controlBar.initSkin();
+				_controlBar.transferChildren(controlBarItems);
+				Container(_strand).addChild(controlBar);
+			}
 
 			var borderStyle:String;
 			var borderStyles:Object = ValuesManager.valuesImpl.getValue(value, "border");
@@ -133,6 +150,8 @@ package org.apache.flex.html.staticControls.beads
 			contentArea.y = titleBar.height;
 			contentArea.width = Container(_strand).width;
 			
+			if( controlBar ) layoutControlBarArea();
+			
 			IEventDispatcher(_strand).dispatchEvent(new Event('widthChanged'));
 			IEventDispatcher(_strand).dispatchEvent(new Event('heightChanged'));
 		}
@@ -143,5 +162,12 @@ package org.apache.flex.html.staticControls.beads
 			titleBar.y = 0;
 			titleBar.width = Container(_strand).width;
 		}
+		
+		protected function layoutControlBarArea() : void
+		{
+			controlBar.x = 0;
+			controlBar.y = contentArea.y + contentArea.height;
+			controlBar.width = Container(_strand).width;
+		}
 	}
 }
\ No newline at end of file


Mime
View raw message