Hi Carlos,

Great news :)

Makes sense what you say.
The difficult part is to decide what is used all the time to be part of the
component and what is accessory to be built as a bead.


In that case I don't think we need to add that API in front of DataGrid,
since the dataProvider is something managed internally. We can always add a
bead (like the one you did) to do something similar. In Fact, it is part of
what you did in this concrete bead, so that shows that adding that king of
APIs is not what we try to do. That was one of the Flex problems, that the
components was very bloated with code for many side cases.
APIs in components should have what's really important and always used and
then left other things that "could be used" for beads.
Being said that, I don't try to be PAYG in a "nonsense way", and always try
to ponder if the APIs will be used a lot or just sporadically.



Carlos Rovira <carlosrov...@apache.org> escreveu no dia sexta, 11/09/2020
à(s) 16:57:

> Hi Hugo,
>
> just merged the PR :)
>
> going to try and see if what I had in mind made sense.
> About refreshing: In Royale PAYG is what rules all the framework and we try
> to keep things as simple as possible.
> In that case I don't think we need to add that API in front of DataGrid,
> since the dataProvider is something managed internally. We can always add a
> bead (like the one you did) to do something similar. In Fact, it is part of
> what you did in this concrete bead, so that shows that adding that king of
> APIs is not what we try to do. That was one of the Flex problems, that the
> components was very bloated with code for many side cases.
> APIs in components should have what's really important and always used and
> then left other things that "could be used" for beads.
> Being said that, I don't try to be PAYG in a "nonsense way", and always try
> to ponder if the APIs will be used a lot or just sporadically.
>
> Thanks
>
> El vie., 11 sept. 2020 a las 10:54, Hugo Ferreira (<hferreira...@gmail.com
> >)
> escribió:
>
> > Hi Carlos,
> >
> > In Royale and DataGrid Jewel world (and you know much better than me), to
> > refresh the DataGrid one needs to set the dataProvider to null and then
> > reassign the dataProvider.
> > I know that because I already saw before somewhere in the framework so I
> > predict that is currently the "normal" behaviour.
> >
> > Thinking about that, I think that it should be nice that the DataGrid
> has a
> > refresh method that internally sets the dataProvider to a variable,
> > dataProvider to null and assign the dataProvider from the variable.
> > If we find a better solution we just need to change one place.
> >
> > When I need to refresh the DataGrid, I just need to call
> > myDataGrid.refresh() without knowing what's the current implementation of
> > it.
> >
> >
> > Carlos Rovira <carlosrov...@apache.org> escreveu no dia sexta,
> 11/09/2020
> > à(s) 09:45:
> >
> > > Hi Hugo,
> > >
> > > about your PR, I was trying to ask you about these lines of code and
> what
> > > reason made you choose to code it that way.
> > > I can merge it as is and see if I can improve that refresh and
> > dataprovider
> > > reassign, but the objective is that you see if you can improve and/or I
> > > understand if there's some issue in the underlying infrastructure, and
> > help
> > > you to improve your knowledge.
> > >
> > >
> > > El jue., 10 sept. 2020 a las 17:35, Hugo Ferreira (<
> > hferreira...@gmail.com
> > > >)
> > > escribió:
> > >
> > > > Hi Carlos,
> > > >
> > > > I don't see your comment in PR !
> > > >
> > > > Carlos Rovira <carlosrov...@apache.org> escreveu no dia quinta,
> > > 10/09/2020
> > > > à(s) 16:24:
> > > >
> > > > > Hi Hugo,
> > > > >
> > > > > maybe you didn't notice but I commented in your PR :)
> > > > >
> > > > > https://github.com/apache/royale-asjs/pull/908
> > > > >
> > > > >
> > > > > El jue., 10 sept. 2020 a las 13:26, Hugo Ferreira (<
> > > > hferreira...@gmail.com
> > > > > >)
> > > > > escribió:
> > > > >
> > > > > > Thank you.
> > > > > > As I progress on my development and face other missing pices
> that I
> > > > need
> > > > > I
> > > > > > will do the same, now that I know who works a bead and how to
> build
> > > > one.
> > > > > >
> > > > > > Carlos Rovira <carlosrov...@apache.org> escreveu no dia quinta,
> > > > > 10/09/2020
> > > > > > à(s) 11:47:
> > > > > >
> > > > > > > Thanks for the PR Hugo. Good one for your first! :)
> > > > > > > I started a review and commented on some things there.
> > > > > > > We also have a rule to wait 24h at least for others to review
> and
> > > for
> > > > > any
> > > > > > > comment or issue we can notice
> > > > > > > thanks
> > > > > > >
> > > > > > > El jue., 10 sept. 2020 a las 11:18, Hugo Ferreira (<
> > > > > > hferreira...@gmail.com
> > > > > > > >)
> > > > > > > escribió:
> > > > > > >
> > > > > > > > Hi Carlos,
> > > > > > > >
> > > > > > > > Done.
> > > > > > > >
> > > > > > > > Carlos Rovira <carlosrov...@apache.org> escreveu no dia
> > quinta,
> > > > > > > 10/09/2020
> > > > > > > > à(s) 08:58:
> > > > > > > >
> > > > > > > > > Hi Hugo,
> > > > > > > > >
> > > > > > > > > could you please create a PR (Pull Request)?
> > > > > > > > > That way we get better with how Apache works and you get
> > > credits
> > > > > for
> > > > > > > your
> > > > > > > > > work, Royale gets better collaboration numbers and the
> > process
> > > is
> > > > > in
> > > > > > > > > general better to track if you continue contributing in the
> > > > future
> > > > > > > (what
> > > > > > > > I
> > > > > > > > > expect). Also, doing good contributions, having a good
> > > knowledge
> > > > of
> > > > > > > > Royale
> > > > > > > > > and aligning with community guidelines of respect and
> > teamwork
> > > > > could
> > > > > > > make
> > > > > > > > > you eligible to be a committer in the future and add this
> > > > directly.
> > > > > > > > >
> > > > > > > > > Thanks!
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > El jue., 10 sept. 2020 a las 1:01, Hugo Ferreira (<
> > > > > > > > hferreira...@gmail.com
> > > > > > > > > >)
> > > > > > > > > escribió:
> > > > > > > > >
> > > > > > > > > > Hi Carlos,
> > > > > > > > > >
> > > > > > > > > > Here the full class source code.
> > > > > > > > > > Tested and working.
> > > > > > > > > > You can add to Royale source code tree.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> ////////////////////////////////////////////////////////////////////////////////
> > > > > > > > > > //
> > > > > > > > > > // 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.royale.jewel.beads.controls.datagrid
> > > > > > > > > > {
> > > > > > > > > > import org.apache.royale.core.IBead;
> > > > > > > > > > import org.apache.royale.jewel.DataGrid;
> > > > > > > > > > import org.apache.royale.core.IStrand;
> > > > > > > > > > import org.apache.royale.jewel.beads.views.DataGridView;
> > > > > > > > > > import org.apache.royale.events.MouseEvent;
> > > > > > > > > > import
> > > > > > > >
> > > org.apache.royale.jewel.supportClasses.datagrid.DataGridButtonBar;
> > > > > > > > > > import org.apache.royale.collections.Sort;
> > > > > > > > > > import org.apache.royale.collections.SortField;
> > > > > > > > > > import org.apache.royale.collections.IArrayListView;
> > > > > > > > > > import
> > > > > > > org.apache.royale.jewel.supportClasses.datagrid.DataGridColumn;
> > > > > > > > > >
> > > > > > > > > > public class DataGridSortBead implements IBead
> > > > > > > > > > {
> > > > > > > > > > public function DataGridSortBead()
> > > > > > > > > > {
> > > > > > > > > > super();
> > > > > > > > > > }
> > > > > > > > > > private var dg:DataGrid;
> > > > > > > > > >
> > > > > > > > > > private var descending:Boolean;
> > > > > > > > > > /**
> > > > > > > > > > * @copy org.apache.royale.core.IBead#strand
> > > > > > > > > > *
> > > > > > > > > > * @langversion 3.0
> > > > > > > > > > * @playerversion Flash 10.2
> > > > > > > > > > * @playerversion AIR 2.6
> > > > > > > > > > * @productversion Royale 0.0
> > > > > > > > > > */
> > > > > > > > > > public function set strand(value:IStrand):void
> > > > > > > > > > {
> > > > > > > > > > dg = value as DataGrid;
> > > > > > > > > > (dg.view as
> > > > > DataGridView).header.addEventListener(MouseEvent.CLICK,
> > > > > > > > > > mouseClickHandler, false);
> > > > > > > > > > }
> > > > > > > > > > /**
> > > > > > > > > > * @private
> > > > > > > > > > */
> > > > > > > > > > private function mouseClickHandler(event:MouseEvent):void
> > > > > > > > > > {
> > > > > > > > > > var dgView:DataGridView = dg.view as DataGridView;
> > > > > > > > > > var buttonBar:DataGridButtonBar = (dgView.header as
> > > > > > > DataGridButtonBar);
> > > > > > > > > > // probably down on one button and up on another button
> > > > > > > > > > // so the ButtonBar won't change selection
> > > > > > > > > > if (event.target == buttonBar) return;
> > > > > > > > > > var column:DataGridColumn = event.target.data as
> > > > DataGridColumn;
> > > > > > > > > > var collection:IArrayListView = dg.dataProvider as
> > > > > IArrayListView;
> > > > > > > > > > if (collection && collection.length)
> > > > > > > > > > {
> > > > > > > > > > if (collection.sort && collection.sort.fields[0].name ==
> > > > > > > > > column.dataField)
> > > > > > > > > > descending = !descending;
> > > > > > > > > >
> > > > > > > > > > var sort:Sort = new Sort();
> > > > > > > > > > var sortField:SortField = new SortField(column.dataField,
> > > > false,
> > > > > > > > > > descending);
> > > > > > > > > >
> > > > > > > > > > sort.fields = [ sortField ];
> > > > > > > > > > collection.sort = sort;
> > > > > > > > > >
> > > > > > > > > > (dgView.header as
> > DataGridButtonBar).model.dispatchEvent(new
> > > > > Event(
> > > > > > > > > > "dataProviderChanged"));
> > > > > > > > > >
> > > > > > > > > > // force redraw of column headers
> > > > > > > > > > collection.refresh();
> > > > > > > > > > dg.dataProvider = null;
> > > > > > > > > > dg.dataProvider = collection;
> > > > > > > > > > }
> > > > > > > > > > }
> > > > > > > > > > }
> > > > > > > > > > }
> > > > > > > > > >
> > > > > > > > > > Hugo Ferreira <hferreira...@gmail.com> escreveu no dia
> > > quarta,
> > > > > > > > 9/09/2020
> > > > > > > > > > à(s) 14:19:
> > > > > > > > > >
> > > > > > > > > > > OK, thank you for the tips.
> > > > > > > > > > > I will try to it :)
> > > > > > > > > > >
> > > > > > > > > > > Carlos Rovira <carlosrov...@apache.org> escreveu no
> dia
> > > > > quarta,
> > > > > > > > > > 9/09/2020
> > > > > > > > > > > à(s) 14:15:
> > > > > > > > > > >
> > > > > > > > > > >> Hi Hugo,
> > > > > > > > > > >>
> > > > > > > > > > >> some helpers:
> > > > > > > > > > >>
> > > > > > > > > > >> 1.- You can create a "DataGridSortBead" class in jewel
> > > > > library.
> > > > > > > > > package
> > > > > > > > > > >> should be:
> > org.apache.royale.jewel.beads.controls.datagrid
> > > > > > > > > > >> 2.- add to jewel-manifest.xml
> > > > > > > > > > >> 3.- code will be similar to the MXRoyale version.
> > > > > > > > > > >>     a) in the strand method override you retrieve the
> > bead
> > > > > view
> > > > > > > > > > >> (DataGridView)
> > > > > > > > > > >>     b) you create a listener for MouseEvent.CLICK
> > > > > > > > > > >>
> > > > > > > > > > >> (at that time if you put a trace in that handler you
> > > should
> > > > > see
> > > > > > > the
> > > > > > > > > > traces
> > > > > > > > > > >> as you click a button in the button bar)
> > > > > > > > > > >>
> > > > > > > > > > >>      c) Finally you implement the sorting. That should
> > be
> > > > very
> > > > > > > > similar
> > > > > > > > > > to
> > > > > > > > > > >> MXRoyale code just taking into account that Jewel uses
> > > > > ArrayList
> > > > > > > and
> > > > > > > > > > >> ArrayListView for sorting.
> > > > > > > > > > >>
> > > > > > > > > > >> I think these are the main puzzle's pieces if you want
> > to
> > > > try
> > > > > > it.
> > > > > > > > > > >>
> > > > > > > > > > >>
> > > > > > > > > > >>
> > > > > > > > > > >> El mié., 9 sept. 2020 a las 14:58, Hugo Ferreira (<
> > > > > > > > > > hferreira...@gmail.com
> > > > > > > > > > >> >)
> > > > > > > > > > >> escribió:
> > > > > > > > > > >>
> > > > > > > > > > >> > "Now that you have a bit more experience"
> > > > > > > > > > >> > Comparing to Flex, not so much.
> > > > > > > > > > >> >
> > > > > > > > > > >> > "what do you think about trying to create a Jewel
> > > version
> > > > of
> > > > > > > > > > >> > "DataGridSortBead""
> > > > > > > > > > >> > I think that I'm still very new to Royale and I
> never
> > > > tried
> > > > > to
> > > > > > > > > create
> > > > > > > > > > a
> > > > > > > > > > >> > bead but I can try and check other bead to chek how
> to
> > > > > > implement
> > > > > > > > > one.
> > > > > > > > > > If
> > > > > > > > > > >> > sucessed I will post here the source so any of you
> > guys
> > > > can
> > > > > > add
> > > > > > > to
> > > > > > > > > > >> source
> > > > > > > > > > >> > tree.
> > > > > > > > > > >> >
> > > > > > > > > > >> > Carlos Rovira <carlosrov...@apache.org> escreveu no
> > dia
> > > > > > quarta,
> > > > > > > > > > >> 9/09/2020
> > > > > > > > > > >> > à(s) 13:42:
> > > > > > > > > > >> >
> > > > > > > > > > >> > > Hi Hugo,
> > > > > > > > > > >> > >
> > > > > > > > > > >> > > Sorting in Jewel is still not implemented sorry.
> > > > > > > > > > >> > > 'DataGridSortBead' is a bead from emulation
> library,
> > > so
> > > > it
> > > > > > > will
> > > > > > > > > not
> > > > > > > > > > >> work
> > > > > > > > > > >> > > with Jewel.
> > > > > > > > > > >> > >
> > > > > > > > > > >> > > Now that you have a bit more experience with
> Royale
> > > and
> > > > > > Jewel,
> > > > > > > > > what
> > > > > > > > > > do
> > > > > > > > > > >> > you
> > > > > > > > > > >> > > think about trying to create a Jewel version of
> > > > > > > > "DataGridSortBead"
> > > > > > > > > > and
> > > > > > > > > > >> > > submit for review as PR? I think we need folks
> like
> > > you
> > > > > > trying
> > > > > > > > to
> > > > > > > > > > take
> > > > > > > > > > >> > over
> > > > > > > > > > >> > > Royale and join us helping where is possible. What
> > do
> > > > you
> > > > > > > think?
> > > > > > > > > > >> > >
> > > > > > > > > > >> > > Thanks
> > > > > > > > > > >> > >
> > > > > > > > > > >> > > El mié., 9 sept. 2020 a las 11:07, Hugo Ferreira
> (<
> > > > > > > > > > >> > hferreira...@gmail.com
> > > > > > > > > > >> > > >)
> > > > > > > > > > >> > > escribió:
> > > > > > > > > > >> > >
> > > > > > > > > > >> > > > Hello,
> > > > > > > > > > >> > > >
> > > > > > > > > > >> > > > I have a Jewel DataGrid.
> > > > > > > > > > >> > > > I see that Jewel DataGrid uses a button in
> header,
> > > > > > obviously
> > > > > > > > for
> > > > > > > > > > >> > sorting.
> > > > > > > > > > >> > > > Clicking nothing happens.
> > > > > > > > > > >> > > > Once almost every property is added thru beads,
> I
> > > > > searched
> > > > > > > and
> > > > > > > > > > found
> > > > > > > > > > >> > this
> > > > > > > > > > >> > > > bead: DataGridSortBead but after I added it the
> > > > DataGrid
> > > > > > > shows
> > > > > > > > > > empty
> > > > > > > > > > >> > > > without any error in console.
> > > > > > > > > > >> > > >
> > > > > > > > > > >> > > > What I'm doing wrong here ?
> > > > > > > > > > >> > > >
> > > > > > > > > > >> > >
> > > > > > > > > > >> > >
> > > > > > > > > > >> > > --
> > > > > > > > > > >> > > Carlos Rovira
> > > > > > > > > > >> > > http://about.me/carlosrovira
> > > > > > > > > > >> > >
> > > > > > > > > > >> >
> > > > > > > > > > >>
> > > > > > > > > > >>
> > > > > > > > > > >> --
> > > > > > > > > > >> Carlos Rovira
> > > > > > > > > > >> http://about.me/carlosrovira
> > > > > > > > > > >>
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > Carlos Rovira
> > > > > > > > > http://about.me/carlosrovira
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > Carlos Rovira
> > > > > > > http://about.me/carlosrovira
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Carlos Rovira
> > > > > http://about.me/carlosrovira
> > > > >
> > > >
> > >
> > >
> > > --
> > > Carlos Rovira
> > > http://about.me/carlosrovira
> > >
> >
>
>
> --
> Carlos Rovira
> http://about.me/carlosrovira
>

Reply via email to