You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Anton Veretennikov <an...@gmail.com> on 2008/11/25 08:48:19 UTC

Panel's "read more" link

Hi,

I want to make a "read more" link that will make visible initially hidden label.
Running debugger I found that my Panel's constructor is called every
time I click this link.
So it again invisible.
What is wrong?

public class ReadMoreWicketPanel extends WicketPanel {
  private Label moreTextLabel;

  public ReadMoreWicketPanel(String id,
                             String title,
                             boolean escapeTitle,
                             String text,
                             boolean escapeText,
                             String moreText,
                             boolean escapeMoreText) {
    super(id, title, escapeTitle, text, escapeText);
    add(new Link("readMoreLink") {
      @Override
      public void onClick() {
        boolean is=moreTextLabel.isVisible();
        moreTextLabel.setVisible(!is);
      }
    });
    moreTextLabel=new Label("readMoreText",moreText);
    moreTextLabel.setEscapeModelStrings(escapeMoreText);
    moreTextLabel.setVisible(false);
    add(moreTextLabel);
  }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Panel's "read more" link

Posted by Anton Veretennikov <an...@gmail.com>.
> Anton Veretennikov wrote:
>>
>> Thank you! Very usefull thing!
>>
> No problem. The explanation on that issue is in the list and i think there
> is a note in the wiki.
> Maybe this thread gives you a hint
> http://www.nabble.com/ListView-%2B-reusing-Items-td14918862.html#a14924868

I did not scroll doc to see this big WARNING :)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Panel's "read more" link

Posted by Newgro <pe...@gmx.ch>.

Anton Veretennikov wrote:
> 
> Thank you! Very usefull thing!
> 

No problem. The explanation on that issue is in the list and i think there
is a note in the wiki.
Maybe this thread gives you a hint 
http://www.nabble.com/ListView-%2B-reusing-Items-td14918862.html#a14924868
http://www.nabble.com/ListView-%2B-reusing-Items-td14918862.html#a14924868 
-- 
View this message in context: http://www.nabble.com/Panel%27s-%22read-more%22-link-tp20676461p20677140.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: Panel's "read more" link

Posted by Anton Veretennikov <an...@gmail.com>.
> Did you try ListView.setReuseItems(true);?
>
> Maybe that can help
>
> Cheers
> Per

Thank you! Very usefull thing!

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Panel's "read more" link

Posted by Newgro <pe...@gmx.ch>.

Anton Veretennikov wrote:
> 
> I found that every time link is clicked ReadMoreWicketPanel-s are
> created again because they are populated by ListView in WebPage.
> 
Did you try ListView.setReuseItems(true);?

Maybe that can help

Cheers
Per
-- 
View this message in context: http://www.nabble.com/Panel%27s-%22read-more%22-link-tp20676461p20676941.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: Panel's "read more" link

Posted by Anton Veretennikov <an...@gmail.com>.
I found that every time link is clicked ReadMoreWicketPanel-s are
created again because they are populated by ListView in WebPage.

Does it mean that I must put my ReadMoreWicketPanel's instances in session?

On Tue, Nov 25, 2008 at 2:48 PM, Anton Veretennikov
<an...@gmail.com> wrote:
> Hi,
>
> I want to make a "read more" link that will make visible initially hidden label.
> Running debugger I found that my Panel's constructor is called every
> time I click this link.
> So it again invisible.
> What is wrong?
>
> public class ReadMoreWicketPanel extends WicketPanel {
>  private Label moreTextLabel;
>
>  public ReadMoreWicketPanel(String id,
>                             String title,
>                             boolean escapeTitle,
>                             String text,
>                             boolean escapeText,
>                             String moreText,
>                             boolean escapeMoreText) {
>    super(id, title, escapeTitle, text, escapeText);
>    add(new Link("readMoreLink") {
>      @Override
>      public void onClick() {
>        boolean is=moreTextLabel.isVisible();
>        moreTextLabel.setVisible(!is);
>      }
>    });
>    moreTextLabel=new Label("readMoreText",moreText);
>    moreTextLabel.setEscapeModelStrings(escapeMoreText);
>    moreTextLabel.setVisible(false);
>    add(moreTextLabel);
>  }
> }
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org