Refactor MockListView: replace magic numbers with ComponentConstants#3796
Open
sumavyshnavy wants to merge 2 commits intomit-cml:masterfrom
Open
Refactor MockListView: replace magic numbers with ComponentConstants#3796sumavyshnavy wants to merge 2 commits intomit-cml:masterfrom
sumavyshnavy wants to merge 2 commits intomit-cml:masterfrom
Conversation
…for image dimensions
Collaborator
|
Can one of the admins verify this patch? |
1 similar comment
Collaborator
|
Can one of the admins verify this patch? |
XomaDev
suggested changes
Mar 8, 2026
| public static final int LISTVIEW_PREFERRED_HEIGHT = 40; | ||
| public static final int LISTVIEW_FILTER_PREFERRED_HEIGHT = 30; | ||
| public static final int LISTVIEW_DEFAULT_IMAGE_WIDTH = 40; | ||
| public static final int LISTVIEW_DEFAULT_IMAGE_HEIGHT = 40; |
jisqyv
requested changes
Mar 9, 2026
Member
jisqyv
left a comment
There was a problem hiding this comment.
Note: Even with the comments below addressed, I'm not sure this change is worth the effort, given there are other constants that are still hardcoded.
| imageHeight = 40; // (200 / 5) | ||
| imageWidth = 40; // (200 / 5) | ||
| // TODO (Jose) extract magic numbers as ComponentConstants.java | ||
| imageHeight = ComponentConstants.LISTVIEW_DEFAULT_IMAGE_HEIGHT; |
| public static final int LISTVIEW_PREFERRED_HEIGHT = 40; | ||
| public static final int LISTVIEW_FILTER_PREFERRED_HEIGHT = 30; | ||
| public static final int LISTVIEW_DEFAULT_IMAGE_WIDTH = 40; | ||
| public static final int LISTVIEW_DEFAULT_IMAGE_HEIGHT = 40; |
Author
There was a problem hiding this comment.
Thanks for the feedback! I've restored the (200 / 5) comment in MockListView.java and fixed the indentation in ComponentConstants.java.
I understand your concern about other hardcoded constants as well. I started with these values since they were directly referenced in the TODO comment, but I'm happy to extend the refactor further if that would be more useful.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
General items
I have updated the relevant documentation files under docs/
My code follows the:
For all other changes
mastermasteras the baseWhat does this PR accomplish?
Description
This PR replaces hardcoded magic numbers used for image dimensions in
MockListViewwith constants defined inComponentConstants.Changes made:
LISTVIEW_DEFAULT_IMAGE_WIDTHandLISTVIEW_DEFAULT_IMAGE_HEIGHTinComponentConstants.java.MockListView.javato use these constants instead of hardcoded values.This improves maintainability and follows the existing pattern of defining reusable constants for component configuration values in the codebase.