You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Edvin Syse (JIRA)" <ji...@apache.org> on 2007/12/03 08:21:43 UTC
[jira] Created: (WICKET-1200) bug, still calls
getObject() on enclosed Models even if the content isn't rendered
<wicket:enclosure> bug, still calls getObject() on enclosed Models even if the content isn't rendered
-----------------------------------------------------------------------------------------------------
Key: WICKET-1200
URL: https://issues.apache.org/jira/browse/WICKET-1200
Project: Wicket
Issue Type: Bug
Components: wicket
Affects Versions: 1.3.0-rc1
Environment: n/a
Reporter: Edvin Syse
Steps to reproduce:
- Create a quickstart project:
mvn archetype:create -DarchetypeGroupId=org.apache.wicket \
-DarchetypeArtifactId=wicket-archetype-quickstart \
-DarchetypeVersion=1.3.0-rc1 \
-DgroupId=no.sysedata \
-DartifactId=enclosurebug
mvn eclipse:eclipse
- Add two labels to HomePage.java. Let Label1 return isVisible=false, and implement a Model where getObject() writes to stdout for Label2:
package no.sysedata;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.model.Model;
public class HomePage extends WebPage {
private static final long serialVersionUID = 1L;
public HomePage(final PageParameters parameters) {
add(new Label("label1") {
@Override public boolean isVisible() {
return false;
}
});
add(new Label("label2", new Model() {
@Override public Object getObject() {
System.out.println("Getting object of model 2");
return "MODEL2 OBJECT";
}
}));
}
}
- In HomePage.html, add an enclosure around the two labels and let label1 be the controlling component for the enclosure:
<html>
<head>
<title>Wicket Enclosure Bug</title>
</head>
<body>
<wicket:enclosure child="label1">
<span wicket:id="label1">Label 1</span>
<span wicket:id="label2">Label 2</span>
</wicket:enclosure>
</body>
</html>
- When you run the project, you'll get the following on stdout:
"Getting object of model 2"
And the rendered HTML when hitting the homepage is:
<html>
<head>
<title>Wicket Enclosure Bug</title>
</head>
<body>
<wicket:enclosure child="label1"></wicket:enclosure>
</body>
</html>
If I add:
@Override protected void init() {
getMarkupSettings().setStripWicketTags(true);
}
to WicketApplication.java, the markup is:
<html>
<head>
<title>Wicket Enclosure Bug</title>
</head>
<body>
</body>
</html>
.. but the stdout is still the same.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (WICKET-1200) bug, still calls
getObject() on enclosed Models even if the content isn't rendered
Posted by "Frank Bille Jensen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-1200?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Frank Bille Jensen updated WICKET-1200:
---------------------------------------
Fix Version/s: (was: 1.3.0-rc3)
1.3.0-final
> <wicket:enclosure> bug, still calls getObject() on enclosed Models even if the content isn't rendered
> -----------------------------------------------------------------------------------------------------
>
> Key: WICKET-1200
> URL: https://issues.apache.org/jira/browse/WICKET-1200
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.0-rc1
> Environment: n/a
> Reporter: Edvin Syse
> Assignee: Juergen Donnerstag
> Fix For: 1.3.0-final
>
>
> Steps to reproduce:
> - Create a quickstart project:
> mvn archetype:create -DarchetypeGroupId=org.apache.wicket \
> -DarchetypeArtifactId=wicket-archetype-quickstart \
> -DarchetypeVersion=1.3.0-rc1 \
> -DgroupId=no.sysedata \
> -DartifactId=enclosurebug
> mvn eclipse:eclipse
> - Add two labels to HomePage.java. Let Label1 return isVisible=false, and implement a Model where getObject() writes to stdout for Label2:
> package no.sysedata;
> import org.apache.wicket.PageParameters;
> import org.apache.wicket.markup.html.basic.Label;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.model.Model;
> public class HomePage extends WebPage {
> private static final long serialVersionUID = 1L;
> public HomePage(final PageParameters parameters) {
> add(new Label("label1") {
> @Override public boolean isVisible() {
> return false;
> }
> });
> add(new Label("label2", new Model() {
> @Override public Object getObject() {
> System.out.println("Getting object of model 2");
> return "MODEL2 OBJECT";
> }
> }));
> }
> }
> - In HomePage.html, add an enclosure around the two labels and let label1 be the controlling component for the enclosure:
> <html>
> <head>
> <title>Wicket Enclosure Bug</title>
> </head>
> <body>
> <wicket:enclosure child="label1">
> <span wicket:id="label1">Label 1</span>
> <span wicket:id="label2">Label 2</span>
> </wicket:enclosure>
> </body>
> </html>
> - When you run the project, you'll get the following on stdout:
> "Getting object of model 2"
> And the rendered HTML when hitting the homepage is:
> <html>
> <head>
> <title>Wicket Enclosure Bug</title>
> </head>
> <body>
> <wicket:enclosure child="label1"></wicket:enclosure>
> </body>
> </html>
> If I add:
> @Override protected void init() {
> getMarkupSettings().setStripWicketTags(true);
> }
> to WicketApplication.java, the markup is:
> <html>
> <head>
> <title>Wicket Enclosure Bug</title>
> </head>
> <body>
>
> </body>
> </html>
> .. but the stdout is still the same.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WICKET-1200) bug, still calls
getObject() on enclosed Models even if the content isn't rendered
Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-1200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12552301 ]
Igor Vaynberg commented on WICKET-1200:
---------------------------------------
i would imagine one of the things is the rendered component check. components inside the enclosure are visible but not rendered...
> <wicket:enclosure> bug, still calls getObject() on enclosed Models even if the content isn't rendered
> -----------------------------------------------------------------------------------------------------
>
> Key: WICKET-1200
> URL: https://issues.apache.org/jira/browse/WICKET-1200
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.0-rc1
> Environment: n/a
> Reporter: Edvin Syse
> Assignee: Juergen Donnerstag
>
> Steps to reproduce:
> - Create a quickstart project:
> mvn archetype:create -DarchetypeGroupId=org.apache.wicket \
> -DarchetypeArtifactId=wicket-archetype-quickstart \
> -DarchetypeVersion=1.3.0-rc1 \
> -DgroupId=no.sysedata \
> -DartifactId=enclosurebug
> mvn eclipse:eclipse
> - Add two labels to HomePage.java. Let Label1 return isVisible=false, and implement a Model where getObject() writes to stdout for Label2:
> package no.sysedata;
> import org.apache.wicket.PageParameters;
> import org.apache.wicket.markup.html.basic.Label;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.model.Model;
> public class HomePage extends WebPage {
> private static final long serialVersionUID = 1L;
> public HomePage(final PageParameters parameters) {
> add(new Label("label1") {
> @Override public boolean isVisible() {
> return false;
> }
> });
> add(new Label("label2", new Model() {
> @Override public Object getObject() {
> System.out.println("Getting object of model 2");
> return "MODEL2 OBJECT";
> }
> }));
> }
> }
> - In HomePage.html, add an enclosure around the two labels and let label1 be the controlling component for the enclosure:
> <html>
> <head>
> <title>Wicket Enclosure Bug</title>
> </head>
> <body>
> <wicket:enclosure child="label1">
> <span wicket:id="label1">Label 1</span>
> <span wicket:id="label2">Label 2</span>
> </wicket:enclosure>
> </body>
> </html>
> - When you run the project, you'll get the following on stdout:
> "Getting object of model 2"
> And the rendered HTML when hitting the homepage is:
> <html>
> <head>
> <title>Wicket Enclosure Bug</title>
> </head>
> <body>
> <wicket:enclosure child="label1"></wicket:enclosure>
> </body>
> </html>
> If I add:
> @Override protected void init() {
> getMarkupSettings().setStripWicketTags(true);
> }
> to WicketApplication.java, the markup is:
> <html>
> <head>
> <title>Wicket Enclosure Bug</title>
> </head>
> <body>
>
> </body>
> </html>
> .. but the stdout is still the same.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (WICKET-1200) bug, still calls
getObject() on enclosed Models even if the content isn't rendered
Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-1200?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Igor Vaynberg reassigned WICKET-1200:
-------------------------------------
Assignee: Juergen Donnerstag
argh, i just looked at how enclosure works and actually when it is not visible it still renders all the components, albeit into a null stream. this means that if you hide something with an expensive model you still take a hit even though the enclosure is not visible.
i am thinking instead of actually rendering things into a null stream we simply skip over them...just forward the markupstream to the </wicket:enclosure> tag in enclosure.oncomponenttagbody()... will something like this work?
> <wicket:enclosure> bug, still calls getObject() on enclosed Models even if the content isn't rendered
> -----------------------------------------------------------------------------------------------------
>
> Key: WICKET-1200
> URL: https://issues.apache.org/jira/browse/WICKET-1200
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.0-rc1
> Environment: n/a
> Reporter: Edvin Syse
> Assignee: Juergen Donnerstag
>
> Steps to reproduce:
> - Create a quickstart project:
> mvn archetype:create -DarchetypeGroupId=org.apache.wicket \
> -DarchetypeArtifactId=wicket-archetype-quickstart \
> -DarchetypeVersion=1.3.0-rc1 \
> -DgroupId=no.sysedata \
> -DartifactId=enclosurebug
> mvn eclipse:eclipse
> - Add two labels to HomePage.java. Let Label1 return isVisible=false, and implement a Model where getObject() writes to stdout for Label2:
> package no.sysedata;
> import org.apache.wicket.PageParameters;
> import org.apache.wicket.markup.html.basic.Label;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.model.Model;
> public class HomePage extends WebPage {
> private static final long serialVersionUID = 1L;
> public HomePage(final PageParameters parameters) {
> add(new Label("label1") {
> @Override public boolean isVisible() {
> return false;
> }
> });
> add(new Label("label2", new Model() {
> @Override public Object getObject() {
> System.out.println("Getting object of model 2");
> return "MODEL2 OBJECT";
> }
> }));
> }
> }
> - In HomePage.html, add an enclosure around the two labels and let label1 be the controlling component for the enclosure:
> <html>
> <head>
> <title>Wicket Enclosure Bug</title>
> </head>
> <body>
> <wicket:enclosure child="label1">
> <span wicket:id="label1">Label 1</span>
> <span wicket:id="label2">Label 2</span>
> </wicket:enclosure>
> </body>
> </html>
> - When you run the project, you'll get the following on stdout:
> "Getting object of model 2"
> And the rendered HTML when hitting the homepage is:
> <html>
> <head>
> <title>Wicket Enclosure Bug</title>
> </head>
> <body>
> <wicket:enclosure child="label1"></wicket:enclosure>
> </body>
> </html>
> If I add:
> @Override protected void init() {
> getMarkupSettings().setStripWicketTags(true);
> }
> to WicketApplication.java, the markup is:
> <html>
> <head>
> <title>Wicket Enclosure Bug</title>
> </head>
> <body>
>
> </body>
> </html>
> .. but the stdout is still the same.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (WICKET-1200) bug, still calls
getObject() on enclosed Models even if the content isn't rendered
Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-1200?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Juergen Donnerstag resolved WICKET-1200.
----------------------------------------
Resolution: Fixed
Fix Version/s: 1.3.0-rc3
since the 993 test case is working without as well .... I can imagine I changed it while trying to find a fix and didn't validate it later on.
> <wicket:enclosure> bug, still calls getObject() on enclosed Models even if the content isn't rendered
> -----------------------------------------------------------------------------------------------------
>
> Key: WICKET-1200
> URL: https://issues.apache.org/jira/browse/WICKET-1200
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.0-rc1
> Environment: n/a
> Reporter: Edvin Syse
> Assignee: Juergen Donnerstag
> Fix For: 1.3.0-rc3
>
>
> Steps to reproduce:
> - Create a quickstart project:
> mvn archetype:create -DarchetypeGroupId=org.apache.wicket \
> -DarchetypeArtifactId=wicket-archetype-quickstart \
> -DarchetypeVersion=1.3.0-rc1 \
> -DgroupId=no.sysedata \
> -DartifactId=enclosurebug
> mvn eclipse:eclipse
> - Add two labels to HomePage.java. Let Label1 return isVisible=false, and implement a Model where getObject() writes to stdout for Label2:
> package no.sysedata;
> import org.apache.wicket.PageParameters;
> import org.apache.wicket.markup.html.basic.Label;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.model.Model;
> public class HomePage extends WebPage {
> private static final long serialVersionUID = 1L;
> public HomePage(final PageParameters parameters) {
> add(new Label("label1") {
> @Override public boolean isVisible() {
> return false;
> }
> });
> add(new Label("label2", new Model() {
> @Override public Object getObject() {
> System.out.println("Getting object of model 2");
> return "MODEL2 OBJECT";
> }
> }));
> }
> }
> - In HomePage.html, add an enclosure around the two labels and let label1 be the controlling component for the enclosure:
> <html>
> <head>
> <title>Wicket Enclosure Bug</title>
> </head>
> <body>
> <wicket:enclosure child="label1">
> <span wicket:id="label1">Label 1</span>
> <span wicket:id="label2">Label 2</span>
> </wicket:enclosure>
> </body>
> </html>
> - When you run the project, you'll get the following on stdout:
> "Getting object of model 2"
> And the rendered HTML when hitting the homepage is:
> <html>
> <head>
> <title>Wicket Enclosure Bug</title>
> </head>
> <body>
> <wicket:enclosure child="label1"></wicket:enclosure>
> </body>
> </html>
> If I add:
> @Override protected void init() {
> getMarkupSettings().setStripWicketTags(true);
> }
> to WicketApplication.java, the markup is:
> <html>
> <head>
> <title>Wicket Enclosure Bug</title>
> </head>
> <body>
>
> </body>
> </html>
> .. but the stdout is still the same.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WICKET-1200) bug, still calls
getObject() on enclosed Models even if the content isn't rendered
Posted by "Gerolf Seitz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-1200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12552300 ]
Gerolf Seitz commented on WICKET-1200:
--------------------------------------
juergen replaced this:
markupStream.skipUntil(openTag.getName());
with this:
Response response = getResponse();
getRequestCycle().setResponse(NullResponse.getInstance());
try
{
super.onComponentTagBody(markupStream, openTag);
}
finally
{
getRequestCycle().setResponse(response);
}
to fix WICKET-993.
however, i tested it with:
markupStream.skipToMatchingCloseTag(openTag);
and also the failing code in WICKET-993 works as expected.
what was the original intention for rendering to a nullresponse?
> <wicket:enclosure> bug, still calls getObject() on enclosed Models even if the content isn't rendered
> -----------------------------------------------------------------------------------------------------
>
> Key: WICKET-1200
> URL: https://issues.apache.org/jira/browse/WICKET-1200
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.0-rc1
> Environment: n/a
> Reporter: Edvin Syse
> Assignee: Juergen Donnerstag
>
> Steps to reproduce:
> - Create a quickstart project:
> mvn archetype:create -DarchetypeGroupId=org.apache.wicket \
> -DarchetypeArtifactId=wicket-archetype-quickstart \
> -DarchetypeVersion=1.3.0-rc1 \
> -DgroupId=no.sysedata \
> -DartifactId=enclosurebug
> mvn eclipse:eclipse
> - Add two labels to HomePage.java. Let Label1 return isVisible=false, and implement a Model where getObject() writes to stdout for Label2:
> package no.sysedata;
> import org.apache.wicket.PageParameters;
> import org.apache.wicket.markup.html.basic.Label;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.model.Model;
> public class HomePage extends WebPage {
> private static final long serialVersionUID = 1L;
> public HomePage(final PageParameters parameters) {
> add(new Label("label1") {
> @Override public boolean isVisible() {
> return false;
> }
> });
> add(new Label("label2", new Model() {
> @Override public Object getObject() {
> System.out.println("Getting object of model 2");
> return "MODEL2 OBJECT";
> }
> }));
> }
> }
> - In HomePage.html, add an enclosure around the two labels and let label1 be the controlling component for the enclosure:
> <html>
> <head>
> <title>Wicket Enclosure Bug</title>
> </head>
> <body>
> <wicket:enclosure child="label1">
> <span wicket:id="label1">Label 1</span>
> <span wicket:id="label2">Label 2</span>
> </wicket:enclosure>
> </body>
> </html>
> - When you run the project, you'll get the following on stdout:
> "Getting object of model 2"
> And the rendered HTML when hitting the homepage is:
> <html>
> <head>
> <title>Wicket Enclosure Bug</title>
> </head>
> <body>
> <wicket:enclosure child="label1"></wicket:enclosure>
> </body>
> </html>
> If I add:
> @Override protected void init() {
> getMarkupSettings().setStripWicketTags(true);
> }
> to WicketApplication.java, the markup is:
> <html>
> <head>
> <title>Wicket Enclosure Bug</title>
> </head>
> <body>
>
> </body>
> </html>
> .. but the stdout is still the same.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.