-
Notifications
You must be signed in to change notification settings - Fork 3
Refactor DefaultFieldCustomizer and TableViewRowRenderer to improve component configuration #52
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -115,13 +115,20 @@ public void customize(String viewTypeName, Field field) { | |
| } else if (field.getFieldClass() == Boolean.class || field.getFieldClass() == boolean.class) { | ||
| field.setComponentClass(Checkbox.class); | ||
| field.set("disabled", true); | ||
| } else { | ||
| field.setComponentClass(Label.class); | ||
| } | ||
|
|
||
| if (field.getComponent() != null && !field.getComponent().isBlank() && field.getComponentClass() == null) { | ||
| field.setComponentClass(ComponentAliasIndex.getInstance().get(field.getComponent())); | ||
| } | ||
|
|
||
| if (field.getComponentClass() != null && field.getComponent() == null) { | ||
| field.setComponent(ComponentAliasIndex.getInstance().getAlias(field.getComponentClass())); | ||
| } | ||
|
|
||
| if (field.getComponentClass() == null && field.getComponent() == null) { | ||
| field.setComponentClass(Label.class); | ||
| field.setComponent("label"); | ||
| } | ||
|
Comment on lines
+128
to
+131
|
||
| } | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant component alias resolution: The ComponentAliasIndex lookup at line 121 is redundant with an earlier lookup performed outside this conditional block (at line 103-105, before the field.isVisible() check).
If field.getComponent() was set and the alias exists, componentClass would already be set at line 104, preventing entry into this block. If the alias lookup at line 104 returned null (unrecognized alias), repeating the same lookup here at line 121 will also return null.
This redundancy doesn't cause incorrect behavior but adds unnecessary processing. Consider either: (1) removing lines 103-105 and keeping only this more thorough check that uses isBlank(), or (2) removing lines 120-122 since the alias resolution already happened earlier.