I may have missed something, and DispatchChangeOnStartup is a proper bead, 
especially for a first attempt, but theoretically, it shouldn't be needed.

There are different categories of events in Flex and Royale.  I'm not sure 
there is a complete list of categories, but ones that pop to mind are:

1) Low-level interaction events
2) Higher-level interaction events
3) Binding events.

Things like mouseDown and mouseUp are low-level interaction events.  CLICK and 
CHANGE are higher-level interaction events.  They imply that some series of 
interactions occurred (CLICK= mouseDown+mouseUp).  ITEM_CLICK is even higher 
level, it implies that a click occurred on an ItemRenderer and not, say, the 
scrollbar button in a List.  Thus, writing code to dispatch CHANGE events 
outside of controller logic is roughly equivalent to faking mouse and keyboard 
events.  Sometimes you gotta do it, but usually it implies that something else 
isn't quite right.

Sometimes it helps to think about whether such a thing was needed in Flex and 
how similar setups worked there.  It could be Royale is missing something, or 
something isn't quite right yet.  In fact, the Royale binding system is trying 
to be less aggressive and thus have less overhead than Flex, but theoretically, 
the flow of binding events should propagate properly to all concerned, so it 
would be interesting to really understand why such a thing was needed.  Maybe 
something is truly only needed at startup, but often these things end up being 
needed elsewhere "later" like on state changes or module loads.

The binding system in Royale can handle multiple events.  Models are PAYG, so 
some models expect runtime changes and simpler ones don't to save on cost.  But 
for models that expect runtime changes (required for any model representing 
asynchronous data loading), the binding events should propagate appropriately.  
Flex used (or maybe overused) VALUE_COMMIT events.  We can do that, but right 
now the pattern is to make a unique event name.  So selectedIndex should 
dispatch selectedIndexChanged no matter how it got changed and that should 
propagate through other bindings.  When the dataProvider changes, if that 
affects the selectedIndex, then the model should set the selectedIndex and 
dispatch selectedIndexChanged.  There shouldn't be a need to dispatch "change" 
until someone interacts with the component.  Differentiating between the two 
usually helps make setup code simpler.  You can assign initial values to things 
without reacting everywhere to the change.

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


On 12/12/18, 10:55 AM, "Greg Dove" <greg.d...@gmail.com> wrote:

    I made changes to address some issues, but I no doubt used the wrong
    pattern, sorry guys.
    I have mainly focused on non-UI code in the past, or custom UI components
    without beads in some other work I did last year so 'beads' is still
    something I am getting used to (although composition in general is not).
    
    I never wrote any actual beads before DispatchChangeOnStartup, that was the
    first bead I ever wrote and may still not be 'right', it was a quick fix
    for a specific case and I did not have time to go back and review/refactor
    what I did elsewhere to get the lists working for programmatic changes.
    
    Piotr, thanks for looking into this. In terms of 'double dispatch' I also
    remember seeing somewhere that there are some overrides that dispatch
    events but call the super setter that also dispatches the same event. I did
    not have time to look into that in more detail. That could be in renderers
    with 'dataChange' iirc ... not related to what you are looking at, but that
    just made me think of it.
    
    I will be happy to look more into these things and contribute more to Jewel
    in time, when I also get some free time.
    
    
    
    
    On Thu, Dec 13, 2018 at 1:24 AM Piotr Zarzycki <piotrzarzyck...@gmail.com>
    wrote:
    
    > Yep - I just did quick look into the bead and it's essentially have those
    > things which are currently baked into Model. I hopefully remove that one
    > and replace things using bead in Jewel Example.
    >
    > Thanks for adding that!
    > Piotr
    >
    > śr., 12 gru 2018 o 13:04 Carlos Rovira <carlosrov...@apache.org>
    > napisał(a):
    >
    > > Hi Piotr,
    > >
    > > just migrated the bead I talked (DispatchChangeOnStartup) from our
    > project
    > > to royale so you can have all the pieces and help you to diagnose the
    > > problem
    > >
    > > As I said you Greg did the latest changes on this components so I should
    > as
    > > well read the changes since I didn't have to analyze since that was
    > working
    > > in our app in many parts flawlessly.
    > >
    > > thanks for taking care and good luck
    > >
    > > :)
    > >
    > > El mié., 12 dic. 2018 a las 10:55, Piotr Zarzycki (<
    > > piotrzarzyck...@gmail.com>) escribió:
    > >
    > > > Hi Carlos,
    > > >
    > > > Comments inline.
    > > >
    > > > śr., 12 gru 2018 o 10:44 Carlos Rovira <carlos.rov...@codeoscopic.com>
    > > > napisał(a):
    > > >
    > > > > Hi Piotr,
    > > > >
    > > > > This month Greg and I made some changes to get selectedIndex and
    > > > > selectedItem work in List, ComboBox and DropDownList. Since
    > Navigation
    > > > is a
    > > > > List in essence, is involved in this changes. We should see how to
    > > avoid
    > > > > the duplicated event without lost the current workflow that now is
    > > > working
    > > > > properly like it was in flex days. Was hard to reach to that point.
    > > > >
    > > > > About options, we already have a bead to dispatch a change event on
    > > > startup
    > > > > in our project that we must pass to Jewel library. But I think is 
not
    > > > what
    > > > > we want here. We want setting selectedIndex/selectedItem in mxml
    > should
    > > > put
    > > > > the component in proper state. I think that's what you refer when
    > talk
    > > > > about getting to work "programmatically" right?
    > > > >
    > > > >
    > > > *Generally yes those actions should put component in proper state, but
    > I
    > > > just feeling that those state should not be achieved through model
    > which
    > > > dispatch "change" event. "change" event is to tell user that someone
    > > > interact with component from UI. If developer interacting through code
    > > > selectedIndexChanged and selectedItemChanged should probably come with
    > > > help.*
    > > >
    > > >
    > > > > Basically I think we have all needed beads in place, So I'll try the
    > > > > removal option. But I think that event was copied from Basic 
version,
    > > so
    > > > > maybe is right (can ensure right now). You can try to do it 
yourself.
    > > You
    > > > > should check Jewel Example (Tour de Jewel) and specially List,
    > ComboBox
    > > > and
    > > > > DropDownList sections along Navigation (that is used in the drawer)
    > and
    > > > > check you don't see regressions when doing changes. See how the
    > > examples
    > > > > behave actually, and since debugger now works perfectly, you can put
    > > > break
    > > > > points to see where's the problem and how to diagnose the right
    > > solution.
    > > > >
    > > > >
    > > > *Yes ArrayListSelectionModel is essentially copy of Basic one, but you
    > > have
    > > > added there code which dispatch "change" event plus property which
    > > > generally allows you to do this or not
    > > (dispatchChangeOnDataProviderChange)
    > > > - That whole part even if should exists - should be probably exposed 
to
    > > > separate bead. *
    > > > *I'm surprised that you don't have any problems using in your
    > > applications
    > > > Bead for dispatch "change" event +  ListSingleSelectionMouseController
    > > (it
    > > > also dispatch that event) + model - All are able to dispatch change in
    > > > almost the same cases!*
    > > >
    > > > *Ok I think I will have to work on that with all cautious to current
    > > code.*
    > > >
    > > >
    > > > > Thanks! :)
    > > > >
    > > > >
    > > > >
    > > > >
    > > > > El mar., 11 dic. 2018 a las 23:49, Piotr Zarzycki (<
    > > > > piotrzarzyck...@gmail.com>) escribió:
    > > > >
    > > > > > Carlos,
    > > > > >
    > > > > > I just looked into the problem with double call of change event.
    > You
    > > > are
    > > > > > using as default ListSingleSelectionMouseController - in 
navigation
    > > > > > component which is calling "change" event once someone is clicking
    > on
    > > > > item.
    > > > > >
    > > > > > However you are doing it again from ArrayListSelectionModel which
    > > > > probably
    > > > > > shouldn't happen. This model is calling only selectedItemChanged,
    > > > > > *selectedIndexChanged. *
    > > > > >
    > > > > > I'm assuming you are calling "change" event in
    > > ArrayListSelectionModel
    > > > > > cause you wanted to know whether someone has changed selectedItem
    > and
    > > > > > selectedIndex programmatically . If that was the case you should
    > > > create a
    > > > > > bead which listening for events from model and react in specific
    > way.
    > > > > >
    > > > > > My proposition is:
    > > > > > 1) Remove call of change event from Jewel ArrayListSelectionModel
    > > > > > 2) Create a bead if you need for operation of programmatic change 
-
    > > in
    > > > > that
    > > > > > case do not use in parallel ListSingleSelectionMouseController
    > > > > >
    > > > > > Thoughts ?
    > > > > >
    > > > > > Thanks,
    > > > > > Piotr
    > > > > >
    > > > > > wt., 11 gru 2018 o 22:13 Carlos Rovira <carlosrov...@apache.org>
    > > > > > napisał(a):
    > > > > >
    > > > > > > Hi Piotr,
    > > > > > >
    > > > > > > but .nav will not do anything. As I write before the right 
things
    > > > > should
    > > > > > be
    > > > > > >
    > > > > > > .jewel.navigation
    > > > > > > background-color: transparent
    > > > > > >
    > > > > > > This in you App css will win over the one in the theme.
    > > > > > >
    > > > > > > Didn't try, but that should work, at least is what I do when I
    > want
    > > > > some
    > > > > > > quick change to try or something temporal, or even could be a
    > final
    > > > > > change
    > > > > > > too depending on the case.
    > > > > > >
    > > > > > >
    > > > > > > El mar., 11 dic. 2018 a las 22:04, Piotr Zarzycki (<
    > > > > > > piotrzarzyck...@gmail.com>) escribió:
    > > > > > >
    > > > > > > > I have tried to do point #2 from your options, but when I
    > declare
    > > > my
    > > > > > own
    > > > > > > > class:
    > > > > > > >
    > > > > > > > .nav {
    > > > > > > > background-color: #ffffff
    > > > > > > > }
    > > > > > > >
    > > > > > > > It's being override by those one from framework. Maybe I have
    > to
    > > > > > > inherited
    > > > > > > > from framework classes ?
    > > > > > > >
    > > > > > > > Thanks, Piotr
    > > > > > > >
    > > > > > > > wt., 11 gru 2018 o 20:44 Carlos Rovira <
    > carlosrov...@apache.org>
    > > > > > > > napisał(a):
    > > > > > > >
    > > > > > > > > Hi Piotr,
    > > > > > > > >
    > > > > > > > > El mar., 11 dic. 2018 a las 17:37, Piotr Zarzycki (<
    > > > > > > > > piotrzarzyck...@gmail.com>) escribió:
    > > > > > > > >
    > > > > > > > > > Hi Carlos,
    > > > > > > > > >
    > > > > > > > > > I have started playing using Jewel lately more serious and
    > > have
    > > > > two
    > > > > > > > > > questions related to Jewel Navigation component.
    > > > > > > > > >
    > > > > > > > > > I'm displaying horizontal navigation like that [1]. 
Because
    > > > > > > Navigation
    > > > > > > > is
    > > > > > > > > > actually list my background color is white. The question 
is
    > > how
    > > > > to
    > > > > > > make
    > > > > > > > > my
    > > > > > > > > > navigation transparent component transparent? I know that 
I
    > > > could
    > > > > > > make
    > > > > > > > > some
    > > > > > > > > > css trick, but maybe you have a better solution.
    > > > > > > > > >
    > > > > > > > > >
    > > > > > > > > each component use to have a css in Jewel and other one in
    > > > > JewelTheme
    > > > > > > > (95%
    > > > > > > > > of cases)
    > > > > > > > > I still need to write some wiki for all of this
    > > > > > > > > In the meanwhile, search for file "_navigation.sass". The 
one
    > > in
    > > > > > Jewel
    > > > > > > > has
    > > > > > > > > definitions for beads and use to have some
    > > > > > > > > standard css for things regarding "structure"
    > > > > > > > > in the _navigation.sass in JewelTheme instead you'll not 
find
    > > > > almost
    > > > > > > any
    > > > > > > > > Royale bead, and css more related to colors, animations,
    > fonts,
    > > > > > sizes,
    > > > > > > > > ....so more "theme" things that people would want to change.
    > > > > > > > >
    > > > > > > > > There you'll find
    > > > > > > > >
    > > > > > > > > // Navigation variables
    > > > > > > > > .jewel.navigation
    > > > > > > > > background-color: #ffffff
    > > > > > > > >
    > > > > > > > > So, you can do in many ways:
    > > > > > > > >
    > > > > > > > > 1) Create your own theme with the same structure as
    > JewelTheme
    > > > and
    > > > > > just
    > > > > > > > > change this navigation thing
    > > > > > > > > 2) just do in your app in you css, since that will be taken
    > > > instead
    > > > > > the
    > > > > > > > > JewelTheme
    > > > > > > > >
    > > > > > > > > Notice that this will change when we implement full dark
    > mode,
    > > > that
    > > > > > > > > navigation still doesn't support since
    > > > > > > > > that component was made after I make dark mode and still
    > don't
    > > > have
    > > > > > > that
    > > > > > > > > implemented in SASS so
    > > > > > > > > compiling SASS will generate a light/dark theme and/or
    > > > flat/noflat
    > > > > > > theme
    > > > > > > > >
    > > > > > > > > Another question is - Did you notice that Navigation
    > component
    > > > fire
    > > > > > > > change
    > > > > > > > > > event two times - whenever you click on the item ?
    > > > > > > > > >
    > > > > > > > > >
    > > > > > > > > Thanks for reporting, I didn't notice, please feel free to
    > fix
    > > > > that,
    > > > > > > just
    > > > > > > > > take into account that navigation renderer preventdefault to
    > > > avoid
    > > > > > > trying
    > > > > > > > > to open a web page. I see this in the way google material
    > > solved
    > > > > > > > navigation
    > > > > > > > > things
    > > > > > > > > but maybe could be a better way to do it
    > > > > > > > >
    > > > > > > > > Thanks!
    > > > > > > > >
    > > > > > > > > Carlos
    > > > > > > > >
    > > > > > > > >
    > > > > > > > >
    > > > > > > > > --
    > > > > > > > > Carlos Rovira
    > > > > > > > > 
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2Fcarlosrovira&amp;data=02%7C01%7Caharui%40adobe.com%7C41ccecc7e9264ec2c96208d660636413%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636802377327546488&amp;sdata=e2ZQbKg%2FXUEIWAlQw9ETRBUg848T9WuhCablQtswPpE%3D&amp;reserved=0
    > > > > > > > >
    > > > > > > >
    > > > > > > >
    > > > > > > > --
    > > > > > > >
    > > > > > > > Piotr Zarzycki
    > > > > > > >
    > > > > > > > Patreon: 
*https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patreon.com%2Fpiotrzarzycki&amp;data=02%7C01%7Caharui%40adobe.com%7C41ccecc7e9264ec2c96208d660636413%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636802377327546488&amp;sdata=H2nrXZb0wrgl1L7j1ueTDvDRlhrGYz6MVLyTW6Yy3SI%3D&amp;reserved=0
    > > > > > > > 
<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patreon.com%2Fpiotrzarzycki&amp;data=02%7C01%7Caharui%40adobe.com%7C41ccecc7e9264ec2c96208d660636413%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636802377327546488&amp;sdata=H2nrXZb0wrgl1L7j1ueTDvDRlhrGYz6MVLyTW6Yy3SI%3D&amp;reserved=0>*
    > > > > > > >
    > > > > > >
    > > > > > >
    > > > > > > --
    > > > > > > Carlos Rovira
    > > > > > > 
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2Fcarlosrovira&amp;data=02%7C01%7Caharui%40adobe.com%7C41ccecc7e9264ec2c96208d660636413%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636802377327546488&amp;sdata=e2ZQbKg%2FXUEIWAlQw9ETRBUg848T9WuhCablQtswPpE%3D&amp;reserved=0
    > > > > > >
    > > > > >
    > > > > >
    > > > > > --
    > > > > >
    > > > > > Piotr Zarzycki
    > > > > >
    > > > > > Patreon: 
*https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patreon.com%2Fpiotrzarzycki&amp;data=02%7C01%7Caharui%40adobe.com%7C41ccecc7e9264ec2c96208d660636413%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636802377327546488&amp;sdata=H2nrXZb0wrgl1L7j1ueTDvDRlhrGYz6MVLyTW6Yy3SI%3D&amp;reserved=0
    > > > > > 
<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patreon.com%2Fpiotrzarzycki&amp;data=02%7C01%7Caharui%40adobe.com%7C41ccecc7e9264ec2c96208d660636413%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636802377327546488&amp;sdata=H2nrXZb0wrgl1L7j1ueTDvDRlhrGYz6MVLyTW6Yy3SI%3D&amp;reserved=0>*
    > > > > >
    > > > >
    > > > >
    > > > > --
    > > > >
    > > > > 
<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.codeoscopic.com&amp;data=02%7C01%7Caharui%40adobe.com%7C41ccecc7e9264ec2c96208d660636413%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636802377327546488&amp;sdata=eOroBUQP4blbUxXbxFazya1rs82Cz7cxJFmVEzoU7uw%3D&amp;reserved=0>
    > > > >
    > > > > Carlos Rovira
    > > > >
    > > > > Presidente Ejecutivo
    > > > >
    > > > > M: +34 607 22 60 05
    > > > >
    > > > > 
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.codeoscopic.com&amp;data=02%7C01%7Caharui%40adobe.com%7C41ccecc7e9264ec2c96208d660636413%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636802377327546488&amp;sdata=eOroBUQP4blbUxXbxFazya1rs82Cz7cxJFmVEzoU7uw%3D&amp;reserved=0
    > > > >
    > > > >
    > > > > Conócenos en 1 minuto! 
<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Favant2.es%2F%23video&amp;data=02%7C01%7Caharui%40adobe.com%7C41ccecc7e9264ec2c96208d660636413%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636802377327546488&amp;sdata=LGfF9Q0nxjkPpihQ1oO4qxE%2FwCL6Yzzg2fFyU%2FusKD8%3D&amp;reserved=0>
    > > > >
    > > > >
    > > > > AVISO LEGAL: La información contenida en este correo electrónico, y
    > en
    > > su
    > > > > caso en los documentos adjuntos, es información privilegiada para 
uso
    > > > > exclusivo de la persona y/o personas a las que va dirigido. No está
    > > > > permitido el acceso a este mensaje a cualquier otra persona distinta
    > a
    > > > los
    > > > > indicados. Si Usted no es uno de los destinatarios, cualquier
    > > > duplicación,
    > > > > reproducción, distribución, así como cualquier uso de la información
    > > > > contenida en él o cualquiera otra acción u omisión tomada en 
relación
    > > con
    > > > > el mismo, está prohibida y puede ser ilegal. En dicho caso, por
    > favor,
    > > > > notifíquelo al remitente y proceda a la eliminación de este correo
    > > > > electrónico, así como de sus adjuntos si los hubiere. En 
cumplimiento
    > > de
    > > > la
    > > > > legislación española vigente en materia de protección de datos de
    > > > carácter
    > > > > personal y del RGPD 679/2016 le informamos que sus datos están 
siendo
    > > > > objeto de tratamiento por parte de CODEOSCOPIC S.A. con 
CIFA85677342,
    > > con
    > > > > la finalidad del mantenimiento y gestión de relaciones comerciales y
    > > > > administrativas. La base jurídica del tratamiento es el interés
    > > legítimo
    > > > de
    > > > > la empresa. No se prevén cesiones de sus datos, salvo que exista una
    > > > > obligación legal. Para ejercitar sus derechos puede dirigirse a
    > > > CODEOSCOPIC
    > > > > S.A., domiciliada enPaseo de la Habana, 9-11, 28036 de Madrid
    > > (MADRID), o
    > > > > bien por email a...@codeoscopic.com, con el fin de ejercer sus
    > > derechos
    > > > de
    > > > > acceso, rectificación, supresión (derecho al olvido), limitación de
    > > > > tratamiento, portabilidad de los datos, oposición, y a no ser objeto
    > de
    > > > > decisiones automatizadas, indicando como Asunto: “Derechos Ley
    > > Protección
    > > > > de Datos”, y adjuntando fotocopia de su DNI. Delegado de protección
    > de
    > > > > datos:d...@codeoscopic.com
    > > > >
    > > >
    > > >
    > > > --
    > > >
    > > > Piotr Zarzycki
    > > >
    > > > Patreon: 
*https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patreon.com%2Fpiotrzarzycki&amp;data=02%7C01%7Caharui%40adobe.com%7C41ccecc7e9264ec2c96208d660636413%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636802377327546488&amp;sdata=H2nrXZb0wrgl1L7j1ueTDvDRlhrGYz6MVLyTW6Yy3SI%3D&amp;reserved=0
    > > > 
<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patreon.com%2Fpiotrzarzycki&amp;data=02%7C01%7Caharui%40adobe.com%7C41ccecc7e9264ec2c96208d660636413%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636802377327546488&amp;sdata=H2nrXZb0wrgl1L7j1ueTDvDRlhrGYz6MVLyTW6Yy3SI%3D&amp;reserved=0>*
    > > >
    > >
    > >
    > > --
    > > Carlos Rovira
    > > 
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2Fcarlosrovira&amp;data=02%7C01%7Caharui%40adobe.com%7C41ccecc7e9264ec2c96208d660636413%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636802377327546488&amp;sdata=e2ZQbKg%2FXUEIWAlQw9ETRBUg848T9WuhCablQtswPpE%3D&amp;reserved=0
    > >
    >
    >
    > --
    >
    > Piotr Zarzycki
    >
    > Patreon: 
*https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patreon.com%2Fpiotrzarzycki&amp;data=02%7C01%7Caharui%40adobe.com%7C41ccecc7e9264ec2c96208d660636413%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636802377327546488&amp;sdata=H2nrXZb0wrgl1L7j1ueTDvDRlhrGYz6MVLyTW6Yy3SI%3D&amp;reserved=0
    > 
<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patreon.com%2Fpiotrzarzycki&amp;data=02%7C01%7Caharui%40adobe.com%7C41ccecc7e9264ec2c96208d660636413%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636802377327546488&amp;sdata=H2nrXZb0wrgl1L7j1ueTDvDRlhrGYz6MVLyTW6Yy3SI%3D&amp;reserved=0>*
    >
    

Reply via email to