flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject [1/3] git commit: [flex-asjs] [refs/heads/develop] - Added support for viewports.
Date Mon, 22 Jun 2015 14:39:59 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop dff62672a -> f62f49c75


Added support for viewports.


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

Branch: refs/heads/develop
Commit: e0b037f44eb845e96caeae53d007e3eb9220c089
Parents: dff6267
Author: Peter Ent <pent@apache.org>
Authored: Mon Jun 22 10:37:49 2015 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Mon Jun 22 10:37:49 2015 -0400

----------------------------------------------------------------------
 frameworks/projects/Core/as/src/CoreClasses.as  |  3 +
 .../src/org/apache/flex/core/ContainerBase.as   | 15 ++-
 .../org/apache/flex/core/IItemRendererParent.as |  1 +
 .../as/src/org/apache/flex/core/IViewport.as    | 69 ++++++++++++++
 .../src/org/apache/flex/core/IViewportModel.as  | 96 ++++++++++++++++++++
 .../org/apache/flex/core/IViewportScroller.as   | 35 +++++++
 .../Core/as/src/org/apache/flex/core/UIBase.as  |  2 +-
 7 files changed, 217 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e0b037f4/frameworks/projects/Core/as/src/CoreClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/CoreClasses.as b/frameworks/projects/Core/as/src/CoreClasses.as
index 2a89966..43abbdc 100644
--- a/frameworks/projects/Core/as/src/CoreClasses.as
+++ b/frameworks/projects/Core/as/src/CoreClasses.as
@@ -65,6 +65,9 @@ internal class CoreClasses
     import org.apache.flex.core.IToggleButtonModel; IToggleButtonModel;
     import org.apache.flex.core.IUIBase; IUIBase;
     import org.apache.flex.core.IValueToggleButtonModel; IValueToggleButtonModel;
+	import org.apache.flex.core.IViewport; IViewport;
+	import org.apache.flex.core.IViewportModel; IViewportModel;
+	import org.apache.flex.core.IViewportScroller; IViewportScroller;
     import org.apache.flex.core.SimpleStatesImpl; SimpleStatesImpl;
     import org.apache.flex.core.DataBindingBase; DataBindingBase;
     import org.apache.flex.core.UIBase; UIBase;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e0b037f4/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBase.as b/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBase.as
index f3efca6..bd2ade4 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBase.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBase.as
@@ -190,9 +190,18 @@ package org.apache.flex.core
         override public function removeElement(c:Object, dispatchEvent:Boolean = true):void
         {
             if (c is IUIBase)
-                actualParent.removeChild(IUIBase(c).element as DisplayObject);
-            else
-                actualParent.removeChild(c as DisplayObject);
+			{
+				if (supportsChromeChildren && c is IChrome) {
+					removeChild(IUIBase(c).element as DisplayObject);
+				}
+				else {
+					actualParent.removeChild(IUIBase(c).element as DisplayObject);
+				}
+			}
+			else {
+				actualParent.removeChild(c as DisplayObject);
+			}    
+            
             if (dispatchEvent)
                 this.dispatchEvent(new Event("childrenRemoved"));
         }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e0b037f4/frameworks/projects/Core/as/src/org/apache/flex/core/IItemRendererParent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/IItemRendererParent.as b/frameworks/projects/Core/as/src/org/apache/flex/core/IItemRendererParent.as
index cb0531d..2b36d0d 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/core/IItemRendererParent.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/IItemRendererParent.as
@@ -47,5 +47,6 @@ package org.apache.flex.core
          */
 		function getItemRendererForIndex(index:int):IItemRenderer;
 		function removeAllElements():void;
+		function updateAllItemRenderers():void;
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e0b037f4/frameworks/projects/Core/as/src/org/apache/flex/core/IViewport.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/IViewport.as b/frameworks/projects/Core/as/src/org/apache/flex/core/IViewport.as
new file mode 100644
index 0000000..ed3c1c2
--- /dev/null
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/IViewport.as
@@ -0,0 +1,69 @@
+package org.apache.flex.core
+{
+	/**
+	 * A Viewport is a window onto an area of content. A viewport is given space
+	 * in which to operate by a View bead. Viewports can control their area which
+	 * is specified by the IViewportModel, adding scrollbars or whatever scrolling
+	 * mechanism they want.
+	 */
+	public interface IViewport extends IBead
+	{
+		/**
+		 * The IViewportModel the instance of the Viewport should use to determine
+		 * its location and the location/size of the content it is managing. The
+		 * model also contains the layout to use and the contentArea to manage.
+		 */
+		function get model():IViewportModel;
+		function set model(value:IViewportModel):void;
+		
+		/**
+		 * Runs the layout that has been set in the IViewportModel. The function
+		 * returns true if the layout changed the size of the content area as
+		 * specified by the IViewportModel.
+		 */
+		function runLayout():Boolean;
+		
+		/**
+		 * Invoke this function to actually change the contentArea (specified in
+		 * the IViewportModel.
+		 */
+		function updateContentAreaSize():void;
+		
+		/**
+		 * Invoke this function when the host of the viewport has changed size.
+		 */
+		function updateSize():void;
+		
+		/**
+		 * If a View determines that scrollers are needed, it can inform the
+		 * Viewport using one of these three methods.
+		 */
+		function needsScrollers():void;
+		function needsVerticalScroller():void;
+		function needsHorizontalScroller():void;
+		
+		/**
+		 * Returns the vertical scroller being used, if any.
+		 */
+		function get verticalScroller():IViewportScroller;
+		
+		/**
+		 * Returns the horizontal scroller being used, if any.
+		 */
+		function get horizontalScroller():IViewportScroller;
+		
+		/**
+		 * Returns the effective width of the vertical scroller. This may
+		 * be the actual width of the scroller or it might be zero if the
+		 * scroller has no impact on the view.
+		 */
+		function scrollerWidth():Number;
+		
+		/**
+		 * Returns the effective height of the horizontal scroller. This may
+		 * be the actual height of the scroller or it might be zero if the
+		 * scroller has no impact on the view.
+		 */
+		function scrollerHeight():Number;
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e0b037f4/frameworks/projects/Core/as/src/org/apache/flex/core/IViewportModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/IViewportModel.as b/frameworks/projects/Core/as/src/org/apache/flex/core/IViewportModel.as
new file mode 100644
index 0000000..4ce51d0
--- /dev/null
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/IViewportModel.as
@@ -0,0 +1,96 @@
+package org.apache.flex.core
+{
+	/**
+	 * A Viewport is a window onto an area of content. A viewport is given space
+	 * in which to operate by a View bead and given this model with the properties
+	 * necessary for its function.
+	 */
+	public interface IViewportModel extends IBeadModel
+	{	
+		// Layout and Content
+		
+		/**
+		 * The layout being used to size and shape the content area
+		 */
+		function get layout():IBeadLayout;
+		function set layout(value:IBeadLayout):void;
+		
+		/**
+		 * The content area being managed by the viewport
+		 */
+		function get contentArea():IUIBase;
+		function set contentArea(value:IUIBase):void;
+		
+		// Viewport Position and Dimensions
+		
+		/**
+		 * The x position of the viewport space as allocated by the View.
+		 */
+		function get viewportX():Number;
+		function set viewportX(value:Number):void;
+		
+		/**
+		 * The y position of the viewport space as allocated by the View.
+		 */
+		function get viewportY():Number;
+		function set viewportY(value:Number):void;
+		
+		/**
+		 * The width of the viewport space as allocated by the View.
+		 */
+		function get viewportWidth():Number;
+		function set viewportWidth(value:Number):void;
+		
+		/**
+		 * The height of the viewport space as allocated by the View.
+		 */
+		function get viewportHeight():Number;
+		function set viewportHeight(value:Number):void;
+		
+		// Content Area Size and Position
+		
+		/**
+		 * The position of the content area within the viewport. This may
+		 * be an offset from the viewportX due to padding.
+		 */
+		function get contentX():Number;
+		function set contentX(value:Number):void;
+		
+		/**
+		 * The position of the content area within the viewport. This may
+		 * be an offset from the viewportY due to padding.
+		 */
+		function get contentY():Number;
+		function set contentY(value:Number):void;
+		
+		/**
+		 * The width of the content area within the viewport. The width is
+		 * determined by the content itself, mostly due to the use of 
+		 * a layout.
+		 */
+		function get contentWidth():Number;
+		function set contentWidth(value:Number):void;
+		
+		/**
+		 * The height of the content area within the viewport. The height
+		 * is determined by the content itself, mostly due to the use of
+		 * a layout.
+		 */
+		function get contentHeight():Number;
+		function set contentHeight(value:Number):void;
+		
+		// Scrolling Parameters
+		
+		/**
+		 * The top position of the content area that is visible in the viewport.
+		 */
+		function get verticalScrollPosition():Number;
+		function set verticalScrollPosition(value:Number):void;
+		
+		/**
+		 * The left position of the content area that is visible in the viewport.
+		 */
+		function get horizontalScrollPosition():Number;
+		function set horizontalScrollPosition(value:Number):void;
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e0b037f4/frameworks/projects/Core/as/src/org/apache/flex/core/IViewportScroller.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/IViewportScroller.as b/frameworks/projects/Core/as/src/org/apache/flex/core/IViewportScroller.as
new file mode 100644
index 0000000..401b908
--- /dev/null
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/IViewportScroller.as
@@ -0,0 +1,35 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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
+{
+    /**
+     *  The IViewportScroller interface describes an object that can be used to scroll
+	 *  or navigate around a system that uses an IViewport. This may be a traditional
+	 *  scroll bar, or it could be something completely different.
+     * 
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion FlexJS 0.0
+     */
+	public interface IViewportScroller
+	{
+        
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e0b037f4/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as b/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as
index eb5d272..e8720f7 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as
@@ -463,7 +463,7 @@ package org.apache.flex.core
             if (_width != newWidth)
             {
                 _width = newWidth;
-                if (_height == newHeight)
+                if (_width == newWidth)
                     if (!noEvent) 
                         dispatchEvent(new Event("widthChanged"));
             }


Mime
View raw message