-
Notifications
You must be signed in to change notification settings - Fork 169
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
Add highlight capabilities to RouterLink #3526
Add highlight capabilities to RouterLink #3526
Conversation
Reviewed 2 of 6 files at r1, 3 of 3 files at r2. flow-server/src/main/java/com/vaadin/flow/router/HighlightAction.java, line 35 at r2 (raw file):
If this can be Please also document what flow-server/src/main/java/com/vaadin/flow/router/HighlightActions.java, line 39 at r2 (raw file):
These remarks also apply to lots of similar code in this file. flow-server/src/main/java/com/vaadin/flow/router/HighlightActions.java, line 40 at r2 (raw file):
This can be shortened to a oneliner: Also applies for flow-server/src/main/java/com/vaadin/flow/router/HighlightConditions.java, line 29 at r2 (raw file):
"same as" flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 433 at r2 (raw file):
Add flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 434 at r2 (raw file):
May this be flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 441 at r2 (raw file):
Javadoc should describe what the default setting is. In general, the javadoc could also be a little more elaborative. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 448 at r2 (raw file):
Should probably throw if flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 453 at r2 (raw file):
Add flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 454 at r2 (raw file):
May this be flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 461 at r2 (raw file):
Javadoc should describe what the default setting is. In general, the javadoc could also be a little more elaborative. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 468 at r2 (raw file):
This is kind of an edge case, but I think this should explicitly invoke the old action with flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 468 at r2 (raw file):
Should probably throw if flow-server/src/test/java/com/vaadin/flow/router/RouterLinkTest.java, line 345 at r2 (raw file):
It's quite hard to see what these methods test since most of the code is only about setting things up. I'd suggest extracting some helpers to make the actual "business logic" stand out. Comments from Reviewable |
Review status: 5 of 6 files reviewed at latest revision, 14 unresolved discussions. flow-server/src/main/java/com/vaadin/flow/router/HighlightAction.java, line 35 at r2 (raw file): Previously, Legioth (Leif Åstrand) wrote…
Done. flow-server/src/main/java/com/vaadin/flow/router/HighlightActions.java, line 39 at r2 (raw file): Previously, Legioth (Leif Åstrand) wrote…
Done. flow-server/src/main/java/com/vaadin/flow/router/HighlightActions.java, line 40 at r2 (raw file): Previously, Legioth (Leif Åstrand) wrote…
Done. flow-server/src/main/java/com/vaadin/flow/router/HighlightConditions.java, line 29 at r2 (raw file): Previously, Legioth (Leif Åstrand) wrote…
Done. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 433 at r2 (raw file): Previously, Legioth (Leif Åstrand) wrote…
Done. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 434 at r2 (raw file): Previously, Legioth (Leif Åstrand) wrote…
Done. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 441 at r2 (raw file): Previously, Legioth (Leif Åstrand) wrote…
Done. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 448 at r2 (raw file): Previously, Legioth (Leif Åstrand) wrote…
Done. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 453 at r2 (raw file): Previously, Legioth (Leif Åstrand) wrote…
Done. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 454 at r2 (raw file): Previously, Legioth (Leif Åstrand) wrote…
Done. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 461 at r2 (raw file): Previously, Legioth (Leif Åstrand) wrote…
Done. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 468 at r2 (raw file): Previously, Legioth (Leif Åstrand) wrote…
Done. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 468 at r2 (raw file): Previously, Legioth (Leif Åstrand) wrote…
Done. flow-server/src/test/java/com/vaadin/flow/router/RouterLinkTest.java, line 345 at r2 (raw file): Previously, Legioth (Leif Åstrand) wrote…
Done. Comments from Reviewable |
Reviewed 6 of 6 files at r3. flow-server/src/main/java/com/vaadin/flow/router/HighlightCondition.java, line 37 at r3 (raw file):
flow-server/src/main/java/com/vaadin/flow/router/HighlightCondition.java, line 38 at r3 (raw file):
Minor nit: This method name could be clarified now when it's no longer inherited from flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 447 at r3 (raw file):
Javadoc could also provide a link to the factory class for built-in conditions. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 449 at r3 (raw file):
flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 465 at r3 (raw file):
Javadoc could also provide a link to the factory class for built-in actions. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 482 at r3 (raw file):
flow-server/src/test/java/com/vaadin/flow/router/RouterLinkTest.java, line 434 at r3 (raw file):
Could also test that no attribute has been added even though the condition is triggered. flow-server/src/test/java/com/vaadin/flow/router/RouterLinkTest.java, line 437 at r3 (raw file):
Shouldn't this check Comments from Reviewable |
Review status: 5 of 6 files reviewed at latest revision, 8 unresolved discussions. flow-server/src/main/java/com/vaadin/flow/router/HighlightCondition.java, line 37 at r3 (raw file): Previously, Legioth (Leif Åstrand) wrote…
Done. flow-server/src/main/java/com/vaadin/flow/router/HighlightCondition.java, line 38 at r3 (raw file): Previously, Legioth (Leif Åstrand) wrote…
Done. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 447 at r3 (raw file): Previously, Legioth (Leif Åstrand) wrote…
Done. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 449 at r3 (raw file): Previously, Legioth (Leif Åstrand) wrote…
Done. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 465 at r3 (raw file): Previously, Legioth (Leif Åstrand) wrote…
Done. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 482 at r3 (raw file): Previously, Legioth (Leif Åstrand) wrote…
Done. flow-server/src/test/java/com/vaadin/flow/router/RouterLinkTest.java, line 434 at r3 (raw file): Previously, Legioth (Leif Åstrand) wrote…
Is that necessary? It's like testing the setter itself, as the action is simply assigned to the field. I'd rather test the clearing of the old action when a new one is set. flow-server/src/test/java/com/vaadin/flow/router/RouterLinkTest.java, line 437 at r3 (raw file): Previously, Legioth (Leif Åstrand) wrote…
Done. Comments from Reviewable |
Reviewed 4 of 4 files at r4. a discussion (no related file): Comments from Reviewable |
Reviewed 2 of 6 files at r3, 4 of 4 files at r4. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 461 at r4 (raw file):
I would expect that we actually throw here as seldom do developers run with assertions enabled. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 496 at r4 (raw file):
Here we should probably also use flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 501 at r4 (raw file):
Should there also be a shorthand for Comments from Reviewable |
Review status: all files reviewed at latest revision, 4 unresolved discussions. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 461 at r4 (raw file): Previously, caalador wrote…
I'm not much used to flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 501 at r4 (raw file): Previously, caalador wrote…
I'd stick with the setters only, the shorthand with two functional interfaces as arguments might quickly become hard to read. Comments from Reviewable |
Review status: all files reviewed at latest revision, 4 unresolved discussions. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 461 at r4 (raw file): Previously, heruan (Giovanni Lovato) wrote…
You can just replace the assert so that a null value throws. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 501 at r4 (raw file): Previously, heruan (Giovanni Lovato) wrote…
Well I would see it used with predefined action and condition, but it can be added later also. Comments from Reviewable |
Review status: all files reviewed at latest revision, 4 unresolved discussions. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 461 at r4 (raw file): Previously, caalador wrote…
Done. flow-server/src/main/java/com/vaadin/flow/router/RouterLink.java, line 496 at r4 (raw file): Previously, caalador wrote…
Done. Comments from Reviewable |
e328039
to
1f9d04f
Compare
SonarQube analysis reported 32 issues Top 10 extra issuesNote: The following issues were found on lines that were not modified in the pull request. Because these issues can't be reported as line comments, they are summarized here:
|
Reviewed 1 of 1 files at r5. Comments from Reviewable |
Fixes #482 while tempting to leave an open door to support highlighting on other components, e.g.
Tab
.Introduces two interfaces:
HighlightCondition<T> extends SerializableBiPredicate<T, AfterNavigationEvent>
HighlightAction<T> extends SerializableBiConsumer<T, Boolean>
with some predefined logic in
HighlightConditions
andHighlightActions
.Then enables
RouterLink
implementingAfterNavigationObserver
with getter/setters for both (with reasonable defaults).This change is