You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Piotr Zarzycki <pi...@gmail.com> on 2017/03/06 19:28:30 UTC
Re: git commit: [flex-asjs] [refs/heads/develop] - Introducing the
Group container.
Hi Peter,
Nice job! Could you please add @productversion FlexJS 0.8 ? I think it can
be useful in future.
Thanks,
Piotr
2017-03-06 19:15 GMT+01:00 <pe...@apache.org>:
> Repository: flex-asjs
> Updated Branches:
> refs/heads/develop 8fe2f0831 -> 79d45cba0
>
>
> Introducing the Group container.
>
>
> Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
> Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/79d45cba
> Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/79d45cba
> Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/79d45cba
>
> Branch: refs/heads/develop
> Commit: 79d45cba0616e394fddb68835859b1ffc87e6c48
> Parents: 8fe2f08
> Author: Peter Ent <pe...@apache.org>
> Authored: Mon Mar 6 13:15:34 2017 -0500
> Committer: Peter Ent <pe...@apache.org>
> Committed: Mon Mar 6 13:15:34 2017 -0500
>
> ----------------------------------------------------------------------
> .../projects/HTML/src/main/flex/HTMLClasses.as | 4 +-
> .../main/flex/org/apache/flex/core/GroupBase.as | 301 +++++++++++++++++++
> .../src/main/flex/org/apache/flex/html/Group.as | 92 ++++++
> .../org/apache/flex/html/beads/GroupView.as | 269 +++++++++++++++++
> .../flex/html/beads/layouts/BasicLayout.as | 73 +----
> .../HTML/src/main/resources/basic-manifest.xml | 1 +
> .../HTML/src/main/resources/defaults.css | 10 +
> 7 files changed, 689 insertions(+), 61 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> 79d45cba/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
> ----------------------------------------------------------------------
> diff --git a/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
> b/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
> index bfe204b..41cb877 100644
> --- a/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
> +++ b/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
> @@ -26,8 +26,7 @@ package
> * from the classes specified in manifest.xml.
> */
> internal class HTMLClasses
> -{
> -
> +{
> import org.apache.flex.html.ToolTip; ToolTip;
> import org.apache.flex.html.accessories.NumericOnlyTextInputBead;
> NumericOnlyTextInputBead;
> import org.apache.flex.html.beads.DispatchInputFinishedBead;
> DispatchInputFinishedBead;
> @@ -45,6 +44,7 @@ internal class HTMLClasses
> }
> import org.apache.flex.html.beads.ComboBoxView; ComboBoxView;
> import org.apache.flex.html.beads.ContainerView; ContainerView;
> + import org.apache.flex.html.beads.GroupView; GroupView;
> COMPILE::SWF
> {
> import org.apache.flex.html.beads.ControlBarMeasurementBead;
> ControlBarMeasurementBead;
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> 79d45cba/frameworks/projects/HTML/src/main/flex/org/apache/
> flex/core/GroupBase.as
> ----------------------------------------------------------------------
> diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/GroupBase.as
> b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/GroupBase.as
> new file mode 100644
> index 0000000..7b945cc
> --- /dev/null
> +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/
> core/GroupBase.as
> @@ -0,0 +1,301 @@
> +///////////////////////////////////////////////////////////
> /////////////////////
> +//
> +// 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
> +{
> + import org.apache.flex.core.IMXMLDocument;
> + import org.apache.flex.core.ValuesManager;
> + import org.apache.flex.events.Event;
> + import org.apache.flex.events.ValueChangeEvent;
> + import org.apache.flex.states.State;
> + import org.apache.flex.utils.MXMLDataInterpreter;
> +
> + /**
> + * Indicates that the state change has completed. All properties
> + * that need to change have been changed, and all transitinos
> + * that need to run have completed. However, any deferred work
> + * may not be completed, and the screen may not be updated until
> + * code stops executing.
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + [Event(name="stateChangeComplete", type="org.apache.flex.events.
> Event")]
> +
> + /**
> + * Indicates that the initialization of the container is complete.
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + [Event(name="initComplete", type="org.apache.flex.events.Event")]
> +
> + /**
> + * Indicates that the children of the container is have been added.
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + [Event(name="childrenAdded", type="org.apache.flex.events.Event")]
> +
> + /**
> + * The default property uses when additional MXML content appears
> within an element's
> + * definition in an MXML file.
> + */
> + [DefaultProperty("mxmlContent")]
> +
> + /**
> + * The GroupBase class is the base class for most simple containers
> + * in FlexJS. It is usable as the root tag of MXML
> + * documents and UI controls and containers are added to it.
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + public class GroupBase extends UIBase implements IMXMLDocument,
> IStatesObject, IContainer
> + {
> + /**
> + * Constructor.
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + public function GroupBase()
> + {
> + super();
> + }
> +
> + /**
> + * @flexjsignorecoercion org.apache.flex.core.
> WrappedHTMLElement
> + */
> + COMPILE::JS
> + override protected function createElement():
> WrappedHTMLElement
> + {
> + element = document.createElement('div') as
> WrappedHTMLElement;
> + element.flexjs_wrapper = this;
> +
> + positioner = element;
> +
> + return element;
> + }
> +
> + /**
> + * @private
> + */
> + public function childrenAdded():void
> + {
> + dispatchEvent(new Event("childrenAdded"));
> + }
> +
> + override public function addedToParent():void
> + {
> + if (!_initialized)
> + {
> + // each MXML file can also have styles in
> fx:Style block
> + ValuesManager.valuesImpl.init(this);
> + }
> +
> + super.addedToParent();
> +
> + if (!_initialized)
> + {
> + MXMLDataInterpreter.
> generateMXMLInstances(_mxmlDocument, this, MXMLDescriptor);
> +
> + dispatchEvent(new Event("initBindings"));
> + dispatchEvent(new Event("initComplete"));
> + _initialized = true;
> + }
> + }
> +
> + private var _mxmlDescriptor:Array;
> + private var _mxmlDocument:Object = this;
> + private var _initialized:Boolean;
> +
> + /**
> + * @copy org.apache.flex.core.Application#MXMLDescriptor
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + public function get MXMLDescriptor():Array
> + {
> + return _mxmlDescriptor;
> + }
> +
> + /**
> + * @private
> + */
> + public function setMXMLDescriptor(document:Object,
> value:Array):void
> + {
> + _mxmlDocument = document;
> + _mxmlDescriptor = value;
> + }
> +
> + /**
> + * @copy org.apache.flex.core.Application#
> generateMXMLAttributes()
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + public function generateMXMLAttributes(data:Array):void
> + {
> + MXMLDataInterpreter.generateMXMLProperties(this, data);
> + }
> +
> + /**
> + * @copy org.apache.flex.core.ItemRendererClassFactory#
> mxmlContent
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + public var mxmlContent:Array;
> +
> + private var _states:Array;
> +
> + /**
> + * The array of view states. These should
> + * be instances of org.apache.flex.states.State.
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + public function get states():Array
> + {
> + return _states;
> + }
> +
> + /**
> + * @private
> + * @flexjsignorecoercion Class
> + * @flexjsignorecoercion org.apache.flex.core.IBead
> + */
> + public function set states(value:Array):void
> + {
> + _states = value;
> + _currentState = _states[0].name;
> +
> + try{
> + if (getBeadByType(IStatesImpl) == null)
> + {
> + var c:Class = ValuesManager.valuesImpl.getValue(this,
> "iStatesImpl") as Class;
> + var b:Object = new c();
> + addBead(b as IBead);
> + }
> + }
> + //TODO: Need to handle this case more gracefully
> + catch(e:Error)
> + {
> + COMPILE::SWF
> + {
> + trace(e.message);
> + }
> + }
> +
> + }
> +
> + /**
> + * <code>true</code> if the array of states
> + * contains a state with this name.
> + *
> + * @param state The state namem.
> + * @return True if state in state array
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + public function hasState(state:String):Boolean
> + {
> + for each (var s:State in _states)
> + {
> + if (s.name == state)
> + return true;
> + }
> + return false;
> + }
> +
> + private var _currentState:String;
> +
> + [Bindable("currentStateChange")]
> + /**
> + * The name of the current state.
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + public function get currentState():String
> + {
> + return _currentState;
> + }
> +
> + /**
> + * @private
> + */
> + public function set currentState(value:String):void
> + {
> + var event:ValueChangeEvent = new ValueChangeEvent("currentStateChange",
> false, false, _currentState, value)
> + _currentState = value;
> + dispatchEvent(event);
> + }
> +
> + private var _transitions:Array;
> +
> + /**
> + * The array of transitions.
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + public function get transitions():Array
> + {
> + return _transitions;
> + }
> +
> + /**
> + * @private
> + */
> + public function set transitions(value:Array):void
> + {
> + _transitions = value;
> + }
> +
> + }
> +}
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> 79d45cba/frameworks/projects/HTML/src/main/flex/org/apache/
> flex/html/Group.as
> ----------------------------------------------------------------------
> diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Group.as
> b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Group.as
> new file mode 100644
> index 0000000..a881d10
> --- /dev/null
> +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Group.as
> @@ -0,0 +1,92 @@
> +///////////////////////////////////////////////////////////
> /////////////////////
> +//
> +// 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
> +{
> + import org.apache.flex.core.GroupBase;
> + import org.apache.flex.core.IContainer;
> + import org.apache.flex.core.ILayoutHost;
> + import org.apache.flex.core.ILayoutParent;
> + import org.apache.flex.core.IMXMLDocument;
> + import org.apache.flex.core.IStrand;
> + import org.apache.flex.core.IBead;
> + import org.apache.flex.core.IBeadLayout;
> + import org.apache.flex.core.IParentIUIBase;
> + 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.utils.MXMLDataInterpreter;
> +
> + /**
> + * Indicates that the children of the container is have been
> added.
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + [Event(name="childrenAdded", type="org.apache.flex.events.Event")]
> +
> + /**
> + * Default property
> + */
> + [DefaultProperty("mxmlContent")]
> +
> + /**
> + * The Group class provides a light-weight container for visual
> elements. By default
> + * the Group does not have a layout, allowing its children to be
> sized and positioned
> + * using styles or CSS.
> + *
> + * @toplevel
> + * @see org.apache.flex.html.beads.layout
> + * @see org.apache.flex.html.supportClasses.ScrollingViewport
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + public class Group extends GroupBase implements ILayoutParent,
> IParentIUIBase
> + {
> + /**
> + * Constructor.
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + public function Group()
> + {
> + super();
> + }
> +
> + /**
> + * Returns the ILayoutHost which is its view. From
> ILayoutParent.
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + public function getLayoutHost():ILayoutHost
> + {
> + return view as ILayoutHost;
> + }
> + }
> +}
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> 79d45cba/frameworks/projects/HTML/src/main/flex/org/apache/
> flex/html/beads/GroupView.as
> ----------------------------------------------------------------------
> diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/GroupView.as
> b/frameworks/projects/HTML/src/main/flex/org/apache/flex/
> html/beads/GroupView.as
> new file mode 100644
> index 0000000..c63e013
> --- /dev/null
> +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/
> html/beads/GroupView.as
> @@ -0,0 +1,269 @@
> +///////////////////////////////////////////////////////////
> /////////////////////
> +//
> +// 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
> +{
> + import org.apache.flex.core.IBead;
> + import org.apache.flex.core.IBeadLayout;
> + import org.apache.flex.core.IBeadView;
> + import org.apache.flex.core.ILayoutChild;
> + import org.apache.flex.core.ILayoutHost;
> + import org.apache.flex.core.IParentIUIBase;
> + import org.apache.flex.core.IStrand;
> + import org.apache.flex.core.IUIBase;
> + import org.apache.flex.core.BeadViewBase;
> + import org.apache.flex.core.UIBase;
> + import org.apache.flex.core.ValuesManager;
> + import org.apache.flex.events.Event;
> +
> + /**
> + * The GroupView is a bead that manages the layout bead (if any)
> attached to a Group. This class
> + * also provides support for background and border styles for a
> Group on the SWF platform.
> + *
> + * @viewbead
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + public class GroupView extends BeadViewBase implements IBeadView,
> ILayoutHost
> + {
> + /**
> + * The GroupView class is the default view for
> + * the org.apache.flex.html.Group class.
> + * It lets you use some CSS styles to manage the border,
> background
> + * and padding around the content area.
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + public function GroupView()
> + {
> + super();
> +
> + layoutRunning = false;
> + }
> +
> + /**
> + * The sub-element used as the parent of the container's
> elements. This does not
> + * include the chrome elements.
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + public function get contentView():IParentIUIBase
> + {
> + return host as IParentIUIBase;
> + }
> +
> + /**
> + * The view that can be resized.
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + public function get resizableView():IUIBase
> + {
> + return host;
> + }
> +
> +
> + private var layoutRunning:Boolean;
> +
> + /**
> + * Strand setter.
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + override public function set strand(value:IStrand):void
> + {
> + _strand = value;
> + super.strand = value;
> +
> + COMPILE::SWF {
> + displayBackgroundAndBorder(host as
> UIBase);
> + }
> +
> + // listen for initComplete to signal that the
> strand is set with its size
> + // and beads.
> + host.addEventListener("beadsAdded",
> beadsAddedHandler);
> + }
> +
> + /**
> + * Handles the initComplete event by completing the setup
> and kicking off the
> + * presentation of the Container.
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + protected function beadsAddedHandler(event:Event):void
> + {
> + var ilc:ILayoutChild = host as ILayoutChild;
> + // Complete the setup if the height is sized to
> content or has been explicitly set
> + // and the width is sized to content or has been explicitly
> set
> + if ((ilc.isHeightSizedToContent() ||
> !isNaN(ilc.explicitHeight)) &&
> + (ilc.isWidthSizedToContent() ||
> !isNaN(ilc.explicitWidth))) {
> + completeSetup();
> +
> + var num:Number = contentView.numElements;
> + if (num > 0) performLayout(event);
> + }
> + else {
> + // otherwise, wait until the unknown sizes
> have been set and then finish
> + host.addEventListener("sizeChanged",
> deferredSizeHandler);
> + host.addEventListener("widthChanged",
> deferredSizeHandler);
> + host.addEventListener("heightChanged",
> deferredSizeHandler);
> + }
> + }
> +
> + /**
> + * Handles the case where the size of the host is not
> immediately known, usually do
> + * to one of its dimensions being indicated as a percent
> size.
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + private function deferredSizeHandler(event:Event):void
> + {
> + host.removeEventListener("sizeChanged", deferredSizeHandler);
> + host.removeEventListener("widthChanged",
> deferredSizeHandler);
> + host.removeEventListener("heightChanged",
> deferredSizeHandler);
> + completeSetup();
> +
> + var num:Number = contentView.numElements;
> + if (num > 0)
> + {
> + performLayout(event);
> + }
> + }
> +
> + /**
> + * Called when the host is ready to complete its setup
> (usually after its size has been
> + * determined).
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + protected function completeSetup():void
> + {
> + // set up listeners for when children are added or
> there is a specific request
> + // to perform the layout again.
> + host.addEventListener("childrenAdded",
> performLayout);
> + host.addEventListener("layoutNeeded",
> performLayout);
> + host.addEventListener("viewCreated",
> viewCreatedHandler);
> + }
> +
> + /**
> + * Handles the viewCreated event by performing the first
> layout if
> + * there are children already present (ie, from MXML).
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + protected function viewCreatedHandler(event:Event):void
> + {
> + if ((host as UIBase).numElements > 0) {
> + performLayout(null);
> + }
> + }
> +
> + /**
> + * Executes the layout associated with this container.
> Once the layout has been
> + * run, it may affect the size of the host or may cause
> the host to present scroll
> + * bars view its viewport.
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + protected function performLayout(event:Event):void
> + {
> + layoutRunning = true;
> +
> + var host:UIBase = _strand as UIBase;
> +
> + var layout:IBeadLayout = _strand.getBeadByType(IBeadLayout)
> as IBeadLayout;
> + if (layout == null) {
> + var c:Class = ValuesManager.valuesImpl.getValue(host,
> "iBeadLayout");
> + if (c) {
> + layout = new c() as IBeadLayout;
> + _strand.addBead(layout);
> + }
> + }
> +
> + if (layout) {
> + layout.layout();
> + }
> +
> + layoutRunning = false;
> + }
> +
> + COMPILE::SWF
> + protected function displayBackgroundAndBorder(host:UIBase)
> : void
> + {
> + var backgroundColor:Object =
> ValuesManager.valuesImpl.getValue(host, "background-color");
> + var backgroundImage:Object =
> ValuesManager.valuesImpl.getValue(host, "background-image");
> + if (backgroundColor != null || backgroundImage !=
> null)
> + {
> + if (host.getBeadByType(IBackgroundBead)
> == null)
> + var c:Class =
> ValuesManager.valuesImpl.getValue(host, "iBackgroundBead");
> + if (c) {
> + host.addBead( new c() as IBead );
> + }
> + }
> +
> + var borderStyle:String;
> + var borderStyles:Object = ValuesManager.valuesImpl.getValue(host,
> "border");
> + if (borderStyles is Array)
> + {
> + borderStyle = borderStyles[1];
> + }
> + if (borderStyle == null)
> + {
> + borderStyle = ValuesManager.valuesImpl.getValue(host,
> "border-style") as String;
> + }
> + if (borderStyle != null && borderStyle != "none")
> + {
> + if (host.getBeadByType(IBorderBead) ==
> null) {
> + c = ValuesManager.valuesImpl.getValue(host,
> "iBorderBead");
> + if (c) {
> + host.addBead( new c() as
> IBead );
> + }
> + }
> + }
> + }
> + }
> +}
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> 79d45cba/frameworks/projects/HTML/src/main/flex/org/apache/
> flex/html/beads/layouts/BasicLayout.as
> ----------------------------------------------------------------------
> diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/
> html/beads/layouts/BasicLayout.as b/frameworks/projects/HTML/
> src/main/flex/org/apache/flex/html/beads/layouts/BasicLayout.as
> index 642b14c..3a7293e 100644
> --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/
> html/beads/layouts/BasicLayout.as
> +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/
> html/beads/layouts/BasicLayout.as
> @@ -374,73 +374,28 @@ package org.apache.flex.html.beads.layouts
> return true;
>
> }
> +
> COMPILE::JS
> {
> var i:int
> var n:int;
> - var h:Number;
> - var w:Number;
>
> var viewBead:ILayoutHost = (host as
> ILayoutParent).getLayoutHost();
> var contentView:IParentIUIBase = viewBead.contentView;
> - w = contentView.width;
> - var hasWidth:Boolean = !host.isWidthSizedToContent();
> - h = contentView.height;
> - var hasHeight:Boolean = !host.isHeightSizedToContent();
> - var maxHeight:Number = 0;
> - var maxWidth:Number = 0;
> +
> n = contentView.numElements;
> - for (i = 0; i < n; i++) {
> - var child:UIBase = contentView.getElementAt(i) as
> UIBase;
> - if (child == null ||
> !child.visible) continue;
> - child.setDisplayStyleForLayout('block');
> - var left:Number = org.apache.flex.core.
> ValuesManager.valuesImpl.getValue(child, 'left');
> - var right:Number = org.apache.flex.core.
> ValuesManager.valuesImpl.getValue(child, 'right');
> - var top:Number = org.apache.flex.core.
> ValuesManager.valuesImpl.getValue(child, 'top');
> - var bottom:Number = org.apache.flex.core.
> ValuesManager.valuesImpl.getValue(child, 'bottom');
> - var margin:String = org.apache.flex.core.
> ValuesManager.valuesImpl.getValue(child, 'margin');
> - var marginLeft:String = org.apache.flex.core.
> ValuesManager.valuesImpl.getValue(child, 'margin-left');
> - var marginRight:String = org.apache.flex.core.
> ValuesManager.valuesImpl.getValue(child, 'margin-right');
> - var horizontalCenter:Boolean =
> - (marginLeft == 'auto' && marginRight == 'auto') ||
> - (typeof(margin) === 'string' && margin == 'auto')
> ||
> - (margin && margin.hasOwnProperty('length') &&
> - ((margin.length < 4 && margin[1] == 'auto') ||
> - (margin.length == 4 && margin[1] ==
> 'auto' && margin[3] == 'auto')));
> -
> - if (!isNaN(left)) {
> - child.positioner.style.position = 'absolute';
> - child.positioner.style.left = left + 'px';
> - }
> - if (!isNaN(top)) {
> - child.positioner.style.position = 'absolute';
> - child.positioner.style.top = top + 'px';
> - }
> - if (!isNaN(right)) {
> - child.positioner.style.position = 'absolute';
> - child.positioner.style.right = right + 'px';
> - }
> - if (!isNaN(bottom)) {
> - child.positioner.style.position = 'absolute';
> - child.positioner.style.bottom = bottom + 'px';
> - }
> - if (horizontalCenter)
> - {
> - child.positioner.style.position = 'absolute';
> - child.positioner.style.left = Math.max(((w -
> child.width) / 2),0) + 'px';
> - }
> - child.dispatchEvent('sizeChanged');
> - maxWidth = Math.max(maxWidth,
> child.positioner.offsetLeft + child.positioner.offsetWidth);
> - maxHeight = Math.max(maxHeight,
> child.positioner.offsetTop + child.positioner.offsetHeight);
> - }
> - // if there are children and maxHeight is ok, use it.
> - // maxHeight can be NaN if the child hasn't been rendered
> yet.
> - if (!hasWidth && n > 0 && !isNaN(maxWidth)) {
> - contentView.width = maxWidth;
> - }
> - if (!hasHeight && n > 0 && !isNaN(maxHeight)) {
> - contentView.height = maxHeight;
> - }
> +
> + // host must have either have
> position:absolute or position:relative
> + if (host.element.style.position !=
> "absolute" && host.element.style.position != "relative") {
> + host.element.style.position =
> "relative";
> + }
> +
> + // each child must have position:absolute
> for BasicLayout to work
> + for (i=0; i < n; i++) {
> + var child:UIBase =
> contentView.getElementAt(i) as UIBase;
> + child.positioner.style.position =
> "absolute";
> + }
> +
> host.dispatchEvent( new
> Event("layoutComplete") );
> return true;
> }
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> 79d45cba/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
> ----------------------------------------------------------------------
> diff --git a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
> b/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
> index cd70a11..bfaa723 100644
> --- a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
> +++ b/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
> @@ -46,6 +46,7 @@
> <component id="ComboBox" class="org.apache.flex.html.ComboBox"/>
> <component id="ComboBoxList" class="org.apache.flex.html.
> supportClasses.ComboBoxList"/>
> <component id="Container" class="org.apache.flex.html.Container"/>
> + <component id="Group" class="org.apache.flex.html.Group"/>
> <component id="Accordion" class="org.apache.flex.html.Accordion"/>
> <component id="Form" class="org.apache.flex.html.Form"/>
> <component id="HContainer" class="org.apache.flex.html.HContainer"/>
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> 79d45cba/frameworks/projects/HTML/src/main/resources/defaults.css
> ----------------------------------------------------------------------
> diff --git a/frameworks/projects/HTML/src/main/resources/defaults.css
> b/frameworks/projects/HTML/src/main/resources/defaults.css
> index 2951025..ec54999 100644
> --- a/frameworks/projects/HTML/src/main/resources/defaults.css
> +++ b/frameworks/projects/HTML/src/main/resources/defaults.css
> @@ -273,6 +273,10 @@ Form {
>
> }
>
> +Group {
> + IBeadView: ClassReference("org.apache.flex.html.beads.GroupView");
> +}
> +
> HContainer
> {
> IBeadView: ClassReference("org.apache.
> flex.html.beads.ContainerView");
> @@ -624,6 +628,12 @@ global
> background-color: #FFFFFF;
> }
>
> + Group
> + {
> + iBackgroundBead: ClassReference("org.apache.
> flex.html.beads.SolidBackgroundBead");
> + iBorderBead: ClassReference("org.apache.flex.html.beads.
> SingleLineBorderBead");
> + }
> +
> HRule
> {
> IBeadView: ClassReference("org.apache.
> flex.html.beads.HRuleView");
>
>
--
Greetings
Piotr Zarzycki
Flex/AIR/.NET Developer
mobile: +48 880 859 557
e-mail: piotrzarzycki21@gmail.com
skype: zarzycki10
LinkedIn: http://www.linkedin.com/piotrzarzycki
<https://pl.linkedin.com/in/piotr-zarzycki-92a53552>
Re: git commit: [flex-asjs] [refs/heads/develop] - Introducing the
Group container.
Posted by Peter Ent <pe...@adobe.com>.
Will do on the my check-in.
‹peter
On 3/6/17, 2:28 PM, "Piotr Zarzycki" <pi...@gmail.com> wrote:
>Hi Peter,
>
>Nice job! Could you please add @productversion FlexJS 0.8 ? I think it can
>be useful in future.
>
>Thanks,
>Piotr
>
>2017-03-06 19:15 GMT+01:00 <pe...@apache.org>:
>
>> Repository: flex-asjs
>> Updated Branches:
>> refs/heads/develop 8fe2f0831 -> 79d45cba0
>>
>>
>> Introducing the Group container.
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/79d45cba
>> Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/79d45cba
>> Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/79d45cba
>>
>> Branch: refs/heads/develop
>> Commit: 79d45cba0616e394fddb68835859b1ffc87e6c48
>> Parents: 8fe2f08
>> Author: Peter Ent <pe...@apache.org>
>> Authored: Mon Mar 6 13:15:34 2017 -0500
>> Committer: Peter Ent <pe...@apache.org>
>> Committed: Mon Mar 6 13:15:34 2017 -0500
>>
>> ----------------------------------------------------------------------
>> .../projects/HTML/src/main/flex/HTMLClasses.as | 4 +-
>> .../main/flex/org/apache/flex/core/GroupBase.as | 301
>>+++++++++++++++++++
>> .../src/main/flex/org/apache/flex/html/Group.as | 92 ++++++
>> .../org/apache/flex/html/beads/GroupView.as | 269 +++++++++++++++++
>> .../flex/html/beads/layouts/BasicLayout.as | 73 +----
>> .../HTML/src/main/resources/basic-manifest.xml | 1 +
>> .../HTML/src/main/resources/defaults.css | 10 +
>> 7 files changed, 689 insertions(+), 61 deletions(-)
>> ----------------------------------------------------------------------
>>
>>
>> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
>> 79d45cba/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
>> ----------------------------------------------------------------------
>> diff --git a/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
>> b/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
>> index bfe204b..41cb877 100644
>> --- a/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
>> +++ b/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
>> @@ -26,8 +26,7 @@ package
>> * from the classes specified in manifest.xml.
>> */
>> internal class HTMLClasses
>> -{
>> -
>> +{
>> import org.apache.flex.html.ToolTip; ToolTip;
>> import
>>org.apache.flex.html.accessories.NumericOnlyTextInputBead;
>> NumericOnlyTextInputBead;
>> import org.apache.flex.html.beads.DispatchInputFinishedBead;
>> DispatchInputFinishedBead;
>> @@ -45,6 +44,7 @@ internal class HTMLClasses
>> }
>> import org.apache.flex.html.beads.ComboBoxView; ComboBoxView;
>> import org.apache.flex.html.beads.ContainerView; ContainerView;
>> + import org.apache.flex.html.beads.GroupView; GroupView;
>> COMPILE::SWF
>> {
>> import org.apache.flex.html.beads.ControlBarMeasurementBead;
>> ControlBarMeasurementBead;
>>
>> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
>> 79d45cba/frameworks/projects/HTML/src/main/flex/org/apache/
>> flex/core/GroupBase.as
>> ----------------------------------------------------------------------
>> diff --git
>>a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/GroupBase.a
>>s
>>
>>b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/GroupBase.a
>>s
>> new file mode 100644
>> index 0000000..7b945cc
>> --- /dev/null
>> +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/
>> core/GroupBase.as
>> @@ -0,0 +1,301 @@
>> +///////////////////////////////////////////////////////////
>> /////////////////////
>> +//
>> +// 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
>> +{
>> + import org.apache.flex.core.IMXMLDocument;
>> + import org.apache.flex.core.ValuesManager;
>> + import org.apache.flex.events.Event;
>> + import org.apache.flex.events.ValueChangeEvent;
>> + import org.apache.flex.states.State;
>> + import org.apache.flex.utils.MXMLDataInterpreter;
>> +
>> + /**
>> + * Indicates that the state change has completed. All properties
>> + * that need to change have been changed, and all transitinos
>> + * that need to run have completed. However, any deferred work
>> + * may not be completed, and the screen may not be updated until
>> + * code stops executing.
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + [Event(name="stateChangeComplete", type="org.apache.flex.events.
>> Event")]
>> +
>> + /**
>> + * Indicates that the initialization of the container is complete.
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + [Event(name="initComplete", type="org.apache.flex.events.Event")]
>> +
>> + /**
>> + * Indicates that the children of the container is have been
>>added.
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + [Event(name="childrenAdded", type="org.apache.flex.events.Event")]
>> +
>> + /**
>> + * The default property uses when additional MXML content
>>appears
>> within an element's
>> + * definition in an MXML file.
>> + */
>> + [DefaultProperty("mxmlContent")]
>> +
>> + /**
>> + * The GroupBase class is the base class for most simple
>>containers
>> + * in FlexJS. It is usable as the root tag of MXML
>> + * documents and UI controls and containers are added to it.
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + public class GroupBase extends UIBase implements IMXMLDocument,
>> IStatesObject, IContainer
>> + {
>> + /**
>> + * Constructor.
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + public function GroupBase()
>> + {
>> + super();
>> + }
>> +
>> + /**
>> + * @flexjsignorecoercion org.apache.flex.core.
>> WrappedHTMLElement
>> + */
>> + COMPILE::JS
>> + override protected function createElement():
>> WrappedHTMLElement
>> + {
>> + element = document.createElement('div') as
>> WrappedHTMLElement;
>> + element.flexjs_wrapper = this;
>> +
>> + positioner = element;
>> +
>> + return element;
>> + }
>> +
>> + /**
>> + * @private
>> + */
>> + public function childrenAdded():void
>> + {
>> + dispatchEvent(new Event("childrenAdded"));
>> + }
>> +
>> + override public function addedToParent():void
>> + {
>> + if (!_initialized)
>> + {
>> + // each MXML file can also have styles
>>in
>> fx:Style block
>> + ValuesManager.valuesImpl.init(this);
>> + }
>> +
>> + super.addedToParent();
>> +
>> + if (!_initialized)
>> + {
>> + MXMLDataInterpreter.
>> generateMXMLInstances(_mxmlDocument, this, MXMLDescriptor);
>> +
>> + dispatchEvent(new
>>Event("initBindings"));
>> + dispatchEvent(new
>>Event("initComplete"));
>> + _initialized = true;
>> + }
>> + }
>> +
>> + private var _mxmlDescriptor:Array;
>> + private var _mxmlDocument:Object = this;
>> + private var _initialized:Boolean;
>> +
>> + /**
>> + * @copy org.apache.flex.core.Application#MXMLDescriptor
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + public function get MXMLDescriptor():Array
>> + {
>> + return _mxmlDescriptor;
>> + }
>> +
>> + /**
>> + * @private
>> + */
>> + public function setMXMLDescriptor(document:Object,
>> value:Array):void
>> + {
>> + _mxmlDocument = document;
>> + _mxmlDescriptor = value;
>> + }
>> +
>> + /**
>> + * @copy org.apache.flex.core.Application#
>> generateMXMLAttributes()
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + public function generateMXMLAttributes(data:Array):void
>> + {
>> + MXMLDataInterpreter.generateMXMLProperties(this, data);
>> + }
>> +
>> + /**
>> + * @copy org.apache.flex.core.ItemRendererClassFactory#
>> mxmlContent
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + public var mxmlContent:Array;
>> +
>> + private var _states:Array;
>> +
>> + /**
>> + * The array of view states. These should
>> + * be instances of org.apache.flex.states.State.
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + public function get states():Array
>> + {
>> + return _states;
>> + }
>> +
>> + /**
>> + * @private
>> + * @flexjsignorecoercion Class
>> + * @flexjsignorecoercion org.apache.flex.core.IBead
>> + */
>> + public function set states(value:Array):void
>> + {
>> + _states = value;
>> + _currentState = _states[0].name;
>> +
>> + try{
>> + if (getBeadByType(IStatesImpl) == null)
>> + {
>> + var c:Class =
>>ValuesManager.valuesImpl.getValue(this,
>> "iStatesImpl") as Class;
>> + var b:Object = new c();
>> + addBead(b as IBead);
>> + }
>> + }
>> + //TODO: Need to handle this case more
>>gracefully
>> + catch(e:Error)
>> + {
>> + COMPILE::SWF
>> + {
>> + trace(e.message);
>> + }
>> + }
>> +
>> + }
>> +
>> + /**
>> + * <code>true</code> if the array of states
>> + * contains a state with this name.
>> + *
>> + * @param state The state namem.
>> + * @return True if state in state array
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + public function hasState(state:String):Boolean
>> + {
>> + for each (var s:State in _states)
>> + {
>> + if (s.name == state)
>> + return true;
>> + }
>> + return false;
>> + }
>> +
>> + private var _currentState:String;
>> +
>> + [Bindable("currentStateChange")]
>> + /**
>> + * The name of the current state.
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + public function get currentState():String
>> + {
>> + return _currentState;
>> + }
>> +
>> + /**
>> + * @private
>> + */
>> + public function set currentState(value:String):void
>> + {
>> + var event:ValueChangeEvent = new
>>ValueChangeEvent("currentStateChange",
>> false, false, _currentState, value)
>> + _currentState = value;
>> + dispatchEvent(event);
>> + }
>> +
>> + private var _transitions:Array;
>> +
>> + /**
>> + * The array of transitions.
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + public function get transitions():Array
>> + {
>> + return _transitions;
>> + }
>> +
>> + /**
>> + * @private
>> + */
>> + public function set transitions(value:Array):void
>> + {
>> + _transitions = value;
>> + }
>> +
>> + }
>> +}
>>
>> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
>> 79d45cba/frameworks/projects/HTML/src/main/flex/org/apache/
>> flex/html/Group.as
>> ----------------------------------------------------------------------
>> diff --git
>>a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Group.as
>> b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Group.as
>> new file mode 100644
>> index 0000000..a881d10
>> --- /dev/null
>> +++
>>b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Group.as
>> @@ -0,0 +1,92 @@
>> +///////////////////////////////////////////////////////////
>> /////////////////////
>> +//
>> +// 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
>> +{
>> + import org.apache.flex.core.GroupBase;
>> + import org.apache.flex.core.IContainer;
>> + import org.apache.flex.core.ILayoutHost;
>> + import org.apache.flex.core.ILayoutParent;
>> + import org.apache.flex.core.IMXMLDocument;
>> + import org.apache.flex.core.IStrand;
>> + import org.apache.flex.core.IBead;
>> + import org.apache.flex.core.IBeadLayout;
>> + import org.apache.flex.core.IParentIUIBase;
>> + 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.utils.MXMLDataInterpreter;
>> +
>> + /**
>> + * Indicates that the children of the container is have been
>> added.
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + [Event(name="childrenAdded",
>>type="org.apache.flex.events.Event")]
>> +
>> + /**
>> + * Default property
>> + */
>> + [DefaultProperty("mxmlContent")]
>> +
>> + /**
>> + * The Group class provides a light-weight container for visual
>> elements. By default
>> + * the Group does not have a layout, allowing its children to
>>be
>> sized and positioned
>> + * using styles or CSS.
>> + *
>> + * @toplevel
>> + * @see org.apache.flex.html.beads.layout
>> + * @see org.apache.flex.html.supportClasses.ScrollingViewport
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + public class Group extends GroupBase implements ILayoutParent,
>> IParentIUIBase
>> + {
>> + /**
>> + * Constructor.
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + public function Group()
>> + {
>> + super();
>> + }
>> +
>> + /**
>> + * Returns the ILayoutHost which is its view. From
>> ILayoutParent.
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + public function getLayoutHost():ILayoutHost
>> + {
>> + return view as ILayoutHost;
>> + }
>> + }
>> +}
>>
>> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
>> 79d45cba/frameworks/projects/HTML/src/main/flex/org/apache/
>> flex/html/beads/GroupView.as
>> ----------------------------------------------------------------------
>> diff --git
>>a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/Group
>>View.as
>> b/frameworks/projects/HTML/src/main/flex/org/apache/flex/
>> html/beads/GroupView.as
>> new file mode 100644
>> index 0000000..c63e013
>> --- /dev/null
>> +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/
>> html/beads/GroupView.as
>> @@ -0,0 +1,269 @@
>> +///////////////////////////////////////////////////////////
>> /////////////////////
>> +//
>> +// 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
>> +{
>> + import org.apache.flex.core.IBead;
>> + import org.apache.flex.core.IBeadLayout;
>> + import org.apache.flex.core.IBeadView;
>> + import org.apache.flex.core.ILayoutChild;
>> + import org.apache.flex.core.ILayoutHost;
>> + import org.apache.flex.core.IParentIUIBase;
>> + import org.apache.flex.core.IStrand;
>> + import org.apache.flex.core.IUIBase;
>> + import org.apache.flex.core.BeadViewBase;
>> + import org.apache.flex.core.UIBase;
>> + import org.apache.flex.core.ValuesManager;
>> + import org.apache.flex.events.Event;
>> +
>> + /**
>> + * The GroupView is a bead that manages the layout bead (if
>>any)
>> attached to a Group. This class
>> + * also provides support for background and border styles for a
>> Group on the SWF platform.
>> + *
>> + * @viewbead
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + public class GroupView extends BeadViewBase implements
>>IBeadView,
>> ILayoutHost
>> + {
>> + /**
>> + * The GroupView class is the default view for
>> + * the org.apache.flex.html.Group class.
>> + * It lets you use some CSS styles to manage the border,
>> background
>> + * and padding around the content area.
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + public function GroupView()
>> + {
>> + super();
>> +
>> + layoutRunning = false;
>> + }
>> +
>> + /**
>> + * The sub-element used as the parent of the container's
>> elements. This does not
>> + * include the chrome elements.
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + public function get contentView():IParentIUIBase
>> + {
>> + return host as IParentIUIBase;
>> + }
>> +
>> + /**
>> + * The view that can be resized.
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + public function get resizableView():IUIBase
>> + {
>> + return host;
>> + }
>> +
>> +
>> + private var layoutRunning:Boolean;
>> +
>> + /**
>> + * Strand setter.
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + override public function set strand(value:IStrand):void
>> + {
>> + _strand = value;
>> + super.strand = value;
>> +
>> + COMPILE::SWF {
>> + displayBackgroundAndBorder(host as
>> UIBase);
>> + }
>> +
>> + // listen for initComplete to signal that the
>> strand is set with its size
>> + // and beads.
>> + host.addEventListener("beadsAdded",
>> beadsAddedHandler);
>> + }
>> +
>> + /**
>> + * Handles the initComplete event by completing the
>>setup
>> and kicking off the
>> + * presentation of the Container.
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + protected function beadsAddedHandler(event:Event):void
>> + {
>> + var ilc:ILayoutChild = host as ILayoutChild;
>> + // Complete the setup if the height is sized to
>> content or has been explicitly set
>> + // and the width is sized to content or has been explicitly
>> set
>> + if ((ilc.isHeightSizedToContent() ||
>> !isNaN(ilc.explicitHeight)) &&
>> + (ilc.isWidthSizedToContent() ||
>> !isNaN(ilc.explicitWidth))) {
>> + completeSetup();
>> +
>> + var num:Number =
>>contentView.numElements;
>> + if (num > 0) performLayout(event);
>> + }
>> + else {
>> + // otherwise, wait until the unknown
>>sizes
>> have been set and then finish
>> + host.addEventListener("sizeChanged",
>> deferredSizeHandler);
>> + host.addEventListener("widthChanged",
>> deferredSizeHandler);
>> + host.addEventListener("heightChanged",
>> deferredSizeHandler);
>> + }
>> + }
>> +
>> + /**
>> + * Handles the case where the size of the host is not
>> immediately known, usually do
>> + * to one of its dimensions being indicated as a percent
>> size.
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + private function deferredSizeHandler(event:Event):void
>> + {
>> + host.removeEventListener("sizeChanged",
>>deferredSizeHandler);
>> + host.removeEventListener("widthChanged",
>> deferredSizeHandler);
>> + host.removeEventListener("heightChanged",
>> deferredSizeHandler);
>> + completeSetup();
>> +
>> + var num:Number = contentView.numElements;
>> + if (num > 0)
>> + {
>> + performLayout(event);
>> + }
>> + }
>> +
>> + /**
>> + * Called when the host is ready to complete its setup
>> (usually after its size has been
>> + * determined).
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + protected function completeSetup():void
>> + {
>> + // set up listeners for when children are added
>>or
>> there is a specific request
>> + // to perform the layout again.
>> + host.addEventListener("childrenAdded",
>> performLayout);
>> + host.addEventListener("layoutNeeded",
>> performLayout);
>> + host.addEventListener("viewCreated",
>> viewCreatedHandler);
>> + }
>> +
>> + /**
>> + * Handles the viewCreated event by performing the first
>> layout if
>> + * there are children already present (ie, from MXML).
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + protected function viewCreatedHandler(event:Event):void
>> + {
>> + if ((host as UIBase).numElements > 0) {
>> + performLayout(null);
>> + }
>> + }
>> +
>> + /**
>> + * Executes the layout associated with this container.
>> Once the layout has been
>> + * run, it may affect the size of the host or may cause
>> the host to present scroll
>> + * bars view its viewport.
>> + *
>> + * @langversion 3.0
>> + * @playerversion Flash 10.2
>> + * @playerversion AIR 2.6
>> + * @productversion FlexJS 0.0
>> + */
>> + protected function performLayout(event:Event):void
>> + {
>> + layoutRunning = true;
>> +
>> + var host:UIBase = _strand as UIBase;
>> +
>> + var layout:IBeadLayout =
>>_strand.getBeadByType(IBeadLayout)
>> as IBeadLayout;
>> + if (layout == null) {
>> + var c:Class =
>>ValuesManager.valuesImpl.getValue(host,
>> "iBeadLayout");
>> + if (c) {
>> + layout = new c() as IBeadLayout;
>> + _strand.addBead(layout);
>> + }
>> + }
>> +
>> + if (layout) {
>> + layout.layout();
>> + }
>> +
>> + layoutRunning = false;
>> + }
>> +
>> + COMPILE::SWF
>> + protected function
>>displayBackgroundAndBorder(host:UIBase)
>> : void
>> + {
>> + var backgroundColor:Object =
>> ValuesManager.valuesImpl.getValue(host, "background-color");
>> + var backgroundImage:Object =
>> ValuesManager.valuesImpl.getValue(host, "background-image");
>> + if (backgroundColor != null || backgroundImage
>>!=
>> null)
>> + {
>> + if (host.getBeadByType(IBackgroundBead)
>> == null)
>> + var c:Class =
>> ValuesManager.valuesImpl.getValue(host, "iBackgroundBead");
>> + if (c) {
>> + host.addBead( new c() as IBead
>>);
>> + }
>> + }
>> +
>> + var borderStyle:String;
>> + var borderStyles:Object =
>>ValuesManager.valuesImpl.getValue(host,
>> "border");
>> + if (borderStyles is Array)
>> + {
>> + borderStyle = borderStyles[1];
>> + }
>> + if (borderStyle == null)
>> + {
>> + borderStyle =
>>ValuesManager.valuesImpl.getValue(host,
>> "border-style") as String;
>> + }
>> + if (borderStyle != null && borderStyle !=
>>"none")
>> + {
>> + if (host.getBeadByType(IBorderBead) ==
>> null) {
>> + c =
>>ValuesManager.valuesImpl.getValue(host,
>> "iBorderBead");
>> + if (c) {
>> + host.addBead( new c() as
>> IBead );
>> + }
>> + }
>> + }
>> + }
>> + }
>> +}
>>
>> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
>> 79d45cba/frameworks/projects/HTML/src/main/flex/org/apache/
>> flex/html/beads/layouts/BasicLayout.as
>> ----------------------------------------------------------------------
>> diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/
>> html/beads/layouts/BasicLayout.as b/frameworks/projects/HTML/
>> src/main/flex/org/apache/flex/html/beads/layouts/BasicLayout.as
>> index 642b14c..3a7293e 100644
>> --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/
>> html/beads/layouts/BasicLayout.as
>> +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/
>> html/beads/layouts/BasicLayout.as
>> @@ -374,73 +374,28 @@ package org.apache.flex.html.beads.layouts
>> return true;
>>
>> }
>> +
>> COMPILE::JS
>> {
>> var i:int
>> var n:int;
>> - var h:Number;
>> - var w:Number;
>>
>> var viewBead:ILayoutHost = (host as
>> ILayoutParent).getLayoutHost();
>> var contentView:IParentIUIBase = viewBead.contentView;
>> - w = contentView.width;
>> - var hasWidth:Boolean = !host.isWidthSizedToContent();
>> - h = contentView.height;
>> - var hasHeight:Boolean = !host.isHeightSizedToContent();
>> - var maxHeight:Number = 0;
>> - var maxWidth:Number = 0;
>> +
>> n = contentView.numElements;
>> - for (i = 0; i < n; i++) {
>> - var child:UIBase = contentView.getElementAt(i) as
>> UIBase;
>> - if (child == null ||
>> !child.visible) continue;
>> - child.setDisplayStyleForLayout('block');
>> - var left:Number = org.apache.flex.core.
>> ValuesManager.valuesImpl.getValue(child, 'left');
>> - var right:Number = org.apache.flex.core.
>> ValuesManager.valuesImpl.getValue(child, 'right');
>> - var top:Number = org.apache.flex.core.
>> ValuesManager.valuesImpl.getValue(child, 'top');
>> - var bottom:Number = org.apache.flex.core.
>> ValuesManager.valuesImpl.getValue(child, 'bottom');
>> - var margin:String = org.apache.flex.core.
>> ValuesManager.valuesImpl.getValue(child, 'margin');
>> - var marginLeft:String = org.apache.flex.core.
>> ValuesManager.valuesImpl.getValue(child, 'margin-left');
>> - var marginRight:String = org.apache.flex.core.
>> ValuesManager.valuesImpl.getValue(child, 'margin-right');
>> - var horizontalCenter:Boolean =
>> - (marginLeft == 'auto' && marginRight ==
>>'auto') ||
>> - (typeof(margin) === 'string' && margin ==
>>'auto')
>> ||
>> - (margin && margin.hasOwnProperty('length') &&
>> - ((margin.length < 4 && margin[1] ==
>>'auto') ||
>> - (margin.length == 4 && margin[1] ==
>> 'auto' && margin[3] == 'auto')));
>> -
>> - if (!isNaN(left)) {
>> - child.positioner.style.position = 'absolute';
>> - child.positioner.style.left = left + 'px';
>> - }
>> - if (!isNaN(top)) {
>> - child.positioner.style.position = 'absolute';
>> - child.positioner.style.top = top + 'px';
>> - }
>> - if (!isNaN(right)) {
>> - child.positioner.style.position = 'absolute';
>> - child.positioner.style.right = right + 'px';
>> - }
>> - if (!isNaN(bottom)) {
>> - child.positioner.style.position = 'absolute';
>> - child.positioner.style.bottom = bottom + 'px';
>> - }
>> - if (horizontalCenter)
>> - {
>> - child.positioner.style.position = 'absolute';
>> - child.positioner.style.left = Math.max(((w -
>> child.width) / 2),0) + 'px';
>> - }
>> - child.dispatchEvent('sizeChanged');
>> - maxWidth = Math.max(maxWidth,
>> child.positioner.offsetLeft + child.positioner.offsetWidth);
>> - maxHeight = Math.max(maxHeight,
>> child.positioner.offsetTop + child.positioner.offsetHeight);
>> - }
>> - // if there are children and maxHeight is ok, use it.
>> - // maxHeight can be NaN if the child hasn't been
>>rendered
>> yet.
>> - if (!hasWidth && n > 0 && !isNaN(maxWidth)) {
>> - contentView.width = maxWidth;
>> - }
>> - if (!hasHeight && n > 0 && !isNaN(maxHeight)) {
>> - contentView.height = maxHeight;
>> - }
>> +
>> + // host must have either have
>> position:absolute or position:relative
>> + if (host.element.style.position !=
>> "absolute" && host.element.style.position != "relative") {
>> + host.element.style.position =
>> "relative";
>> + }
>> +
>> + // each child must have
>>position:absolute
>> for BasicLayout to work
>> + for (i=0; i < n; i++) {
>> + var child:UIBase =
>> contentView.getElementAt(i) as UIBase;
>> + child.positioner.style.position
>>=
>> "absolute";
>> + }
>> +
>> host.dispatchEvent( new
>> Event("layoutComplete") );
>> return true;
>> }
>>
>> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
>> 79d45cba/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
>> ----------------------------------------------------------------------
>> diff --git
>>a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
>> b/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
>> index cd70a11..bfaa723 100644
>> --- a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
>> +++ b/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
>> @@ -46,6 +46,7 @@
>> <component id="ComboBox" class="org.apache.flex.html.ComboBox"/>
>> <component id="ComboBoxList" class="org.apache.flex.html.
>> supportClasses.ComboBoxList"/>
>> <component id="Container" class="org.apache.flex.html.Container"/>
>> + <component id="Group" class="org.apache.flex.html.Group"/>
>> <component id="Accordion" class="org.apache.flex.html.Accordion"/>
>> <component id="Form" class="org.apache.flex.html.Form"/>
>> <component id="HContainer"
>>class="org.apache.flex.html.HContainer"/>
>>
>> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
>> 79d45cba/frameworks/projects/HTML/src/main/resources/defaults.css
>> ----------------------------------------------------------------------
>> diff --git a/frameworks/projects/HTML/src/main/resources/defaults.css
>> b/frameworks/projects/HTML/src/main/resources/defaults.css
>> index 2951025..ec54999 100644
>> --- a/frameworks/projects/HTML/src/main/resources/defaults.css
>> +++ b/frameworks/projects/HTML/src/main/resources/defaults.css
>> @@ -273,6 +273,10 @@ Form {
>>
>> }
>>
>> +Group {
>> + IBeadView:
>>ClassReference("org.apache.flex.html.beads.GroupView");
>> +}
>> +
>> HContainer
>> {
>> IBeadView: ClassReference("org.apache.
>> flex.html.beads.ContainerView");
>> @@ -624,6 +628,12 @@ global
>> background-color: #FFFFFF;
>> }
>>
>> + Group
>> + {
>> + iBackgroundBead: ClassReference("org.apache.
>> flex.html.beads.SolidBackgroundBead");
>> + iBorderBead: ClassReference("org.apache.flex.html.beads.
>> SingleLineBorderBead");
>> + }
>> +
>> HRule
>> {
>> IBeadView: ClassReference("org.apache.
>> flex.html.beads.HRuleView");
>>
>>
>
>
>--
>
>Greetings
>Piotr Zarzycki
>
>Flex/AIR/.NET Developer
>
>mobile: +48 880 859 557
>e-mail: piotrzarzycki21@gmail.com
>skype: zarzycki10
>
>LinkedIn: http://www.linkedin.com/piotrzarzycki
><https://pl.linkedin.com/in/piotr-zarzycki-92a53552>