You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Henrique Boregio <hb...@gmail.com> on 2009/04/18 18:22:57 UTC
Markup's isVisible method being called multiple times
I am overriding the link's onVisible method to do some conditional
markup. I've realized that this method is actually being call 4 times.
When I add a simple System.out to the following code, I get the
corresponding resut:
MyPAGE.JAVA
public class MyPage extends WebPage {
public MyPage(final PageParameters parameters) {
add(new Link("link") {
public boolean isVisible() {
System.out.println("here i am");
return false;
}
}
}
}
PAGE.HTML
<html><body>
<a href="#" wicket:id="link">The Link</a>
</body></html>
RESULT
here i am
here i am
here i am
here i am
Any ideas why this method is being called 4 times?
Thanks.
--
Henrique Boregio
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Markup's isVisible method being called multiple times
Posted by quiqueq <hb...@gmail.com>.
Oh. I feel stupid haha
Thanks.
tohtori wrote:
>
> Hi Henrique,
>
> Answer can be found from javadoc
>
> /**
> * Gets whether this component and any children are visible.
> * <p>
> * *WARNING: this method can be called multiple times during a
> request. If you override this*
> * method, it is a good idea to keep it cheap in terms of
> processing. Alternatively, you can
> * call {@link #setVisible(boolean)}.
> * <p>
> *
> * @return True if component and any children are visible
> */
> public boolean isVisible()
> {
> return getFlag(FLAG_VISIBLE);
> }
>
> -MSi
>
>
> Henrique Boregio wrote:
>> I am overriding the link's onVisible method to do some conditional
>> markup. I've realized that this method is actually being call 4 times.
>> When I add a simple System.out to the following code, I get the
>> corresponding resut:
>>
>>
>> MyPAGE.JAVA
>>
>> public class MyPage extends WebPage {
>> public MyPage(final PageParameters parameters) {
>>
>> add(new Link("link") {
>> public boolean isVisible() {
>> System.out.println("here i am");
>> return false;
>> }
>> }
>> }
>> }
>>
>> PAGE.HTML
>> <html><body>
>> # The Link
>> </body></html>
>>
>> RESULT
>> here i am
>> here i am
>> here i am
>> here i am
>>
>> Any ideas why this method is being called 4 times?
>> Thanks.
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
--
View this message in context: http://www.nabble.com/Markup%27s-isVisible-method-being-called-multiple-times-tp23114670p23114933.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Markup's isVisible method being called multiple times
Posted by Marko Sibakov <ma...@ri.fi>.
Hi Henrique,
Answer can be found from javadoc
/**
* Gets whether this component and any children are visible.
* <p>
* *WARNING: this method can be called multiple times during a
request. If you override this*
* method, it is a good idea to keep it cheap in terms of
processing. Alternatively, you can
* call {@link #setVisible(boolean)}.
* <p>
*
* @return True if component and any children are visible
*/
public boolean isVisible()
{
return getFlag(FLAG_VISIBLE);
}
-MSi
Henrique Boregio wrote:
> I am overriding the link's onVisible method to do some conditional
> markup. I've realized that this method is actually being call 4 times.
> When I add a simple System.out to the following code, I get the
> corresponding resut:
>
>
> MyPAGE.JAVA
>
> public class MyPage extends WebPage {
> public MyPage(final PageParameters parameters) {
>
> add(new Link("link") {
> public boolean isVisible() {
> System.out.println("here i am");
> return false;
> }
> }
> }
> }
>
> PAGE.HTML
> <html><body>
> <a href="#" wicket:id="link">The Link</a>
> </body></html>
>
> RESULT
> here i am
> here i am
> here i am
> here i am
>
> Any ideas why this method is being called 4 times?
> Thanks.
>