You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by David Leangen <wi...@leangen.net> on 2007/07/31 11:56:38 UTC

Models and embedded panels

There's something that's eluding me here...

I have a wizard. The wizard includes a static XxxStep class. From within
that Step, I change the Locale.

All my stuff is updated right away with the new locale except for one
place...


I have a menu that holds various items. Most are links, but one of the
items is a panel, since I want to be able to change the impl as needed.

The current impl of that panel renders 2 links, but only one is
displayed depending on the current locale, as follows:

  BookmarkablePageLink changeToEnglishLink = 
      new BookmarkablePageLink( "eng", getPage().getClass() );
  add( changeToEnglishLink );
  changeToEnglishLink.setVisible( !isLocaleEnglish() );

  BookmarkablePageLink changeToJapaneseLink = 
      new BookmarkablePageLink( "jap", parentPage.getClass() );
  add( changeToJapaneseLink );
  changeToJapaneseLink.setVisible( !isLocaleJapanese() );


Any my language stuff just looks up the current locale.


I've tried quite a few things, but I can't figure out exactly why this
is not being updated when I change the locale... Or rather, I don't see
why all my other stuff is updated, but not this.


Any hints?

Thanks!!





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


Re: Models and embedded panels

Posted by wi...@leangen.net.
Doh!

Now that you mention that, the solution is obvious and I (once again) feel
stupid for even asking the question (not to mention wasting time on
this)...


I'll fix this when I get back to work tomorrow.

Thank you!



> On 7/31/07, David Leangen <wi...@leangen.net> wrote:
>>
>>
>>   BookmarkablePageLink changeToEnglishLink =
>>       new BookmarkablePageLink( "eng", getPage().getClass() );
>>   add( changeToEnglishLink );
>>   changeToEnglishLink.setVisible( !isLocaleEnglish() );
>>
>>   BookmarkablePageLink changeToJapaneseLink =
>>       new BookmarkablePageLink( "jap", parentPage.getClass() );
>>   add( changeToJapaneseLink );
>>   changeToJapaneseLink.setVisible( !isLocaleJapanese() );
>>
>
>
> Try (pseudo):
>
> new BookmarkablePageLink( "eng", getPage().getClass() ) {
>      isVisible() {
>          return isLocaleEnglish() == false;
>      }
> }
>
> new BookmarkablePageLink( "jap", parentPage.getClass() ) {
>      isVisible() {
>          return isLocaleJapanese() == false;
>      }
> }
>
>
> Frank
>



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


Re: Models and embedded panels

Posted by Frank Bille <fr...@apache.org>.
On 7/31/07, David Leangen <wi...@leangen.net> wrote:
>
>
>   BookmarkablePageLink changeToEnglishLink =
>       new BookmarkablePageLink( "eng", getPage().getClass() );
>   add( changeToEnglishLink );
>   changeToEnglishLink.setVisible( !isLocaleEnglish() );
>
>   BookmarkablePageLink changeToJapaneseLink =
>       new BookmarkablePageLink( "jap", parentPage.getClass() );
>   add( changeToJapaneseLink );
>   changeToJapaneseLink.setVisible( !isLocaleJapanese() );
>


Try (pseudo):

new BookmarkablePageLink( "eng", getPage().getClass() ) {
     isVisible() {
         return isLocaleEnglish() == false;
     }
}

new BookmarkablePageLink( "jap", parentPage.getClass() ) {
     isVisible() {
         return isLocaleJapanese() == false;
     }
}


Frank