You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by yishayw <yi...@hotmail.com> on 2016/10/30 11:23:06 UTC

[FlexJS] Extending SimpleCSSValuesImpl

Is there a reason why SimpleCSSValuesImpl.perInstanceStyles is static? It
makes extending SimpleCSSValuesImpl difficult. Since there's typically just
one such instance per app is there any harm in making it a dynamic property.
That will allow derived classes to simply push new values upon construction,
and make adding a new style property to an app easier. 



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/FlexJS-Extending-SimpleCSSValuesImpl-tp56105.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: [FlexJS] Extending SimpleCSSValuesImpl

Posted by Alex Harui <ah...@adobe.com>.
Well, there can be other IValuesImpl other than SimpleCSSValuesImpl and
those other implementations may not have a perInstanceStyles property, so
I don't know that we should add perInstanceStyles to IValuesImpl.

If we don't, you will have to know that the IValuesImpl is a
SimpleCSSValuesImpl, so I'm not sure I see an advantage to making it an
instance property.  IMO, it isn't a hack to have a static map.  It is
available on-demand.  Are you sure that the IValuesImpl is set before
anybody will need to access perInstanceStyles?

No code relies on it that I saw in a quick search, so I suppose you could
change it and see what others think when they need to add a property some
day.

-Alex

On 10/30/16, 2:31 PM, "Yishay Weiss" <yi...@hotmail.com> wrote:

>I’ll explain the scenario to make it more clear.
>
>
>
>I wanted to add a new CSS property (overflow) which was not included in
>SimpleCSSValueImpl. I noticed that valid CSS properties were specified in
>SimpleCSSValuesImpl.perInstanceStyles. I suppose I could have done
>                  
>SimpleCSSValuesImpl.perInstanceStyles.overflow = 1
>
>
>
>when the app initializes but it seems to me like a hack. Instead I wanted
>to create a new class that extends SimpleCSSValuesImpl and adds overflow
>to its list of allowed properties. The problem is that
>SimpleCSSValuesImpl.perInstanceStyles is static, so there’s no clean way
>of changing it.
>
>
>
>So my suggestion is to change this line:
>
>
>
>        public static var perInstanceStyles:Object = {…}
>
>
>
>with this line
>
>
>
>        public var perInstanceStyles:Object = {}
>
>
>
>It would still be accessible the way it’s done today, i.e.
>ValuesManager.valuesImpl will still be static as it is today. Any
>objections?
>
>
>
>From: Alex Harui<ma...@adobe.com>
>Sent: Sunday, October 30, 2016 4:07 PM
>To: dev@flex.apache.org<ma...@flex.apache.org>
>Subject: Re: [FlexJS] Extending SimpleCSSValuesImpl
>
>
>
>
>On 10/30/16, 4:23 AM, "yishayw" <yi...@hotmail.com> wrote:
>
>>Is there a reason why SimpleCSSValuesImpl.perInstanceStyles is static? It
>>makes extending SimpleCSSValuesImpl difficult. Since there's typically
>>just
>>one such instance per app is there any harm in making it a dynamic
>>property.
>>That will allow derived classes to simply push new values upon
>>construction,
>>and make adding a new style property to an app easier.
>>
>
>Not sure I understand, but you can try it and see what happens.  I think I
>set it up as static because that way you don't have to have a reference to
>the shared instance in order to change it.  But maybe it is easy enough to
>use ValuesManager to get there.
>
>-Alex
>


RE: [FlexJS] Extending SimpleCSSValuesImpl

Posted by Yishay Weiss <yi...@hotmail.com>.
I’ll explain the scenario to make it more clear.



I wanted to add a new CSS property (overflow) which was not included in SimpleCSSValueImpl. I noticed that valid CSS properties were specified in SimpleCSSValuesImpl.perInstanceStyles. I suppose I could have done                                              SimpleCSSValuesImpl.perInstanceStyles.overflow = 1



when the app initializes but it seems to me like a hack. Instead I wanted to create a new class that extends SimpleCSSValuesImpl and adds overflow to its list of allowed properties. The problem is that SimpleCSSValuesImpl.perInstanceStyles is static, so there’s no clean way of changing it.



So my suggestion is to change this line:



        public static var perInstanceStyles:Object = {…}



with this line



        public var perInstanceStyles:Object = {}



It would still be accessible the way it’s done today, i.e. ValuesManager.valuesImpl will still be static as it is today. Any objections?



From: Alex Harui<ma...@adobe.com>
Sent: Sunday, October 30, 2016 4:07 PM
To: dev@flex.apache.org<ma...@flex.apache.org>
Subject: Re: [FlexJS] Extending SimpleCSSValuesImpl




On 10/30/16, 4:23 AM, "yishayw" <yi...@hotmail.com> wrote:

>Is there a reason why SimpleCSSValuesImpl.perInstanceStyles is static? It
>makes extending SimpleCSSValuesImpl difficult. Since there's typically
>just
>one such instance per app is there any harm in making it a dynamic
>property.
>That will allow derived classes to simply push new values upon
>construction,
>and make adding a new style property to an app easier.
>

Not sure I understand, but you can try it and see what happens.  I think I
set it up as static because that way you don't have to have a reference to
the shared instance in order to change it.  But maybe it is easy enough to
use ValuesManager to get there.

-Alex


Re: [FlexJS] Extending SimpleCSSValuesImpl

Posted by Alex Harui <ah...@adobe.com>.

On 10/30/16, 4:23 AM, "yishayw" <yi...@hotmail.com> wrote:

>Is there a reason why SimpleCSSValuesImpl.perInstanceStyles is static? It
>makes extending SimpleCSSValuesImpl difficult. Since there's typically
>just
>one such instance per app is there any harm in making it a dynamic
>property.
>That will allow derived classes to simply push new values upon
>construction,
>and make adding a new style property to an app easier.
>

Not sure I understand, but you can try it and see what happens.  I think I
set it up as static because that way you don't have to have a reference to
the shared instance in order to change it.  But maybe it is easy enough to
use ValuesManager to get there.

-Alex