[
https://issues.apache.org/jira/browse/WICKET-7134?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Pedro Santos updated WICKET-7134:
---------------------------------
Description:
Form code has a few places where nested form processing is done by a visit
while the current form is processed outside that visit. For instance:
{code:java}
protected final void markFormComponentsValid(){
markNestedFormComponentsValid();
internalMarkFormComponentsValid();
}
private void markNestedFormComponentsValid() {
visitFormsPostOrder(this, (form, visit) -> {
if (form == Form.this) {
return;
}
if (form.isSubmitted()) {
form.internalMarkFormComponentsValid();
}
});
}
{code}
Those pieces of code can be simplified by moving the entire processing to the
visit. Also, at the point Form#isSubmitted test is done, the form isn't
submitted yet. The test is just there to replace the form.isVisible/Enabled
one, but without correctly communicating its function to the code maintainer.
was:
Form code has a few places where nested form processing is done by a visit
while the current form is processed outside that visit. For instance:
protected final void markFormComponentsValid() {
markNestedFormComponentsValid();
internalMarkFormComponentsValid();
}
private void markNestedFormComponentsValid() {
visitFormsPostOrder(this, (form, visit) -> {
if (form == Form.this) {
return;
}
if (form.isSubmitted()) {
form.internalMarkFormComponentsValid();
}
});
}
Those pieces of code can be simplified by moving the entire processing to the
visit. Also, by the point Form#isSubmitted test is being done, the form isn't
already submitted. The test is just there to replace the form.isVisible/Enabled
one, but without correctly communicating its function to the code maintainer.
> To refactor Form processing code
> --------------------------------
>
> Key: WICKET-7134
> URL: https://issues.apache.org/jira/browse/WICKET-7134
> Project: Wicket
> Issue Type: Improvement
> Reporter: Pedro Santos
> Priority: Major
>
> Form code has a few places where nested form processing is done by a visit
> while the current form is processed outside that visit. For instance:
>
> {code:java}
> protected final void markFormComponentsValid(){
> markNestedFormComponentsValid();
> internalMarkFormComponentsValid();
> }
> private void markNestedFormComponentsValid() {
> visitFormsPostOrder(this, (form, visit) -> {
> if (form == Form.this) {
> return;
> }
> if (form.isSubmitted()) {
> form.internalMarkFormComponentsValid();
> }
> });
> }
> {code}
>
> Those pieces of code can be simplified by moving the entire processing to the
> visit. Also, at the point Form#isSubmitted test is done, the form isn't
> submitted yet. The test is just there to replace the form.isVisible/Enabled
> one, but without correctly communicating its function to the code maintainer.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)