You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Harbs <ha...@gmail.com> on 2017/12/05 18:35:13 UTC

MXMLDataInterpreter

MXMLDataInterpreter has the following code:

            if (parent && comp is IChild)
                parent.addElement(comp as IChild, !(parent is IContainer));

The boolean second value is the “dispatchEvent” parameter in the method. Currently, dispatchEvent does nothing (i.e. no event is dispatched in either case), but I am working on a bead which needs to listen for element added events. To wit, I added an “elementAdded” event which is dispatched when dispatchEvent is true.

I need the bead to be notified when elements are added via MXML in addition to AS code, but addElement is being called with dispatchEvent as false.

Any clues as to why this is and what will happen if I change this?

Harbs

Re: SingleSelectionContainerBead (was Re: MXMLDataInterpreter)

Posted by Harbs <ha...@gmail.com>.
You can mix and match. Anything that implements ISelectable should be considered a “toggle button”.


> On Dec 6, 2017, at 4:37 PM, Peter Ent <pe...@adobe.com.INVALID> wrote:
> 
> Ha. Just sent a reply on the other thread with pretty much the same thing
> that you did. Might be nice addition for Express. Just in-line the things
> you want to toggle. Would it work with a ToggleButton, a CheckBox, and a
> couple of RadioButtons or do all of the children have to be ToggleButtons?
> 
> ‹peter
> 
> On 12/6/17, 7:37 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> OK.
>> 
>> I¹m done with the SingleSelectionContainerBead and committed it.
>> 
>> Here¹s a sample of how to use it:
>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpaste.apa
>> che.org%2FKG0k&data=02%7C01%7Cpent%40adobe.com%7C92de86e3967441568cd908d53
>> ca61e1f%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636481606522932424&sd
>> ata=A2WCO0Vk3X7fYeOK06D6IvY7JnKGOADK4R0laAi2BKQ%3D&reserved=0
>> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpaste.ap
>> ache.org%2FKG0k&data=02%7C01%7Cpent%40adobe.com%7C92de86e3967441568cd908d5
>> 3ca61e1f%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636481606523088680&s
>> data=k8AReDmUvQ9Hr2myYtna0tiPhTJGCxUj34ek18KkYj0%3D&reserved=0>
>> 
>> It¹s intelligent enough to allow adding non-ISelectable components to a
>> container and the index and selection management will only apply to the
>> ISelectable children. That should give a lot of flexibility in how it can
>> be used.
>> 
>> I have not created a ³ToggleButtonBar² component. I¹m not sure if there¹s
>> a need for one in Basic, although it might be nice to add one to Express?
>> 
>> I wasn¹t sure if events should be dispatched from the host component. For
>> now, the bead is dispatching the events directly.
>> 
>> Comments welcomeŠ
>> 
>> Harbs
>> 
>>> On Dec 6, 2017, at 10:10 AM, Alex Harui <ah...@adobe.com.INVALID>
>>> wrote:
>>> 
>>> Of course I could be wrong, but I'm packing it in for tonight, so I'll
>>> find out in my morning.
>> 
> 


Re: SingleSelectionContainerBead (was Re: MXMLDataInterpreter)

Posted by Peter Ent <pe...@adobe.com.INVALID>.
Ha. Just sent a reply on the other thread with pretty much the same thing
that you did. Might be nice addition for Express. Just in-line the things
you want to toggle. Would it work with a ToggleButton, a CheckBox, and a
couple of RadioButtons or do all of the children have to be ToggleButtons?

‹peter

On 12/6/17, 7:37 AM, "Harbs" <ha...@gmail.com> wrote:

>OK.
>
>I¹m done with the SingleSelectionContainerBead and committed it.
>
>Here¹s a sample of how to use it:
>https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpaste.apa
>che.org%2FKG0k&data=02%7C01%7Cpent%40adobe.com%7C92de86e3967441568cd908d53
>ca61e1f%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636481606522932424&sd
>ata=A2WCO0Vk3X7fYeOK06D6IvY7JnKGOADK4R0laAi2BKQ%3D&reserved=0
><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpaste.ap
>ache.org%2FKG0k&data=02%7C01%7Cpent%40adobe.com%7C92de86e3967441568cd908d5
>3ca61e1f%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636481606523088680&s
>data=k8AReDmUvQ9Hr2myYtna0tiPhTJGCxUj34ek18KkYj0%3D&reserved=0>
>
>It¹s intelligent enough to allow adding non-ISelectable components to a
>container and the index and selection management will only apply to the
>ISelectable children. That should give a lot of flexibility in how it can
>be used.
>
>I have not created a ³ToggleButtonBar² component. I¹m not sure if there¹s
>a need for one in Basic, although it might be nice to add one to Express?
>
>I wasn¹t sure if events should be dispatched from the host component. For
>now, the bead is dispatching the events directly.
>
>Comments welcomeŠ
>
>Harbs
>
>> On Dec 6, 2017, at 10:10 AM, Alex Harui <ah...@adobe.com.INVALID>
>>wrote:
>> 
>> Of course I could be wrong, but I'm packing it in for tonight, so I'll
>> find out in my morning.
>


SingleSelectionContainerBead (was Re: MXMLDataInterpreter)

Posted by Harbs <ha...@gmail.com>.
OK.

I’m done with the SingleSelectionContainerBead and committed it.

Here’s a sample of how to use it:
https://paste.apache.org/KG0k <https://paste.apache.org/KG0k>

It’s intelligent enough to allow adding non-ISelectable components to a container and the index and selection management will only apply to the ISelectable children. That should give a lot of flexibility in how it can be used.

I have not created a “ToggleButtonBar” component. I’m not sure if there’s a need for one in Basic, although it might be nice to add one to Express?

I wasn’t sure if events should be dispatched from the host component. For now, the bead is dispatching the events directly.

Comments welcome…

Harbs

> On Dec 6, 2017, at 10:10 AM, Alex Harui <ah...@adobe.com.INVALID> wrote:
> 
> Of course I could be wrong, but I'm packing it in for tonight, so I'll
> find out in my morning.


Re: MXMLDataInterpreter

Posted by Peter Ent <pe...@adobe.com.INVALID>.
Sometimes you really just want a set of buttons to act like a toggle
button bar. There's nothing dynamic about them. Putting them into an
container (I would recommend Group over Container since its much lighter
in weight and you probably don't need the possibility of scrolling).

The SingleSelectionContainerBead is what is looking at the children of the
Group and listening for their events and translating the clicks into:
state changes in the buttons (one highlighted, the others not) and
dispatching an event:

<js:SingleSelectionContainerBead change="changeHandler(event)" />

Its much like a controller with some model information (what's selected).
That's a pretty straightforward way to make this. The
SingleSelectionContainerBead could, if needed, programmatically select one
of the toggle buttons via index; don't know if that¹s a requirement you
have, but it would make the bead more useable to others.

The List, dataProvider, itemRenderers, factories, etc. is pretty complex
right now. I think we've seen a lot and maybe we should rethink all of
that. I'm trying to make additional beads that augment the lists to just
create and insert a single itemRenderer in response to a CollectionEvent
on ArrayList. Conceptually simple, but its just messy.

FWIW: if you aren't concerned about the SWF side, then don't even use a
layout, jut make a Group (which has no layout by default) and style the
toggle buttons with display style. Make the browser do the work and reduce
your download size.

‹peter

On 12/6/17, 3:40 AM, "Harbs" <ha...@gmail.com> wrote:

>>> 
>>> Agreed, but I can¹t think of a way to do this.
>> 
>> One way is to have assignable removeElement logic.
>
>Meaning an assignable Function property, or something else?
>
>> Another is to have a bead that overwrites
>>UIBase.prototype.removeElement.
>> What won't work on SWF but will on JS.
>
>Interesting. Probably worth looking into.
>
>>> 
>>> I¹m trying to keep this really simple. ButtonBar extends List which
>>> requires dataProviders, ItemRendererers, etc. My approach is to allow
>>> adding any component which has a selected property to any container.
>>>The
>>> bead will handle correcting the selection of the unselected elements. I
>>> want to enable the following mxml:
>>> 
>>> <js:HContainer>
>>>   <js:beads>
>>>       <js:SingleSelectionContainerBead/>
>>>   </js:beads>
>>>   <js:ToggleTextButton text="Fee"/>
>>>   <js:ToggleTextButton text="Fi"/>
>>>   <js:ToggleTextButton text="Fo"/>
>>>   <js:ToggleTextButton text="Fum"/>
>>> </js:HContainer>
>>> 
>>> Those ToggleTextButtons could be RadioButtons, Checkboxes, etc.
>> 
>> We should make sure it works, but I would expect issues around focus,
>> keyboard selection and accessibility.  And also, how it upgrades to
>>being
>> able to load the text labels from resources or a server and add or
>>remove
>> buttons.
>
>I¹m not sure I understand why you think these are issues. The components
>should be pretty much self contained. I guess I¹ll see.
>
>> This sort of thing makes me wonder if there is some other item renderer
>> contract we should be offering instead.  IIRC, right now, the contract
>> dictates that the renderer must have a "data" property.  Maybe if there
>> was a contract where we could dictate the property to set you could just
>> drop in an existing component as a renderer.  There was a similar thing
>>in
>> Flex.  It was a bit heavy, but maybe folks don't care.
>> 
>> Way back I pointed out that all components should be able to be
>>expressed
>> as a UIBase or ContainerBase/GroupBase with a collection of beads.  It
>> would be interesting to see what the other List beads expect.  Right
>>now a
>> factory watches a dataProvider and generates an item renderer for each
>> dataProvider item.  Hopefully the other beads don't care how the item
>> renderers appeared and can be repurposed to your pattern.  IOW, either
>>you
>> specify a factory and an item renderer and a dataProvider or you supply
>>a
>> set of children, but everything else should work.
>
>I¹m not sure if I¹m following you here. My understanding was that the
>only way to specify the children of a list is to provide a dataProvider.
>It seems like you are saying that it should technically be possible to
>add the children directly. For kicks I just tried the following to see
>and it did not work at all (i.e. nothing was added to the button bar):
><js:ButtonBar>
>	<js:ToggleTextButton text="Fee"/>
>	<js:ToggleTextButton text="Fi"/>
>	<js:ToggleTextButton text="Fo"/>
>	<js:ToggleTextButton text="Fum"/>
></js:ButtonBar>
>
>I¹m guessing that you are suggesting a factory could be added with
>conditional logic.
>
>Harbs
>
>


Re: MXMLDataInterpreter

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

On 12/6/17, 1:33 PM, "Harbs" <ha...@gmail.com> wrote:

>In my structure, tab would focus the first button and hitting tab again
>will focus the next button. Seems like normal behavior to me.

AFAIK, that's not the standard interaction defined by Windows, and I think
OS X as well.
>
>> On Dec 6, 2017, at 9:16 PM, Alex Harui <ah...@adobe.com.INVALID> wrote:
>> 
>> IMO, there are user expectations on how focus and selection will work.
>>In
>> Windows and probably OSX, if you tab into a buttonBar, the entire
>> ButtonBar gets focus and the selected button is highlighted in some way
>> and you use arrow keys to change the selected button.  Your pattern will
>> have different behavior and the screen reader is also likely to read
>> something different.
>


Re: MXMLDataInterpreter

Posted by Harbs <ha...@gmail.com>.
In my structure, tab would focus the first button and hitting tab again will focus the next button. Seems like normal behavior to me.

> On Dec 6, 2017, at 9:16 PM, Alex Harui <ah...@adobe.com.INVALID> wrote:
> 
> IMO, there are user expectations on how focus and selection will work.  In
> Windows and probably OSX, if you tab into a buttonBar, the entire
> ButtonBar gets focus and the selected button is highlighted in some way
> and you use arrow keys to change the selected button.  Your pattern will
> have different behavior and the screen reader is also likely to read
> something different.


Re: Names and Packages (was Re: MXMLDataInterpreter)

Posted by Piotr Zarzycki <pi...@gmail.com>.
If that granularity from point one is going to happen, let's it happen
before the first release. My thought is that we should get used to users
for some structures which do not fluctuate too much.

Thanks, Piotr

2017-12-07 20:04 GMT+01:00 Alex Harui <ah...@adobe.com.invalid>:

> I first want to acknowledge Piotr's concern about shuffling things around,
> but on the other hand, if we think we have a lot of beads now, I hope
> after several years we have 10x or 100x as many, so having good
> organization will help people find things.
>
> I think we also need to consider that some beads are "aggregates".  They
> are more than one bead combined together for some reason (ease of use,
> inlining code, etc).
>
> Are there other buckets we need to consider?
>
> I'm on the fence about whether we need to do this renaming.  If we do it,
> do we want to get it done before the first Royale release?
>
> -Alex
>
> On 12/7/17, 9:31 AM, "Harbs" <ha...@gmail.com> wrote:
>
> >Behavior would be something like: Password bead, SingleSelecttion,
> >Disabled, etc.
> >Appearance would be things like: DataGridLines, DisabledAlpha, Border,
> >Background, etc.
> >
> >> On Dec 7, 2017, at 7:16 PM, Alex Harui <ah...@adobe.com.INVALID>
> wrote:
> >>
> >> What's a "behavior" and "appearance"?
> >>
> >> -Alex
> >>
> >> On 12/7/17, 1:39 AM, "Harbs" <harbs.lists@gmail.com
> >><ma...@gmail.com>> wrote:
> >>
> >>> Related thoughts about names and packages:
> >>> 1. I think the bead classes should be organized better. There’s
> >>>currently
> >>> controllers, layouts and models packages. There should be views,
> >>> behaviors, appearances, etc.
> >>> 2. I’m not sure that the “html” package in Basic is the right name.
> >>> “basic” seems much more appropriate to me as it’s really not HTML
> >>> specific and there’s no guarantee in the components as to which html
> >>> element is actually used.
> >>> 3. It also might be time to move code around in the different swcs.
> >>> “core” in the Basic package might belong in Core rather than Basic.
> >>>“svg”
> >>> should probably be moved into an SVG package, etc.
> >>>
> >>>> On Dec 7, 2017, at 10:13 AM, Harbs <ha...@gmail.com> wrote:
> >>>>
> >>>> I was thinking a bit about naming. A few points to ponder:
> >>>>
> >>>> 1. If anything it should mention Group rather than Container, because
> >>>> anything subclassing GroupBase should work.
> >>>> 2. Maybe mentioning the “holder” type is just confusing. Maybe
> >>>> SingleSelectionBead?
> >>>> 3. This got me thinking about bead names in general:
> >>>>
> >>>> I’m wondering if bead names should be more explicit about their
> >>>> function? We already have view beads with a suffix of View,
> >>>>controllers
> >>>> with a suffix of Controller, models with a suffix of Model and Layout
> >>>> for layout. What about SingleSelectionBehavior? Some suffixes might
> >>>>be:
> >>>> Behavior, Appearance, Measurement. Basically, I’m suggesting that the
> >>>> bead names should describe what category they fit into. We can also
> >>>>drop
> >>>> the word “Bead” from them.
> >>>>
> >>>> Thoughts?
> >>>>
> >>>>> On Dec 6, 2017, at 11:35 PM, Harbs <harbs.lists@gmail.com
> >>>>> <mailto:harbs.lists@gmail.com <ma...@gmail.com>>>
> wrote:
> >>>>>
> >>>>> It is.
> >>>>>
> >>>>> Possibly it could use a better name?
> >>>>>
> >>>>>> On Dec 6, 2017, at 9:16 PM, Alex Harui <aharui@adobe.com.INVALID
> >>>>>><ma...@adobe.com.INVALID>
> >>>>>> <mailto:aharui@adobe.com.INVALID
> >>>>>><ma...@adobe.com.INVALID>>> wrote:
> >>>>>>
> >>>>>> There probably shouldn't have been a need for
> >>>>>> SingleSelectionContainerBead unless it is an aggregation of
> >>>>>> SingleSelectionModelBead and SingleSelectionControllerBead.
> >
>
>


-- 

Piotr Zarzycki

Patreon: *https://www.patreon.com/piotrzarzycki
<https://www.patreon.com/piotrzarzycki>*

Re: Names and Packages (was Re: MXMLDataInterpreter)

Posted by Alex Harui <ah...@adobe.com.INVALID>.
I first want to acknowledge Piotr's concern about shuffling things around,
but on the other hand, if we think we have a lot of beads now, I hope
after several years we have 10x or 100x as many, so having good
organization will help people find things.

I think we also need to consider that some beads are "aggregates".  They
are more than one bead combined together for some reason (ease of use,
inlining code, etc).

Are there other buckets we need to consider?

I'm on the fence about whether we need to do this renaming.  If we do it,
do we want to get it done before the first Royale release?

-Alex

On 12/7/17, 9:31 AM, "Harbs" <ha...@gmail.com> wrote:

>Behavior would be something like: Password bead, SingleSelecttion,
>Disabled, etc.
>Appearance would be things like: DataGridLines, DisabledAlpha, Border,
>Background, etc.
>
>> On Dec 7, 2017, at 7:16 PM, Alex Harui <ah...@adobe.com.INVALID> wrote:
>> 
>> What's a "behavior" and "appearance"?
>> 
>> -Alex
>> 
>> On 12/7/17, 1:39 AM, "Harbs" <harbs.lists@gmail.com
>><ma...@gmail.com>> wrote:
>> 
>>> Related thoughts about names and packages:
>>> 1. I think the bead classes should be organized better. There’s
>>>currently
>>> controllers, layouts and models packages. There should be views,
>>> behaviors, appearances, etc.
>>> 2. I’m not sure that the “html” package in Basic is the right name.
>>> “basic” seems much more appropriate to me as it’s really not HTML
>>> specific and there’s no guarantee in the components as to which html
>>> element is actually used.
>>> 3. It also might be time to move code around in the different swcs.
>>> “core” in the Basic package might belong in Core rather than Basic.
>>>“svg”
>>> should probably be moved into an SVG package, etc.
>>> 
>>>> On Dec 7, 2017, at 10:13 AM, Harbs <ha...@gmail.com> wrote:
>>>> 
>>>> I was thinking a bit about naming. A few points to ponder:
>>>> 
>>>> 1. If anything it should mention Group rather than Container, because
>>>> anything subclassing GroupBase should work.
>>>> 2. Maybe mentioning the “holder” type is just confusing. Maybe
>>>> SingleSelectionBead?
>>>> 3. This got me thinking about bead names in general:
>>>> 
>>>> I’m wondering if bead names should be more explicit about their
>>>> function? We already have view beads with a suffix of View,
>>>>controllers
>>>> with a suffix of Controller, models with a suffix of Model and Layout
>>>> for layout. What about SingleSelectionBehavior? Some suffixes might
>>>>be:
>>>> Behavior, Appearance, Measurement. Basically, I’m suggesting that the
>>>> bead names should describe what category they fit into. We can also
>>>>drop
>>>> the word “Bead” from them.
>>>> 
>>>> Thoughts?
>>>> 
>>>>> On Dec 6, 2017, at 11:35 PM, Harbs <harbs.lists@gmail.com
>>>>> <mailto:harbs.lists@gmail.com <ma...@gmail.com>>> wrote:
>>>>> 
>>>>> It is.
>>>>> 
>>>>> Possibly it could use a better name?
>>>>> 
>>>>>> On Dec 6, 2017, at 9:16 PM, Alex Harui <aharui@adobe.com.INVALID
>>>>>><ma...@adobe.com.INVALID>
>>>>>> <mailto:aharui@adobe.com.INVALID
>>>>>><ma...@adobe.com.INVALID>>> wrote:
>>>>>> 
>>>>>> There probably shouldn't have been a need for
>>>>>> SingleSelectionContainerBead unless it is an aggregation of
>>>>>> SingleSelectionModelBead and SingleSelectionControllerBead.
>


Re: Names and Packages (was Re: MXMLDataInterpreter)

Posted by Harbs <ha...@gmail.com>.
Behavior would be something like: Password bead, SingleSelecttion, Disabled, etc.
Appearance would be things like: DataGridLines, DisabledAlpha, Border, Background, etc.

> On Dec 7, 2017, at 7:16 PM, Alex Harui <ah...@adobe.com.INVALID> wrote:
> 
> What's a "behavior" and "appearance"?
> 
> -Alex
> 
> On 12/7/17, 1:39 AM, "Harbs" <harbs.lists@gmail.com <ma...@gmail.com>> wrote:
> 
>> Related thoughts about names and packages:
>> 1. I think the bead classes should be organized better. There’s currently
>> controllers, layouts and models packages. There should be views,
>> behaviors, appearances, etc.
>> 2. I’m not sure that the “html” package in Basic is the right name.
>> “basic” seems much more appropriate to me as it’s really not HTML
>> specific and there’s no guarantee in the components as to which html
>> element is actually used.
>> 3. It also might be time to move code around in the different swcs.
>> “core” in the Basic package might belong in Core rather than Basic. “svg”
>> should probably be moved into an SVG package, etc.
>> 
>>> On Dec 7, 2017, at 10:13 AM, Harbs <ha...@gmail.com> wrote:
>>> 
>>> I was thinking a bit about naming. A few points to ponder:
>>> 
>>> 1. If anything it should mention Group rather than Container, because
>>> anything subclassing GroupBase should work.
>>> 2. Maybe mentioning the “holder” type is just confusing. Maybe
>>> SingleSelectionBead?
>>> 3. This got me thinking about bead names in general:
>>> 
>>> I’m wondering if bead names should be more explicit about their
>>> function? We already have view beads with a suffix of View, controllers
>>> with a suffix of Controller, models with a suffix of Model and Layout
>>> for layout. What about SingleSelectionBehavior? Some suffixes might be:
>>> Behavior, Appearance, Measurement. Basically, I’m suggesting that the
>>> bead names should describe what category they fit into. We can also drop
>>> the word “Bead” from them.
>>> 
>>> Thoughts?
>>> 
>>>> On Dec 6, 2017, at 11:35 PM, Harbs <harbs.lists@gmail.com
>>>> <mailto:harbs.lists@gmail.com <ma...@gmail.com>>> wrote:
>>>> 
>>>> It is.
>>>> 
>>>> Possibly it could use a better name?
>>>> 
>>>>> On Dec 6, 2017, at 9:16 PM, Alex Harui <aharui@adobe.com.INVALID <ma...@adobe.com.INVALID>
>>>>> <mailto:aharui@adobe.com.INVALID <ma...@adobe.com.INVALID>>> wrote:
>>>>> 
>>>>> There probably shouldn't have been a need for
>>>>> SingleSelectionContainerBead unless it is an aggregation of
>>>>> SingleSelectionModelBead and SingleSelectionControllerBead.


Re: Names and Packages (was Re: MXMLDataInterpreter)

Posted by Alex Harui <ah...@adobe.com.INVALID>.
What's a "behavior" and "appearance"?

-Alex

On 12/7/17, 1:39 AM, "Harbs" <ha...@gmail.com> wrote:

>Related thoughts about names and packages:
>1. I think the bead classes should be organized better. There’s currently
>controllers, layouts and models packages. There should be views,
>behaviors, appearances, etc.
>2. I’m not sure that the “html” package in Basic is the right name.
>“basic” seems much more appropriate to me as it’s really not HTML
>specific and there’s no guarantee in the components as to which html
>element is actually used.
>3. It also might be time to move code around in the different swcs.
>“core” in the Basic package might belong in Core rather than Basic. “svg”
>should probably be moved into an SVG package, etc.
>
>> On Dec 7, 2017, at 10:13 AM, Harbs <ha...@gmail.com> wrote:
>> 
>> I was thinking a bit about naming. A few points to ponder:
>> 
>> 1. If anything it should mention Group rather than Container, because
>>anything subclassing GroupBase should work.
>> 2. Maybe mentioning the “holder” type is just confusing. Maybe
>>SingleSelectionBead?
>> 3. This got me thinking about bead names in general:
>> 
>> I’m wondering if bead names should be more explicit about their
>>function? We already have view beads with a suffix of View, controllers
>>with a suffix of Controller, models with a suffix of Model and Layout
>>for layout. What about SingleSelectionBehavior? Some suffixes might be:
>>Behavior, Appearance, Measurement. Basically, I’m suggesting that the
>>bead names should describe what category they fit into. We can also drop
>>the word “Bead” from them.
>> 
>> Thoughts?
>> 
>>> On Dec 6, 2017, at 11:35 PM, Harbs <harbs.lists@gmail.com
>>><ma...@gmail.com>> wrote:
>>> 
>>> It is.
>>> 
>>> Possibly it could use a better name?
>>> 
>>>> On Dec 6, 2017, at 9:16 PM, Alex Harui <aharui@adobe.com.INVALID
>>>><ma...@adobe.com.INVALID>> wrote:
>>>> 
>>>> There probably shouldn't have been a need for
>>>>SingleSelectionContainerBead unless it is an aggregation of
>>>>SingleSelectionModelBead and SingleSelectionControllerBead.
>>> 
>> 
>


Re: Names and Packages (was Re: MXMLDataInterpreter)

Posted by Piotr Zarzycki <pi...@gmail.com>.
Hi Harbs, Peter,

I agree with point 1, 2 and 3, but I would leave as is all components which
we have currently in basic in place. Another change of API and
restructuring ? Let's make current components better and give users feeling
of stability with another moving from one place to another we cannot give
anyone that feeling.

Thanks, Piotr


2017-12-07 16:20 GMT+01:00 Peter Ent <pe...@adobe.com.invalid>:

> I also wonder if List, DataGrid, Tree shouldn't be moved out of "basic"
> and into "advanced" - they along with their supporting beads. From the
> work I've been doing with handling "itemAdded" event vs
> "dataProviderChanged", it might be easier for customers who want the
> expense of a DataGrid to just pay for ArrayList as the default model
> rather than trying to maintain Array as an entry point model. Having
> Array, which does not offer a uniform access method (eg, getItemAt) means
> duplicating code to support it. Then if ArrayList supported IDataModel (a
> more generic name) instead of IArrayList, an app writer's more complex
> data source, like a database, could implement IDataModel and be easily
> substituted as the dataProvider to the List support beads.
>
> Just a thought.
>
> ‹peter
>
> On 12/7/17, 4:39 AM, "Harbs" <ha...@gmail.com> wrote:
>
> >Related thoughts about names and packages:
> >1. I think the bead classes should be organized better. There¹s currently
> >controllers, layouts and models packages. There should be views,
> >behaviors, appearances, etc.
> >2. I¹m not sure that the ³html² package in Basic is the right name.
> >³basic² seems much more appropriate to me as it¹s really not HTML
> >specific and there¹s no guarantee in the components as to which html
> >element is actually used.
> >3. It also might be time to move code around in the different swcs.
> >³core² in the Basic package might belong in Core rather than Basic. ³svg²
> >should probably be moved into an SVG package, etc.
> >
> >> On Dec 7, 2017, at 10:13 AM, Harbs <ha...@gmail.com> wrote:
> >>
> >> I was thinking a bit about naming. A few points to ponder:
> >>
> >> 1. If anything it should mention Group rather than Container, because
> >>anything subclassing GroupBase should work.
> >> 2. Maybe mentioning the ³holder² type is just confusing. Maybe
> >>SingleSelectionBead?
> >> 3. This got me thinking about bead names in general:
> >>
> >> I¹m wondering if bead names should be more explicit about their
> >>function? We already have view beads with a suffix of View, controllers
> >>with a suffix of Controller, models with a suffix of Model and Layout
> >>for layout. What about SingleSelectionBehavior? Some suffixes might be:
> >>Behavior, Appearance, Measurement. Basically, I¹m suggesting that the
> >>bead names should describe what category they fit into. We can also drop
> >>the word ³Bead² from them.
> >>
> >> Thoughts?
> >>
> >>> On Dec 6, 2017, at 11:35 PM, Harbs <harbs.lists@gmail.com
> >>><ma...@gmail.com>> wrote:
> >>>
> >>> It is.
> >>>
> >>> Possibly it could use a better name?
> >>>
> >>>> On Dec 6, 2017, at 9:16 PM, Alex Harui <aharui@adobe.com.INVALID
> >>>><ma...@adobe.com.INVALID>> wrote:
> >>>>
> >>>> There probably shouldn't have been a need for
> >>>>SingleSelectionContainerBead unless it is an aggregation of
> >>>>SingleSelectionModelBead and SingleSelectionControllerBead.
> >>>
> >>
> >
>
>


-- 

Piotr Zarzycki

Patreon: *https://www.patreon.com/piotrzarzycki
<https://www.patreon.com/piotrzarzycki>*

Re: Names and Packages (was Re: MXMLDataInterpreter)

Posted by Peter Ent <pe...@adobe.com.INVALID>.
I also wonder if List, DataGrid, Tree shouldn't be moved out of "basic"
and into "advanced" - they along with their supporting beads. From the
work I've been doing with handling "itemAdded" event vs
"dataProviderChanged", it might be easier for customers who want the
expense of a DataGrid to just pay for ArrayList as the default model
rather than trying to maintain Array as an entry point model. Having
Array, which does not offer a uniform access method (eg, getItemAt) means
duplicating code to support it. Then if ArrayList supported IDataModel (a
more generic name) instead of IArrayList, an app writer's more complex
data source, like a database, could implement IDataModel and be easily
substituted as the dataProvider to the List support beads.

Just a thought.

‹peter

On 12/7/17, 4:39 AM, "Harbs" <ha...@gmail.com> wrote:

>Related thoughts about names and packages:
>1. I think the bead classes should be organized better. There¹s currently
>controllers, layouts and models packages. There should be views,
>behaviors, appearances, etc.
>2. I¹m not sure that the ³html² package in Basic is the right name.
>³basic² seems much more appropriate to me as it¹s really not HTML
>specific and there¹s no guarantee in the components as to which html
>element is actually used.
>3. It also might be time to move code around in the different swcs.
>³core² in the Basic package might belong in Core rather than Basic. ³svg²
>should probably be moved into an SVG package, etc.
>
>> On Dec 7, 2017, at 10:13 AM, Harbs <ha...@gmail.com> wrote:
>> 
>> I was thinking a bit about naming. A few points to ponder:
>> 
>> 1. If anything it should mention Group rather than Container, because
>>anything subclassing GroupBase should work.
>> 2. Maybe mentioning the ³holder² type is just confusing. Maybe
>>SingleSelectionBead?
>> 3. This got me thinking about bead names in general:
>> 
>> I¹m wondering if bead names should be more explicit about their
>>function? We already have view beads with a suffix of View, controllers
>>with a suffix of Controller, models with a suffix of Model and Layout
>>for layout. What about SingleSelectionBehavior? Some suffixes might be:
>>Behavior, Appearance, Measurement. Basically, I¹m suggesting that the
>>bead names should describe what category they fit into. We can also drop
>>the word ³Bead² from them.
>> 
>> Thoughts?
>> 
>>> On Dec 6, 2017, at 11:35 PM, Harbs <harbs.lists@gmail.com
>>><ma...@gmail.com>> wrote:
>>> 
>>> It is.
>>> 
>>> Possibly it could use a better name?
>>> 
>>>> On Dec 6, 2017, at 9:16 PM, Alex Harui <aharui@adobe.com.INVALID
>>>><ma...@adobe.com.INVALID>> wrote:
>>>> 
>>>> There probably shouldn't have been a need for
>>>>SingleSelectionContainerBead unless it is an aggregation of
>>>>SingleSelectionModelBead and SingleSelectionControllerBead.
>>> 
>> 
>


Names and Packages (was Re: MXMLDataInterpreter)

Posted by Harbs <ha...@gmail.com>.
Related thoughts about names and packages:
1. I think the bead classes should be organized better. There’s currently controllers, layouts and models packages. There should be views, behaviors, appearances, etc.
2. I’m not sure that the “html” package in Basic is the right name. “basic” seems much more appropriate to me as it’s really not HTML specific and there’s no guarantee in the components as to which html element is actually used.
3. It also might be time to move code around in the different swcs. “core” in the Basic package might belong in Core rather than Basic. “svg” should probably be moved into an SVG package, etc.

> On Dec 7, 2017, at 10:13 AM, Harbs <ha...@gmail.com> wrote:
> 
> I was thinking a bit about naming. A few points to ponder:
> 
> 1. If anything it should mention Group rather than Container, because anything subclassing GroupBase should work.
> 2. Maybe mentioning the “holder” type is just confusing. Maybe SingleSelectionBead?
> 3. This got me thinking about bead names in general:
> 
> I’m wondering if bead names should be more explicit about their function? We already have view beads with a suffix of View, controllers with a suffix of Controller, models with a suffix of Model and Layout for layout. What about SingleSelectionBehavior? Some suffixes might be: Behavior, Appearance, Measurement. Basically, I’m suggesting that the bead names should describe what category they fit into. We can also drop the word “Bead” from them.
> 
> Thoughts?
> 
>> On Dec 6, 2017, at 11:35 PM, Harbs <harbs.lists@gmail.com <ma...@gmail.com>> wrote:
>> 
>> It is.
>> 
>> Possibly it could use a better name?
>> 
>>> On Dec 6, 2017, at 9:16 PM, Alex Harui <aharui@adobe.com.INVALID <ma...@adobe.com.INVALID>> wrote:
>>> 
>>> There probably shouldn't have been a need for SingleSelectionContainerBead unless it is an aggregation of SingleSelectionModelBead and SingleSelectionControllerBead. 
>> 
> 


Re: MXMLDataInterpreter

Posted by Harbs <ha...@gmail.com>.
I was thinking a bit about naming. A few points to ponder:

1. If anything it should mention Group rather than Container, because anything subclassing GroupBase should work.
2. Maybe mentioning the “holder” type is just confusing. Maybe SingleSelectionBead?
3. This got me thinking about bead names in general:

I’m wondering if bead names should be more explicit about their function? We already have view beads with a suffix of View, controllers with a suffix of Controller, models with a suffix of Model and Layout for layout. What about SingleSelectionBehavior? Some suffixes might be: Behavior, Appearance, Measurement. Basically, I’m suggesting that the bead names should describe what category they fit into. We can also drop the word “Bead” from them.

Thoughts?

> On Dec 6, 2017, at 11:35 PM, Harbs <ha...@gmail.com> wrote:
> 
> It is.
> 
> Possibly it could use a better name?
> 
>> On Dec 6, 2017, at 9:16 PM, Alex Harui <aharui@adobe.com.INVALID <ma...@adobe.com.INVALID>> wrote:
>> 
>> There probably shouldn't have been a need for SingleSelectionContainerBead unless it is an aggregation of SingleSelectionModelBead and SingleSelectionControllerBead. 
> 


Re: MXMLDataInterpreter

Posted by Harbs <ha...@gmail.com>.
It is.

Possibly it could use a better name?

> On Dec 6, 2017, at 9:16 PM, Alex Harui <ah...@adobe.com.INVALID> wrote:
> 
> There probably shouldn't have been a need for SingleSelectionContainerBead unless it is an aggregation of SingleSelectionModelBead and SingleSelectionControllerBead. 


Re: MXMLDataInterpreter

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

On 12/6/17, 12:40 AM, "Harbs" <ha...@gmail.com> wrote:

>>> 
>>> Agreed, but I can’t think of a way to do this.
>> 
>> One way is to have assignable removeElement logic.
>
>Meaning an assignable Function property, or something else?

Yes:

public function removeElement(e:IUIBase):void
{
  actualRemoveElement(e);
}
public var actualRemoveElement:Function = removeElementBody;
public function removeElementBody(e:IUIBase):void
{
  // current body of removeElement
}

Pretty ugly.

>> Another is to have a bead that overwrites
>>UIBase.prototype.removeElement.
>> What won't work on SWF but will on JS.
>
>Interesting. Probably worth looking into.

Another option is to remove the removeElement APIs from UIBase and turn it
into utility functions.

org.apache.flex.utils.removeElement = function{parent, childElement)
}


>>> 
>>> I’m trying to keep this really simple. ButtonBar extends List which
>>> requires dataProviders, ItemRendererers, etc. My approach is to allow
>>> adding any component which has a selected property to any container.
>>>The
>>> bead will handle correcting the selection of the unselected elements. I
>>> want to enable the following mxml:
>>> 
>>> <js:HContainer>
>>>   <js:beads>
>>>       <js:SingleSelectionContainerBead/>
>>>   </js:beads>
>>>   <js:ToggleTextButton text="Fee"/>
>>>   <js:ToggleTextButton text="Fi"/>
>>>   <js:ToggleTextButton text="Fo"/>
>>>   <js:ToggleTextButton text="Fum"/>
>>> </js:HContainer>
>>> 
>>> Those ToggleTextButtons could be RadioButtons, Checkboxes, etc.
>> 
>> We should make sure it works, but I would expect issues around focus,
>> keyboard selection and accessibility.  And also, how it upgrades to
>>being
>> able to load the text labels from resources or a server and add or
>>remove
>> buttons.
>
>I’m not sure I understand why you think these are issues. The components
>should be pretty much self contained. I guess I’ll see.

IMO, there are user expectations on how focus and selection will work.  In
Windows and probably OSX, if you tab into a buttonBar, the entire
ButtonBar gets focus and the selected button is highlighted in some way
and you use arrow keys to change the selected button.  Your pattern will
have different behavior and the screen reader is also likely to read
something different.

>
>> This sort of thing makes me wonder if there is some other item renderer
>> contract we should be offering instead.  IIRC, right now, the contract
>> dictates that the renderer must have a "data" property.  Maybe if there
>> was a contract where we could dictate the property to set you could just
>> drop in an existing component as a renderer.  There was a similar thing
>>in
>> Flex.  It was a bit heavy, but maybe folks don't care.
>> 
>> Way back I pointed out that all components should be able to be
>>expressed
>> as a UIBase or ContainerBase/GroupBase with a collection of beads.  It
>> would be interesting to see what the other List beads expect.  Right
>>now a
>> factory watches a dataProvider and generates an item renderer for each
>> dataProvider item.  Hopefully the other beads don't care how the item
>> renderers appeared and can be repurposed to your pattern.  IOW, either
>>you
>> specify a factory and an item renderer and a dataProvider or you supply
>>a
>> set of children, but everything else should work.
>
>I’m not sure if I’m following you here. My understanding was that the
>only way to specify the children of a list is to provide a dataProvider.
>It seems like you are saying that it should technically be possible to
>add the children directly. For kicks I just tried the following to see
>and it did not work at all (i.e. nothing was added to the button bar):
><js:ButtonBar>
>	<js:ToggleTextButton text="Fee"/>
>	<js:ToggleTextButton text="Fi"/>
>	<js:ToggleTextButton text="Fo"/>
>	<js:ToggleTextButton text="Fum"/>
></js:ButtonBar>
>
>I’m guessing that you are suggesting a factory could be added with
>conditional logic.

Actually, I'm suggesting no factory at all.  The goal is to create
re-usable beads that don't have much conditional logic.  You can certainly
make things re-usable with conditional logic, but that adds just-in-case
code.

A List should be the encapsulation of the following:

<UIBase>
  <beads>
    <SingleSelectionModelBead />
    <ListViewBead />
    <SingleSelectionControllerBead />
    <VerticalLayout />
    <DataProviderItemRendererFactoryForArray />
    <ItemRendererClassFactory />
    <StringItemRenderer />
  </beads>
</UIBase>

There are also a few more beads to manage scrolling.  We need to think
through what assumptions each of these beads might have and see if any of
those assumptions need adjusting.  For example, I would hope that the
Selection related beads have no assumption that there are these Factory
classes on the strand.  In theory, you should have been able to create
your ButtonBar like this:

<ContainerBase>
  <beads>
    <SingleSelectionModelBead />
    <ListViewBead />
    <SingleSelectionControllerBead />
    <HorizontalLayout />
  </beads>
  <js:ToggleTextButton text="Fee"/>
  <js:ToggleTextButton text="Fi"/>
  <js:ToggleTextButton text="Fo"/>
  <js:ToggleTextButton text="Fum"/>
</ContainerBase>


I've replaced the 3 factory related beads with the four children they
would have otherwise generated.  There probably shouldn't have been a need
for SingleSelectionContainerBead unless it is an aggregation of
SingleSelectionModelBead and SingleSelectionControllerBead.  If it isn't
an aggregation, what would be the cost of generalizing these beads so they
can be re-used?  And if it isn't worth it, what is it about what you
needed that is different just because we don't have a factory of item
renderers?

Of course, I could be wrong...
-Alex
>


Re: MXMLDataInterpreter

Posted by Harbs <ha...@gmail.com>.
>> 
>> Agreed, but I can’t think of a way to do this.
> 
> One way is to have assignable removeElement logic.

Meaning an assignable Function property, or something else?

> Another is to have a bead that overwrites UIBase.prototype.removeElement.
> What won't work on SWF but will on JS.

Interesting. Probably worth looking into.

>> 
>> I’m trying to keep this really simple. ButtonBar extends List which
>> requires dataProviders, ItemRendererers, etc. My approach is to allow
>> adding any component which has a selected property to any container. The
>> bead will handle correcting the selection of the unselected elements. I
>> want to enable the following mxml:
>> 
>> <js:HContainer>
>>   <js:beads>
>>       <js:SingleSelectionContainerBead/>
>>   </js:beads>
>>   <js:ToggleTextButton text="Fee"/>
>>   <js:ToggleTextButton text="Fi"/>
>>   <js:ToggleTextButton text="Fo"/>
>>   <js:ToggleTextButton text="Fum"/>
>> </js:HContainer>
>> 
>> Those ToggleTextButtons could be RadioButtons, Checkboxes, etc.
> 
> We should make sure it works, but I would expect issues around focus,
> keyboard selection and accessibility.  And also, how it upgrades to being
> able to load the text labels from resources or a server and add or remove
> buttons.

I’m not sure I understand why you think these are issues. The components should be pretty much self contained. I guess I’ll see.

> This sort of thing makes me wonder if there is some other item renderer
> contract we should be offering instead.  IIRC, right now, the contract
> dictates that the renderer must have a "data" property.  Maybe if there
> was a contract where we could dictate the property to set you could just
> drop in an existing component as a renderer.  There was a similar thing in
> Flex.  It was a bit heavy, but maybe folks don't care.
> 
> Way back I pointed out that all components should be able to be expressed
> as a UIBase or ContainerBase/GroupBase with a collection of beads.  It
> would be interesting to see what the other List beads expect.  Right now a
> factory watches a dataProvider and generates an item renderer for each
> dataProvider item.  Hopefully the other beads don't care how the item
> renderers appeared and can be repurposed to your pattern.  IOW, either you
> specify a factory and an item renderer and a dataProvider or you supply a
> set of children, but everything else should work.

I’m not sure if I’m following you here. My understanding was that the only way to specify the children of a list is to provide a dataProvider. It seems like you are saying that it should technically be possible to add the children directly. For kicks I just tried the following to see and it did not work at all (i.e. nothing was added to the button bar):
<js:ButtonBar>
	<js:ToggleTextButton text="Fee"/>
	<js:ToggleTextButton text="Fi"/>
	<js:ToggleTextButton text="Fo"/>
	<js:ToggleTextButton text="Fum"/>
</js:ButtonBar>

I’m guessing that you are suggesting a factory could be added with conditional logic.

Harbs



Re: MXMLDataInterpreter

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

On 12/5/17, 11:23 PM, "Harbs" <ha...@gmail.com> wrote:

>Responses inline:
>
>> On Dec 6, 2017, at 7:07 AM, Alex Harui <ah...@adobe.com.INVALID> wrote:
>> 
>>> 3 There is no even being dispatched for removeElement. If I’m attaching
>>> event listeners when they are added, I should be removing those
>>>listeners
>>> when they are removed.
>> 
>> I'd like to find a way to make removal PAYG.  Lots of apps never need to
>> remove anything.
>
>Agreed, but I can’t think of a way to do this.

One way is to have assignable removeElement logic.
Another is to have a bead that overwrites UIBase.prototype.removeElement.
What won't work on SWF but will on JS.

>
>>> 4. Assuming #1 makes sense, it feels like there should be two separate
>>> events: One for single elements, and a second when all of them are
>>>added.
>>> It might make sense to keep childrenAdded for en mass (with no
>>>payload),
>>> and elementAdded when a single element is added and dispatch a
>>>valueEvent.
>> 
>> Yeah, or if the payload is null, assume it is an "en mass" event.
>
>That could also work. I’m not sure which way is easier to grok from a
>user perspective.

Not sure about usability, but it is probably less code to call
addEventListener once and check for null if you need to than call
addEventListener twice.
>
>>> 
>>> Some background on the bead I’m working on:
>>> I’m trying to create a ToggleButtonBar. The idea is to allow a
>>>container
>>> to accept ISelectable components which have a selected property and a
>>> bead will ensure that only a single ISelectable is selected at any one
>>> time. It’ll also keep track of the selected index. The only way I was
>>> able to figure out how to keep this generic and track the selected
>>>states
>>> of the components was to attach change listeners to each of them.
>> 
>> What is the difference between ToggleButtonBar and regular ButtonBar?
>> There are places where things that look and act like buttons aren't
>> actually buttons.  ButtonBarItemRenderers and some day,
>> CheckBoxItemRenderers are often better off not actually being based on
>> Buttons and CheckBoxes when they have to interact in a group setting.
>
>I’m trying to keep this really simple. ButtonBar extends List which
>requires dataProviders, ItemRendererers, etc. My approach is to allow
>adding any component which has a selected property to any container. The
>bead will handle correcting the selection of the unselected elements. I
>want to enable the following mxml:
>
> <js:HContainer>
>    <js:beads>
>        <js:SingleSelectionContainerBead/>
>    </js:beads>
>    <js:ToggleTextButton text="Fee"/>
>    <js:ToggleTextButton text="Fi"/>
>    <js:ToggleTextButton text="Fo"/>
>    <js:ToggleTextButton text="Fum"/>
> </js:HContainer>
>
>Those ToggleTextButtons could be RadioButtons, Checkboxes, etc.

We should make sure it works, but I would expect issues around focus,
keyboard selection and accessibility.  And also, how it upgrades to being
able to load the text labels from resources or a server and add or remove
buttons.

This sort of thing makes me wonder if there is some other item renderer
contract we should be offering instead.  IIRC, right now, the contract
dictates that the renderer must have a "data" property.  Maybe if there
was a contract where we could dictate the property to set you could just
drop in an existing component as a renderer.  There was a similar thing in
Flex.  It was a bit heavy, but maybe folks don't care.

Way back I pointed out that all components should be able to be expressed
as a UIBase or ContainerBase/GroupBase with a collection of beads.  It
would be interesting to see what the other List beads expect.  Right now a
factory watches a dataProvider and generates an item renderer for each
dataProvider item.  Hopefully the other beads don't care how the item
renderers appeared and can be repurposed to your pattern.  IOW, either you
specify a factory and an item renderer and a dataProvider or you supply a
set of children, but everything else should work.

Of course I could be wrong, but I'm packing it in for tonight, so I'll
find out in my morning.
-Alex
 


Re: MXMLDataInterpreter

Posted by Harbs <ha...@gmail.com>.
Responses inline:

> On Dec 6, 2017, at 7:07 AM, Alex Harui <ah...@adobe.com.INVALID> wrote:
> 
>> 3 There is no even being dispatched for removeElement. If I’m attaching
>> event listeners when they are added, I should be removing those listeners
>> when they are removed.
> 
> I'd like to find a way to make removal PAYG.  Lots of apps never need to
> remove anything.

Agreed, but I can’t think of a way to do this.

>> 4. Assuming #1 makes sense, it feels like there should be two separate
>> events: One for single elements, and a second when all of them are added.
>> It might make sense to keep childrenAdded for en mass (with no payload),
>> and elementAdded when a single element is added and dispatch a valueEvent.
> 
> Yeah, or if the payload is null, assume it is an "en mass" event.

That could also work. I’m not sure which way is easier to grok from a user perspective.

>> 
>> Some background on the bead I’m working on:
>> I’m trying to create a ToggleButtonBar. The idea is to allow a container
>> to accept ISelectable components which have a selected property and a
>> bead will ensure that only a single ISelectable is selected at any one
>> time. It’ll also keep track of the selected index. The only way I was
>> able to figure out how to keep this generic and track the selected states
>> of the components was to attach change listeners to each of them.
> 
> What is the difference between ToggleButtonBar and regular ButtonBar?
> There are places where things that look and act like buttons aren't
> actually buttons.  ButtonBarItemRenderers and some day,
> CheckBoxItemRenderers are often better off not actually being based on
> Buttons and CheckBoxes when they have to interact in a group setting.

I’m trying to keep this really simple. ButtonBar extends List which requires dataProviders, ItemRendererers, etc. My approach is to allow adding any component which has a selected property to any container. The bead will handle correcting the selection of the unselected elements. I want to enable the following mxml:

 <js:HContainer>
    <js:beads>
        <js:SingleSelectionContainerBead/>
    </js:beads>
    <js:ToggleTextButton text="Fee"/>
    <js:ToggleTextButton text="Fi"/>
    <js:ToggleTextButton text="Fo"/>
    <js:ToggleTextButton text="Fum"/>
 </js:HContainer>

Those ToggleTextButtons could be RadioButtons, Checkboxes, etc.


Re: MXMLDataInterpreter

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

On 12/5/17, 2:13 PM, "Harbs" <ha...@gmail.com> wrote:

>Thanks. This is exactly the info I needed.
>
>A few points:
>
>1. I think it’s useful for dispatch a ValueEvent with the element added
>as the payload. For my bead, I need to add an event listener to each of
>the children.

Yes, that makes sense.  The "rule" I would like to see for Royale is that
events do not have payloads that can be determined from examining the
dispatcher.  For sure, there is no way to know what element got removed by
examining the dispatcher, and probably no good way to determine who got
added.

>2. For some reason addElement is only being overriden in GroupBase and
>ContainerBase for SWF. It’s not dispatching the events for JS.

That's probably just a bug.  It looks like there is COMPILE::SWF in
ContainerBase.  Maybe that doesn't need to be there.

>3 There is no even being dispatched for removeElement. If I’m attaching
>event listeners when they are added, I should be removing those listeners
>when they are removed.

I'd like to find a way to make removal PAYG.  Lots of apps never need to
remove anything.

>4. Assuming #1 makes sense, it feels like there should be two separate
>events: One for single elements, and a second when all of them are added.
>It might make sense to keep childrenAdded for en mass (with no payload),
>and elementAdded when a single element is added and dispatch a valueEvent.

Yeah, or if the payload is null, assume it is an "en mass" event.
>
>Some background on the bead I’m working on:
>I’m trying to create a ToggleButtonBar. The idea is to allow a container
>to accept ISelectable components which have a selected property and a
>bead will ensure that only a single ISelectable is selected at any one
>time. It’ll also keep track of the selected index. The only way I was
>able to figure out how to keep this generic and track the selected states
>of the components was to attach change listeners to each of them.

What is the difference between ToggleButtonBar and regular ButtonBar?
There are places where things that look and act like buttons aren't
actually buttons.  ButtonBarItemRenderers and some day,
CheckBoxItemRenderers are often better off not actually being based on
Buttons and CheckBoxes when they have to interact in a group setting.

HTH,
-Alex
>
>Harbs
>> On Dec 5, 2017, at 9:08 PM, Alex Harui <ah...@adobe.com.INVALID> wrote:
>> 
>> The 'dispatchEvent' parameter is not used in UIBase, because, in theory,
>> at the low-level of simple controls, nobody needs to know if children
>>are
>> being added or removed dynamically.  The control author's code knows
>>when
>> it is going to add and remove elements and can update the rest of the
>> control then.
>> 
>> Because we don't really support method overloading, we chose to add a
>> 'dispatchEvent' parameter so that it could be overridden in
>>ContainerBase
>> and control whether an event is dispatched as a child element is added.
>> At MXMLDataInterpreter time, the belief is that it will never make sense
>> to run the kinds of code associated with child adding as an MXML
>>component
>> springs to life.  So further down in MXMLDataInterpreter is a call to
>> IContainer's childrenAdded() that signifies that all children specified
>>in
>> MXML have been added and now would be a good time to run layout and
>>other
>> things affected by child adding.
>> 
>> I see that ContainerBase dispatches a childrenAdded event.  If you want
>>to
>> rename that to elementAdded, that's fine with me.
>> 
>> HTH,
>> -Alex
>> 
>> On 12/5/17, 10:35 AM, "Harbs" <ha...@gmail.com> wrote:
>> 
>>> MXMLDataInterpreter has the following code:
>>> 
>>>           if (parent && comp is IChild)
>>>               parent.addElement(comp as IChild, !(parent is
>>> IContainer));
>>> 
>>> The boolean second value is the “dispatchEvent” parameter in the
>>>method.
>>> Currently, dispatchEvent does nothing (i.e. no event is dispatched in
>>> either case), but I am working on a bead which needs to listen for
>>> element added events. To wit, I added an “elementAdded” event which is
>>> dispatched when dispatchEvent is true.
>>> 
>>> I need the bead to be notified when elements are added via MXML in
>>> addition to AS code, but addElement is being called with dispatchEvent
>>>as
>>> false.
>>> 
>>> Any clues as to why this is and what will happen if I change this?
>>> 
>>> Harbs
>> 
>


Re: MXMLDataInterpreter

Posted by Harbs <ha...@gmail.com>.
Thanks. This is exactly the info I needed.

A few points:

1. I think it’s useful for dispatch a ValueEvent with the element added as the payload. For my bead, I need to add an event listener to each of the children.
2. For some reason addElement is only being overriden in GroupBase and ContainerBase for SWF. It’s not dispatching the events for JS.
3 There is no even being dispatched for removeElement. If I’m attaching event listeners when they are added, I should be removing those listeners when they are removed.
4. Assuming #1 makes sense, it feels like there should be two separate events: One for single elements, and a second when all of them are added. It might make sense to keep childrenAdded for en mass (with no payload), and elementAdded when a single element is added and dispatch a valueEvent.

Some background on the bead I’m working on:
I’m trying to create a ToggleButtonBar. The idea is to allow a container to accept ISelectable components which have a selected property and a bead will ensure that only a single ISelectable is selected at any one time. It’ll also keep track of the selected index. The only way I was able to figure out how to keep this generic and track the selected states of the components was to attach change listeners to each of them.

Harbs
> On Dec 5, 2017, at 9:08 PM, Alex Harui <ah...@adobe.com.INVALID> wrote:
> 
> The 'dispatchEvent' parameter is not used in UIBase, because, in theory,
> at the low-level of simple controls, nobody needs to know if children are
> being added or removed dynamically.  The control author's code knows when
> it is going to add and remove elements and can update the rest of the
> control then.
> 
> Because we don't really support method overloading, we chose to add a
> 'dispatchEvent' parameter so that it could be overridden in ContainerBase
> and control whether an event is dispatched as a child element is added.
> At MXMLDataInterpreter time, the belief is that it will never make sense
> to run the kinds of code associated with child adding as an MXML component
> springs to life.  So further down in MXMLDataInterpreter is a call to
> IContainer's childrenAdded() that signifies that all children specified in
> MXML have been added and now would be a good time to run layout and other
> things affected by child adding.
> 
> I see that ContainerBase dispatches a childrenAdded event.  If you want to
> rename that to elementAdded, that's fine with me.
> 
> HTH,
> -Alex
> 
> On 12/5/17, 10:35 AM, "Harbs" <ha...@gmail.com> wrote:
> 
>> MXMLDataInterpreter has the following code:
>> 
>>           if (parent && comp is IChild)
>>               parent.addElement(comp as IChild, !(parent is
>> IContainer));
>> 
>> The boolean second value is the “dispatchEvent” parameter in the method.
>> Currently, dispatchEvent does nothing (i.e. no event is dispatched in
>> either case), but I am working on a bead which needs to listen for
>> element added events. To wit, I added an “elementAdded” event which is
>> dispatched when dispatchEvent is true.
>> 
>> I need the bead to be notified when elements are added via MXML in
>> addition to AS code, but addElement is being called with dispatchEvent as
>> false.
>> 
>> Any clues as to why this is and what will happen if I change this?
>> 
>> Harbs
> 


Re: MXMLDataInterpreter

Posted by Alex Harui <ah...@adobe.com.INVALID>.
The 'dispatchEvent' parameter is not used in UIBase, because, in theory,
at the low-level of simple controls, nobody needs to know if children are
being added or removed dynamically.  The control author's code knows when
it is going to add and remove elements and can update the rest of the
control then.

Because we don't really support method overloading, we chose to add a
'dispatchEvent' parameter so that it could be overridden in ContainerBase
and control whether an event is dispatched as a child element is added.
At MXMLDataInterpreter time, the belief is that it will never make sense
to run the kinds of code associated with child adding as an MXML component
springs to life.  So further down in MXMLDataInterpreter is a call to
IContainer's childrenAdded() that signifies that all children specified in
MXML have been added and now would be a good time to run layout and other
things affected by child adding.

I see that ContainerBase dispatches a childrenAdded event.  If you want to
rename that to elementAdded, that's fine with me.

HTH,
-Alex

On 12/5/17, 10:35 AM, "Harbs" <ha...@gmail.com> wrote:

>MXMLDataInterpreter has the following code:
>
>            if (parent && comp is IChild)
>                parent.addElement(comp as IChild, !(parent is
>IContainer));
>
>The boolean second value is the “dispatchEvent” parameter in the method.
>Currently, dispatchEvent does nothing (i.e. no event is dispatched in
>either case), but I am working on a bead which needs to listen for
>element added events. To wit, I added an “elementAdded” event which is
>dispatched when dispatchEvent is true.
>
>I need the bead to be notified when elements are added via MXML in
>addition to AS code, but addElement is being called with dispatchEvent as
>false.
>
>Any clues as to why this is and what will happen if I change this?
>
>Harbs