flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harbs <harbs.li...@gmail.com>
Subject Re: [1/2] flex-asjs git commit: A temp way to get Application reference. Don’t like this solution and at minimum we should have a FlexGlobals.topLevelApplication or something like that
Date Thu, 19 Jan 2017 15:30:25 GMT
In my initialize handler I have:
ApplicationFacade.app = this;

The static object type in ApplicationFacade in my main class, so any public properties and
methods are available to anything using ApplicationFacade. I’m pretty sure this only works
well if you use the remove-circular option though.

> On Jan 19, 2017, at 1:03 PM, Carlos Rovira <carlos.rovira@codeoscopic.com> wrote:
> 
> Hi Harbs,
> could you share how you do it? maybe we could learn from your example to
> implement in MDL
> 
> thanks!
> 
> 2017-01-19 10:50 GMT+01:00 Harbs <harbs.lists@gmail.com>:
> 
>> FWIW, we’re using PureMVC and we’re keeping a reference to the app in the
>> ApplicationFacade. It’s a pretty good way to work.
>> 
>> I’m not sure we need the reference in the framework. A simple Singleton
>> defined in the app works fine.
>> 
>>> On Jan 19, 2017, at 2:34 AM, carlosrovira@apache.org wrote:
>>> 
>>> Repository: flex-asjs
>>> Updated Branches:
>>> refs/heads/develop 0d44db998 -> 64529815a
>>> 
>>> 
>>> A temp way to get Application reference. Don’t like this solution and at
>> minimum we should have a FlexGlobals.topLevelApplication or something
>> like that
>>> 
>>> 
>>> Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
>>> Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/2825f6c8
>>> Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/2825f6c8
>>> Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/2825f6c8
>>> 
>>> Branch: refs/heads/develop
>>> Commit: 2825f6c88135b36ce388c55d5c459c6764af9f65
>>> Parents: 462712d
>>> Author: Carlos Rovira <carlosrovira@apache.org>
>>> Authored: Thu Jan 19 01:33:25 2017 +0100
>>> Committer: Carlos Rovira <carlosrovira@apache.org>
>>> Committed: Thu Jan 19 01:33:54 2017 +0100
>>> 
>>> ----------------------------------------------------------------------
>>> .../flexjs/MDLExample/src/main/flex/App.mxml    | 14 +++---
>>> .../flex/org/apache/flex/mdl/Application.as     | 52
>> ++++++++++++++++++++
>>> .../src/main/resources/mdl-manifest.xml         |  1 +
>>> 3 files changed, 60 insertions(+), 7 deletions(-)
>>> ----------------------------------------------------------------------
>>> 
>>> 
>>> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
>> 2825f6c8/examples/flexjs/MDLExample/src/main/flex/App.mxml
>>> ----------------------------------------------------------------------
>>> diff --git a/examples/flexjs/MDLExample/src/main/flex/App.mxml
>> b/examples/flexjs/MDLExample/src/main/flex/App.mxml
>>> index 9347a9d..4a03e8b 100644
>>> --- a/examples/flexjs/MDLExample/src/main/flex/App.mxml
>>> +++ b/examples/flexjs/MDLExample/src/main/flex/App.mxml
>>> @@ -17,13 +17,13 @@ See the License for the specific language governing
>> permissions and
>>> limitations under the License.
>>> 
>>> -->
>>> -<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>>> -                xmlns:js="library://ns.apache.org/flexjs/basic"
>>> -                xmlns:local="*"
>>> -                xmlns="http://www.w3.org/1999/xhtml">
>>> -
>>> -     <fx:Style source="../../main/resources/mdl-styles.css"/>
>>> +<mdl:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>>> +                 xmlns:js="library://ns.apache.org/flexjs/basic"
>>> +                 xmlns:mdl="library://ns.apache.org/flexjs/mdl"
>>> +                 xmlns:local="*">
>>> 
>>> +    <fx:Style source="../../main/resources/mdl-styles.css"/>
>>> +
>>>    <js:valuesImpl>
>>>        <js:SimpleCSSValuesImpl />
>>>    </js:valuesImpl>
>>> @@ -31,4 +31,4 @@ limitations under the License.
>>>    <js:initialView>
>>>        <local:MainNavigation/>
>>>    </js:initialView>
>>> -</js:Application>
>>> +</mdl:Application>
>>> 
>>> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
>> 2825f6c8/frameworks/projects/MaterialDesignLite/src/main/
>> flex/org/apache/flex/mdl/Application.as
>>> ----------------------------------------------------------------------
>>> diff --git a/frameworks/projects/MaterialDesignLite/src/main/
>> flex/org/apache/flex/mdl/Application.as b/frameworks/projects/
>> MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Application.as
>>> new file mode 100644
>>> index 0000000..adf1962
>>> --- /dev/null
>>> +++ b/frameworks/projects/MaterialDesignLite/src/main/
>> flex/org/apache/flex/mdl/Application.as
>>> @@ -0,0 +1,52 @@
>>> +///////////////////////////////////////////////////////////
>> /////////////////////
>>> +//
>>> +//  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.mdl
>>> +{
>>> +    import org.apache.flex.core.Application;
>>> +    import org.apache.flex.core.SimpleCSSValuesImpl;
>>> +     import org.apache.flex.core.IChild;
>>> +     //import org.apache.flex.core.IUIBase;
>>> +
>>> +     /**
>>> +      * This class extends the standard Application and sets up the
>>> +      * SimpleCSSValuesImpl (implementation) for convenience.
>>> +      */
>>> +     public class Application extends org.apache.flex.core.Application
>>> +     {
>>> +             public function Application()
>>> +             {
>>> +                     super();
>>> +
>>> +                     this.valuesImpl = new SimpleCSSValuesImpl();
>>> +
>>> +                     // this a is temp solution until we get a better
>> way to get a reference to Application
>>> +                     topLevelApplication = this;
>>> +             }
>>> +
>>> +             /**
>>> +         *  static reference to this application
>>> +              *
>>> +         *  @langversion 3.0
>>> +         *  @playerversion Flash 10.2
>>> +         *  @playerversion AIR 2.6
>>> +         *  @productversion FlexJS 0.0
>>> +         */
>>> +        public static var topLevelApplication:Object;
>>> +     }
>>> +}
>>> 
>>> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
>> 2825f6c8/frameworks/projects/MaterialDesignLite/src/main/
>> resources/mdl-manifest.xml
>>> ----------------------------------------------------------------------
>>> diff --git a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml
>> b/frameworks/projects/MaterialDesignLite/src/main/
>> resources/mdl-manifest.xml
>>> index 0bce7e5..580fde9 100644
>>> --- a/frameworks/projects/MaterialDesignLite/src/main/
>> resources/mdl-manifest.xml
>>> +++ b/frameworks/projects/MaterialDesignLite/src/main/
>> resources/mdl-manifest.xml
>>> @@ -21,6 +21,7 @@
>>> 
>>> <componentPackage>
>>> 
>>> +    <component id="Application" class="org.apache.flex.mdl.
>> Application"/>
>>>    <component id="Button" class="org.apache.flex.mdl.Button"/>
>>>    <component id="IconToggle" class="org.apache.flex.mdl.IconToggle"/>
>>>    <component id="TextField" class="org.apache.flex.mdl.TextField"/>
>>> 
>> 
>> 
> 
> 
> -- 
> 
> Carlos Rovira
> Director General
> M: +34 607 22 60 05
> http://www.codeoscopic.com
> http://www.avant2.es
> 
> Este mensaje se dirige exclusivamente a su destinatario y puede contener
> información privilegiada o confidencial. Si ha recibido este mensaje por
> error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
> proceda a su destrucción.
> 
> De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
> que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
> S.A. La finalidad de dicho tratamiento es facilitar la prestación del
> servicio o información solicitados, teniendo usted derecho de acceso,
> rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
> oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
> necesaria.


Mime
View raw message