Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refreshing a full subtree of a node in TreeGrid (hierarchical data providers) #6202

Merged
merged 2 commits into from
Aug 16, 2019

Conversation

wfischlein
Copy link
Contributor

@wfischlein wfischlein commented Aug 8, 2019

This is the flow part for fixing https://vaadin.com/pro/support#3047


This change is Reviewable

@project-bot project-bot bot added this to Review in progress in OLD Vaadin Flow ongoing work (Vaadin 10+) Aug 8, 2019
@CLAassistant
Copy link

CLAassistant commented Aug 8, 2019

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

@caalador caalador left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLA is not signed.

Reviewed 5 of 5 files at r1.
Reviewable status: 9 unresolved discussions, 0 of 1 LGTMs obtained (waiting on @wfischlein)


flow-data/src/main/java/com/vaadin/flow/data/provider/AbstractDataProvider.java, line 63 at r1 (raw file):

, false

This doesn't need adding as the default is false.


flow-data/src/main/java/com/vaadin/flow/data/provider/DataChangeEvent.java, line 44 at r1 (raw file):

deep

Should it be refreshAll, fullRefreshor other descriptive name asdeep` doesn't tell that much of what it will do. (name should be updated to all instances)


flow-data/src/main/java/com/vaadin/flow/data/provider/DataChangeEvent.java, line 86 at r1 (raw file):

        }

        /**

Missing javadoc.


flow-data/src/main/java/com/vaadin/flow/data/provider/DataCommunicator.java, line 396 at r1 (raw file):

handleDataRefreshEvent((DataRefreshEvent<T>) event);

Not needed and if wanting to clear it I would suggest to pick out the item as a variable e.g.

T item = ((DataRefreshEvent<T>) event).getItem();
refresh(item);

or

DataRefreshEvent<T> refreshEvent = (DataRefreshEvent<T>) event;
refresh(refreshEvent.getItem());

flow-data/src/main/java/com/vaadin/flow/data/provider/DataProvider.java, line 123 at r1 (raw file):

     *            whether or not to refresh child items
     */
    default void refreshItem(T item, boolean deep) {

Shouldn't this be the other way around that refreshItem(item) is the default that calls the boolean version which is required to implement?

Also do we need a default as AbstractDataProvider implements these methods?


flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HierarchicalDataCommunicator.java, line 164 at r1 (raw file):

    }

    protected void handleDataRefreshEvent(DataChangeEvent.DataRefreshEvent<T> event) {

add @Override


flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HierarchicalDataCommunicator.java, line 171 at r1 (raw file):

setParentRequestedRange(0, 50, item);

Why 50?
shouldn't it be setParentRequestedRange(0, countChildItems(item), item) to refresh all even if over 50?

Copy link
Contributor

@caalador caalador left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also a test for refershing with and without deep would be needed.

Reviewable status: 9 unresolved discussions, 0 of 1 LGTMs obtained (waiting on @wfischlein)

Copy link
Contributor Author

@wfischlein wfischlein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 9 unresolved discussions, 0 of 1 LGTMs obtained (waiting on @caalador and @wfischlein)


flow-data/src/main/java/com/vaadin/flow/data/provider/DataChangeEvent.java, line 44 at r1 (raw file):

Previously, caalador wrote…
deep

Should it be refreshAll, fullRefreshor other descriptive name asdeep` doesn't tell that much of what it will do. (name should be updated to all instances)

renamed to 'refreshChildren' because 'refreshAll' is another method that refreshes the whole dataprovider and therefore could be misinterpreted, fullRefresh imho isn't more descriptive than deep whereas 'refreshChildren' describes exactly what it does.


flow-data/src/main/java/com/vaadin/flow/data/provider/DataCommunicator.java, line 396 at r1 (raw file):

Previously, caalador wrote…
handleDataRefreshEvent((DataRefreshEvent<T>) event);

Not needed and if wanting to clear it I would suggest to pick out the item as a variable e.g.

T item = ((DataRefreshEvent<T>) event).getItem();
refresh(item);

or

DataRefreshEvent<T> refreshEvent = (DataRefreshEvent<T>) event;
refresh(refreshEvent.getItem());

It is needed to enable 'com.vaadin.flow.data.provider.hierarchy.HierarchicalDataCommunicator' to deal with the 'deep' case. What do you suggest: to parameterise 'refresh'?


flow-data/src/main/java/com/vaadin/flow/data/provider/DataProvider.java, line 123 at r1 (raw file):

Previously, caalador wrote…

Shouldn't this be the other way around that refreshItem(item) is the default that calls the boolean version which is required to implement?

Also do we need a default as AbstractDataProvider implements these methods?

The goal was to

  • have only minimal changes to the API
  • by default do what the former behavior was
    And guess yes, we need the default as I can not guarantee that the AbstractDataProvider will be the only implementation of the interface. If it is supposed to be the only implementation that would bring up the question about the purpose of the interface. We should then throw away the interface

OLD Vaadin Flow ongoing work (Vaadin 10+) automation moved this from Review in progress to Reviewer approved Aug 16, 2019
Copy link
Contributor

@caalador caalador left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 4 of 4 files at r2.
Reviewable status: :shipit: complete! all discussions resolved, 1 of 1 LGTMs obtained


flow-data/src/main/java/com/vaadin/flow/data/provider/DataCommunicator.java, line 396 at r1 (raw file):

Previously, wfischlein (Wolfgang Fischlein) wrote…

It is needed to enable 'com.vaadin.flow.data.provider.hierarchy.HierarchicalDataCommunicator' to deal with the 'deep' case. What do you suggest: to parameterise 'refresh'?

No this is fine.

@caalador
Copy link
Contributor

CLA is not signed. You need to sign it else we can not merge the patch.

@caalador caalador merged commit 5a8ea89 into master Aug 16, 2019
OLD Vaadin Flow ongoing work (Vaadin 10+) automation moved this from Reviewer approved to Done - pending release Aug 16, 2019
@caalador caalador deleted the 651-add-deep-refresh-to-dataprovider branch August 16, 2019 10:23
@pleku pleku mentioned this pull request Aug 23, 2019
@ujoni ujoni added this to the 2.1.0.alpha1 milestone Aug 27, 2019
@joheriks joheriks moved this from Done - pending release to Released in OLD Vaadin Flow ongoing work (Vaadin 10+) Sep 2, 2019
@pleku pleku changed the title #651: enhanced api to provide deep-refresh on DataProvider-item Refreshing a full subtree of a node in TreeGrid (hierarchical data providers) Sep 24, 2019
@pleku pleku added this to Candidates for Vaadin 14.1 in No longer in use, go to https://vaadin.com/roadmap Sep 24, 2019
@pleku pleku added the 14.1 label Sep 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants