You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2015/05/26 16:39:05 UTC
git commit: [flex-asjs] [refs/heads/develop] - Updated Panels to work
with changes to layout code.
Repository: flex-asjs
Updated Branches:
refs/heads/develop b7cec7f21 -> 941c7630e
Updated Panels to work with changes to layout code.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/941c7630
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/941c7630
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/941c7630
Branch: refs/heads/develop
Commit: 941c7630e9c4a448bd9956b328a3929af67d6b49
Parents: b7cec7f
Author: Peter Ent <pe...@apache.org>
Authored: Tue May 26 10:39:04 2015 -0400
Committer: Peter Ent <pe...@apache.org>
Committed: Tue May 26 10:39:04 2015 -0400
----------------------------------------------------------------------
frameworks/projects/HTML/as/defaults.css | 4 +
.../src/org/apache/flex/html/beads/PanelView.as | 4 +-
.../flex/html/beads/PanelWithControlBarView.as | 112 ++++++++-----------
3 files changed, 51 insertions(+), 69 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/941c7630/frameworks/projects/HTML/as/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/defaults.css b/frameworks/projects/HTML/as/defaults.css
index 6abecaa..6bca6cd 100644
--- a/frameworks/projects/HTML/as/defaults.css
+++ b/frameworks/projects/HTML/as/defaults.css
@@ -94,6 +94,8 @@ Container
ControlBar
{
+ IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.HorizontalLayout");
+
background-color: #CECECE;
border-style: solid;
border-color: #000000;
@@ -166,6 +168,7 @@ Panel
border-style: solid;
border-color: #000000;
border-width: 1px;
+ padding: 2px;
}
PanelWithControlBar
@@ -177,6 +180,7 @@ PanelWithControlBar
border-style: solid;
border-color: #000000;
border-width: 1px;
+ padding: 2px;
}
SimpleList
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/941c7630/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as
index 8be59e0..e9c4299 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as
@@ -122,9 +122,7 @@ package org.apache.flex.html.beads
override protected function determinePadding():Object
{
var paddings:Object = super.determinePadding();
- titleBar.x = paddings.left;
- titleBar.y = paddings.top;
- titleBar.width = UIBase(_strand).width;
+ titleBar.width = UIBase(_strand).clientWidth;
paddings.paddingTop += titleBar.height;
return paddings;
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/941c7630/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as
index 0ea7b35..1337768 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as
@@ -99,30 +99,39 @@ package org.apache.flex.html.beads
*/
override public function set strand(value:IStrand):void
{
- super.strand = value;
+ var host:UIBase = UIBase(value);
- // TODO: (aharui) get class to instantiate from CSS
- _titleBar = new TitleBar();
+ // TODO: (aharui) get class to instantiate from CSS
+ if (!_titleBar)
+ _titleBar = new TitleBar();
+ _titleBar.percentWidth = 100;
// replace the TitleBar's model with the Panel's model (it implements ITitleBarModel) so that
// any changes to values in the Panel's model that correspond values in the TitleBar will
// be picked up automatically by the TitleBar.
- titleBar.model = UIBase(_strand).model as ITitleBarModel;
- Container(_strand).addElement(titleBar, false);
+ titleBar.model = host.model;
+ host.addElement(titleBar, false);
+ titleBar.addEventListener("heightChanged", changeHandler);
+ if (isNaN(host.explicitWidth) && isNaN(host.percentWidth))
+ titleBar.addEventListener("widthChanged", changeHandler);
- var controlBarItems:Array = IPanelModel(UIBase(_strand).model).controlBar;
+ var controlBarItems:Array = (host.model as IPanelModel).controlBar;
if( controlBarItems && controlBarItems.length > 0 ) {
_controlBar = new ControlBar();
+ _controlBar.percentWidth = 100;
+ _controlBar.height = 30;
for each(var comp:IUIBase in controlBarItems) {
_controlBar.addElement(comp, false);
}
+ _controlBar.dispatchEvent(new Event("layoutNeeded"));
- Container(_strand).addElement(controlBar, false);
+ host.addElement(controlBar, false);
+ controlBar.addEventListener("heightChanged", changeHandler);
+ if (isNaN(host.explicitWidth) && isNaN(host.percentWidth))
+ controlBar.addEventListener("widthChanged", changeHandler);
}
- layoutChromeElements();
-
- IEventDispatcher(_strand).addEventListener("childrenAdded", changeHandler);
+ super.strand = value;
}
/**
@@ -142,35 +151,16 @@ package org.apache.flex.html.beads
/**
* @private
*/
- private function layoutChromeElements():void
+ override protected function determinePadding():Object
{
- var metrics:UIMetrics = BeadMetrics.getMetrics(_strand);
-
- titleBar.x = 0;
- titleBar.y = 0;
- titleBar.width = UIBase(_strand).width;
-
- var ypos:Number = titleBar.y + titleBar.height;
-
- actualParent.x = 0;
- actualParent.y = ypos;
-
- ypos = actualParent.y + actualParent.height;
- trace("ypos is "+ypos+" because actualParent.height is "+actualParent.height);
-
- if (controlBar) {
- controlBar.x = 0;
- controlBar.width = UIBase(_strand).width;
-
- var expHeight:Number = UIBase(_strand).explicitHeight;
- if (isNaN(expHeight)) {
- controlBar.y = ypos;
- } else {
- controlBar.y = expHeight - controlBar.height;
- }
- }
-
- UIBase(_strand).dispatchEvent(new Event("widthChanged"));
+ var paddings:Object = super.determinePadding();
+ titleBar.width = UIBase(_strand).clientWidth;
+ paddings.paddingTop += titleBar.height;
+
+ controlBar.width = UIBase(_strand).clientWidth;
+ paddings.paddingBottom += controlBar.height;
+
+ return paddings;
}
/**
@@ -178,42 +168,32 @@ package org.apache.flex.html.beads
*/
override protected function changeHandler(event:Event):void
{
- layoutChromeElements();
+ super.changeHandler(event);
+
+ controlBar.y = UIBase(_strand).clientHeight - controlBar.height;
}
- private function changeHandlerOLD(event:Event):void
+
+ /**
+ * @private
+ */
+ private function layoutChromeElements():void
{
- var metrics:UIMetrics = BeadMetrics.getMetrics(_strand);
-
- var w:Number = UIBase(_strand).explicitWidth;
- if (isNaN(w)) w = Math.max(titleBar.width,actualParent.width+metrics.left+metrics.right,controlBar?controlBar.width:0);
-
- var h:Number = UIBase(_strand).explicitHeight;
- if (isNaN(h)) h = titleBar.height + actualParent.height + (controlBar ? controlBar.height : 0) +
- metrics.top + metrics.bottom;
-
+ var paddings:Object = determinePadding();
titleBar.x = 0;
titleBar.y = 0;
- titleBar.width = w;
-
- var remainingHeight:Number = h - titleBar.height;
+ titleBar.width = UIBase(_strand).clientWidth;
- if( controlBar ) {
+ if (controlBar) {
controlBar.x = 0;
- controlBar.y = h - controlBar.height;
- //controlBar.y = actualParent.y + actualParent.height + metrics.bottom;
- controlBar.width = w;
-
- remainingHeight -= controlBar.height;
+ controlBar.y = UIBase(_strand).clientHeight - controlBar.height;
+ controlBar.width = UIBase(_strand).clientWidth;
}
- actualParent.x = metrics.left;
- actualParent.y = titleBar.y + titleBar.height + metrics.top;
- actualParent.width = w;
- actualParent.height = remainingHeight - metrics.top - metrics.bottom;
-
- UIBase(_strand).width = w;
- UIBase(_strand).height = h;
+ actualParent.x = paddings.paddingLeft;
+ actualParent.y = titleBar.height + paddings.paddingTop;
+ actualParent.width = UIBase(_strand).clientWidth - paddings.paddingLeft - paddings.paddingRight;
+ actualParent.height = UIBase(_strand).clientHeight - titleBar.height - paddings.paddingTop - paddings.paddingBottom;
+ if (controlBar) actualParent.height -= controlBar.height;
}
-
}
}