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 2016/12/01 14:42:59 UTC
Re: git commit: [flex-asjs] [refs/heads/develop] - Export common bead
loading logic to a utils class.
Thanks Yishay. I was thinking more and more about that and I was going to
write today that I will go to you suggestion with Util in my case with MDL
Chip component. I will use it with pleasure.:)
Piotr
2016-12-01 15:33 GMT+01:00 <yi...@apache.org>:
> Repository: flex-asjs
> Updated Branches:
> refs/heads/develop 5863a8c83 -> e5020da9e
>
>
> Export common bead loading logic to a utils class.
>
>
> Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
> Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/e5020da9
> Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/e5020da9
> Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/e5020da9
>
> Branch: refs/heads/develop
> Commit: e5020da9e01c07519415668acc465db78ee6b643
> Parents: 5863a8c
> Author: yishayw <yi...@hotmail.com>
> Authored: Thu Dec 1 16:33:28 2016 +0200
> Committer: yishayw <yi...@hotmail.com>
> Committed: Thu Dec 1 16:33:28 2016 +0200
>
> ----------------------------------------------------------------------
> .../projects/Core/src/main/flex/CoreClasses.as | 1 +
> .../flex/org/apache/flex/utils/StrandUtils.as | 70 ++++++++++++++++++++
> .../flex/html/beads/AccordionCollapseBead.as | 14 +---
> 3 files changed, 73 insertions(+), 12 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> e5020da9/frameworks/projects/Core/src/main/flex/CoreClasses.as
> ----------------------------------------------------------------------
> diff --git a/frameworks/projects/Core/src/main/flex/CoreClasses.as
> b/frameworks/projects/Core/src/main/flex/CoreClasses.as
> index d8c65ef..c4b0752 100644
> --- a/frameworks/projects/Core/src/main/flex/CoreClasses.as
> +++ b/frameworks/projects/Core/src/main/flex/CoreClasses.as
> @@ -130,6 +130,7 @@ internal class CoreClasses
> import org.apache.flex.utils.CSSBorderUtils; CSSBorderUtils;
> }
> import org.apache.flex.utils.ColorUtil; ColorUtil;
> + import org.apache.flex.utils.StrandUtils; StrandUtils;
> import org.apache.flex.utils.CSSContainerUtils; CSSContainerUtils;
> import org.apache.flex.utils.DisplayUtils; DisplayUtils;
> COMPILE::SWF
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> e5020da9/frameworks/projects/Core/src/main/flex/org/apache/
> flex/utils/StrandUtils.as
> ----------------------------------------------------------------------
> diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/StrandUtils.as
> b/frameworks/projects/Core/src/main/flex/org/apache/flex/
> utils/StrandUtils.as
> new file mode 100644
> index 0000000..cb6f134
> --- /dev/null
> +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/
> utils/StrandUtils.as
> @@ -0,0 +1,70 @@
> +///////////////////////////////////////////////////////////
> /////////////////////
> +//
> +// 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.utils
> +{
> + import org.apache.flex.core.IBead;
> + import org.apache.flex.core.IBeadModel;
> + import org.apache.flex.core.IStrand;
> + import org.apache.flex.core.ValuesManager;
> +
> + /**
> + * The StrandUtils class is an all-static class
> + * with methods for working with strands and beads.
> + *
> + * @langversion 3.0
> + * @playerversion Flash 10.2
> + * @playerversion AIR 2.6
> + * @productversion FlexJS 0.0
> + */
> + public class StrandUtils
> + {
> +
> + //----------------------------
> ----------------------------------------------
> + //
> + // Class methods
> + //
> + //----------------------------
> ----------------------------------------------
> +
> + /**
> + * @return Loaded Bead.
> + *
> + * @langversion 3.0
> + * @playerversion Flash 9
> + * @playerversion AIR 1.1
> + * @productversion Flex 3
> + */
> + public static function loadBead(classOrInterface:Class,
> classOrInterfaceName:String, strand:IStrand):IBead
> + {
> + var result:IBead = strand.getBeadByType(
> classOrInterface);
> + if (result == null)
> + {
> + var c:Class = ValuesManager.valuesImpl.getValue(strand,
> classOrInterfaceName) as Class;
> + if (c)
> + {
> + result = new c as IBeadModel;
> + if (result)
> + strand.addBead(result);
> + }
> + }
> + return result;
> + }
> + }
> +
> +}
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> e5020da9/frameworks/projects/HTML/src/main/flex/org/apache/
> flex/html/beads/AccordionCollapseBead.as
> ----------------------------------------------------------------------
> diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/
> html/beads/AccordionCollapseBead.as b/frameworks/projects/HTML/
> src/main/flex/org/apache/flex/html/beads/AccordionCollapseBead.as
> index 75782c6..edc41e0 100644
> --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/
> AccordionCollapseBead.as
> +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/
> AccordionCollapseBead.as
> @@ -21,11 +21,11 @@ package org.apache.flex.html.beads
> import org.apache.flex.core.IItemRendererParent;
> import org.apache.flex.core.IStrand;
> import org.apache.flex.core.UIBase;
> - import org.apache.flex.core.ValuesManager;
> import org.apache.flex.events.Event;
> import org.apache.flex.html.Accordion;
> import org.apache.flex.html.beads.layouts.IOneFlexibleChildLayout;
> import org.apache.flex.html.supportClasses.ICollapsible;
> + import org.apache.flex.utils.StrandUtils;
>
> public class AccordionCollapseBead implements
> IAccordionCollapseBead
> {
> @@ -82,17 +82,7 @@ package org.apache.flex.html.beads
> {
> if (!_layout)
> {
> - _layout = _strand.getBeadByType(IOneFlexibleChildLayout)
> as IOneFlexibleChildLayout;
> - if (!_layout) {
> - var c:Class =
> ValuesManager.valuesImpl.getValue(host, "iBeadLayout");
> - if (c) {
> - _layout = new c() as
> IOneFlexibleChildLayout;
> - }
> - }
> - if (_layout)
> - {
> - _strand.addBead(_layout);
> - }
> + _layout = StrandUtils.loadBead(IOneFlexibleChildLayout,
> "iBeadLayout", _strand) as IOneFlexibleChildLayout;
> }
> return _layout;
> }
>
>
--
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>