You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2017/05/23 07:16:13 UTC

[05/13] git commit: [flex-asjs] [refs/heads/release0.8.0] - add custom layout that locks the cross-axis dimension to the other children's size. Used in ASDoc to create the 3 pane view with scrolling. The scrolling container needs its size locked down.

add custom layout that locks the cross-axis dimension to the other children's size.  Used in ASDoc to create the 3 pane view with scrolling.  The scrolling container needs its size locked down.


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

Branch: refs/heads/release0.8.0
Commit: d550f670c510286032ddd437ca261a941b5bd00b
Parents: 646d01d
Author: Alex Harui <ah...@apache.org>
Authored: Sun May 21 23:37:59 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue May 23 00:15:56 2017 -0700

----------------------------------------------------------------------
 ...xibleChildHorizontalLayoutLockChildHeight.as | 91 +++++++++++++++++++
 ...FlexibleChildVerticalLayoutLockChildWidth.as | 93 ++++++++++++++++++++
 .../Basic/src/main/resources/basic-manifest.xml |  2 +
 3 files changed, 186 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d550f670/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayoutLockChildHeight.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayoutLockChildHeight.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayoutLockChildHeight.as
new file mode 100644
index 0000000..d170d23
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayoutLockChildHeight.as
@@ -0,0 +1,91 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.beads.layouts
+{
+	import org.apache.flex.core.LayoutBase;
+	import org.apache.flex.core.IDocument;
+	import org.apache.flex.core.ILayoutChild;
+	import org.apache.flex.core.ILayoutHost;
+	import org.apache.flex.core.ILayoutView;
+	import org.apache.flex.core.ILayoutParent;
+	import org.apache.flex.core.IParentIUIBase;
+	import org.apache.flex.core.IStrand;
+	import org.apache.flex.core.IUIBase;
+	import org.apache.flex.core.ValuesManager;
+	import org.apache.flex.core.UIBase;
+	import org.apache.flex.events.Event;
+	import org.apache.flex.geom.Rectangle;
+	import org.apache.flex.utils.CSSContainerUtils;
+	import org.apache.flex.utils.CSSUtils;
+
+    /**
+     *  The OneFlexibleChildHorizontalLayoutLockChildHeight 
+	 *  is a subclass of OneFlexibleChildHorizontalLayout
+	 *  that sets the flexible child's height to be the height
+	 *  of the host container.  This is useful when you
+	 *  don't want the actual child's height to dictate the
+	 *  height of the container in order to force
+	 *  scrollbars
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion FlexJS 0.0
+     */
+	public class OneFlexibleChildHorizontalLayoutLockChildHeight extends OneFlexibleChildHorizontalLayout
+	{
+        /**
+         *  Constructor.
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+		public function OneFlexibleChildHorizontalLayoutLockChildHeight()
+		{
+			super();
+		}
+
+        /**
+         * @copy org.apache.flex.core.IBeadLayout#layout
+         */
+		override public function layout():Boolean
+		{
+			var ret:Boolean = super.layout();
+			if (ret)
+			{
+				var contentView:ILayoutView = layoutView;
+	
+				var n:int = contentView.numElements;
+
+				var h:Number = host.height;
+				for(var i:int=0; i < n; i++) {
+					var child:UIBase = contentView.getElementAt(i) as UIBase;
+					if (child != actualChild)
+						h = child.height;
+				}
+				actualChild.setHeight(h); 
+			}
+			return ret;
+		}
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d550f670/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayoutLockChildWidth.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayoutLockChildWidth.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayoutLockChildWidth.as
new file mode 100644
index 0000000..7415299
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayoutLockChildWidth.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.flex.html.beads.layouts
+{
+	import org.apache.flex.core.LayoutBase;
+	import org.apache.flex.core.IDocument;
+	import org.apache.flex.core.ILayoutChild;
+	import org.apache.flex.core.ILayoutHost;
+	import org.apache.flex.core.ILayoutView;
+	import org.apache.flex.core.ILayoutParent;
+	import org.apache.flex.core.IParentIUIBase;
+	import org.apache.flex.core.IStrand;
+	import org.apache.flex.core.IStyleableObject;
+	import org.apache.flex.core.IUIBase;
+	import org.apache.flex.core.ValuesManager;
+	import org.apache.flex.core.UIBase;
+	import org.apache.flex.events.Event;
+	import org.apache.flex.geom.Rectangle;
+	import org.apache.flex.utils.CSSContainerUtils;
+	import org.apache.flex.utils.CSSUtils;
+
+    /**
+     *  The OneFlexibleChildHorizontalLayoutLockChildHeight 
+	 *  is a subclass of OneFlexibleChildHorizontalLayout
+	 *  that sets the flexible child's height to be the height
+	 *  of the host container.  This is useful when you
+	 *  don't want the actual child's height to dictate the
+	 *  height of the container in order to force
+	 *  scrollbars or line wrapping.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion FlexJS 0.0
+     */
+	public class OneFlexibleChildVerticalLayoutLockChildWidth extends OneFlexibleChildVerticalLayout
+	{
+        /**
+         *  Constructor.
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+		public function OneFlexibleChildVerticalLayoutLockChildWidth()
+		{
+			super();
+		}
+
+        /**
+         * @copy org.apache.flex.core.IBeadLayout#layout
+         */
+		override public function layout():Boolean
+		{
+			var ret:Boolean = super.layout();
+			if (ret)
+			{
+				var contentView:ILayoutView = layoutView;
+	
+				var n:int = contentView.numElements;
+
+				var w:Number = host.width;
+				for(var i:int=0; i < n; i++) {
+					var child:UIBase = contentView.getElementAt(i) as UIBase;
+					if (child != actualChild)
+						w = child.width;
+				}
+				
+				actualChild.setWidth(w); 
+			}
+			return ret;
+		}
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d550f670/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
index 204d10c..7cbc05d 100644
--- a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
@@ -150,6 +150,8 @@
     <component id="FlexibleFirstChildHorizontalLayout" class="org.apache.flex.html.beads.layouts.FlexibleFirstChildHorizontalLayout"/>
     <component id="OneFlexibleChildVerticalLayout" class="org.apache.flex.html.beads.layouts.OneFlexibleChildVerticalLayout"/>
     <component id="OneFlexibleChildHorizontalLayout" class="org.apache.flex.html.beads.layouts.OneFlexibleChildHorizontalLayout"/>
+    <component id="OneFlexibleChildVerticalLayoutLockChildWidth" class="org.apache.flex.html.beads.layouts.OneFlexibleChildVerticalLayoutLockChildWidth"/>
+    <component id="OneFlexibleChildHorizontalLayoutLockChildHeight" class="org.apache.flex.html.beads.layouts.OneFlexibleChildHorizontalLayoutLockChildHeight"/>
     <component id="MXMLBeadView" class="org.apache.flex.html.MXMLBeadView"/>
 
     <component id="SubAppLoader" class="org.apache.flex.html.SubAppLoader" />