Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 9ACE4200BD4 for ; Thu, 1 Dec 2016 15:33:45 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 99803160B0F; Thu, 1 Dec 2016 14:33:45 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3E692160B0B for ; Thu, 1 Dec 2016 15:33:44 +0100 (CET) Received: (qmail 86840 invoked by uid 500); 1 Dec 2016 14:33:43 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 86832 invoked by uid 99); 1 Dec 2016 14:33:43 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Dec 2016 14:33:43 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5966DDFC47; Thu, 1 Dec 2016 14:33:43 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: yishayw@apache.org To: commits@flex.apache.org Message-Id: <054e2781a8544a0093873eb0e7bb871c@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: [flex-asjs] [refs/heads/develop] - Export common bead loading logic to a utils class. Date: Thu, 1 Dec 2016 14:33:43 +0000 (UTC) archived-at: Thu, 01 Dec 2016 14:33:45 -0000 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 Authored: Thu Dec 1 16:33:28 2016 +0200 Committer: yishayw 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; }