Hi Ernesto,

To recap, I have a control panel visible on each and every page and in
that control panel, you can select the appropriate role you want to
use. Based on that role some menu items will be visible or not
(example below is correct). I am sure this problem has been solved
before :-0 as this is a very normal usecase for context sensitive
navigation.

It seems that there is no way to force the page to re-render using getPage()?

Thanks for the feedback so far. I keep on coming up against this issue
and have not found a reasonable solution to the problem. The
javascript option seems to be best so far.

Pieter

On Tue, Nov 10, 2009 at 1:41 PM, Ernesto Reinaldo Barreiro
<reier...@gmail.com> wrote:
> Even if you re-render your page components that are not "dynamic" will not
> change their state: unless you create a new instance of the page, I guess.
> By this I mean.
>
> class MyPanel .... {
>       public MyPanel(id) {
>           PanelB panelB = new Panel("B");
>           panelB.setVisible(getSomeCondition());
>           ....
>       }
> }
>
> Even if condition getSomeCondition() change, and you re-render  MyPanel, or
> the whole page, panelB will still be not visible. So, if you want something
> to be dynamic you have to program it to be dynamic.
>
> Best,
>
> Ernesto
>
>
> On Tue, Nov 10, 2009 at 1:20 PM, pieter claassen <pieter.claas...@gmail.com>
> wrote:
>>
>> Both of the suggestions I think requires me to modify the logic of the
>> controls (either to keep track of which ones need to be updated or by
>> placing the rendering logic in onBeforeRender()). I think this is a
>> lot of work for something relative straight forward and also any
>> changes to permission structures and I have to modify controls.
>>
>> Is there no way that I can mark a page obtained via getPage() as
>> requiring re-rendering? I tried getPage().dirty() before the
>> setResponsePage() but that didn't do anything.
>>
>> Thanks for the feedback though.
>> P
>>
>> On Tue, Nov 10, 2009 at 1:10 PM, Pedro Santos <pedros...@gmail.com> wrote:
>> > I tried setResponsePage(getPage()) but the problem is it does not
>> > re-render controls on the page.
>> >
>> > Where do you implement your control ( update logic )? Consider do it
>> > overriding Component.onBeforeRender method
>> >
>> > On Tue, Nov 10, 2009 at 10:03 AM, pieter claassen
>> > <pieter.claas...@gmail.com> wrote:
>> >>
>> >> Hi Pedro,
>> >>
>> >> I tried setResponsePage(getPage()) but the problem is it does not
>> >> re-render controls on the page.
>> >>
>> >> setResponsePage(getPage().getClass()) only works for stateless pages
>> >> and on most of my pages, I pass params via the constructor.
>> >>
>> >> The javascript option will be a last resort, but it seems to be not
>> >> the most elegant solution.
>> >>
>> >> Rgds,
>> >>
>> >> On Tue, Nov 10, 2009 at 11:45 AM, Pedro Santos <pedros...@gmail.com>
>> >> wrote:
>> >> > if(userSetWasChanged){
>> >> > target.appendJavascript("window.location.reload()");
>> >> > or
>> >> > setResponsePage(getPage());
>> >> > or
>> >> > setResponsePage(getPage().getClass());
>> >> > }
>> >> >
>> >> >
>> >> > On Tue, Nov 10, 2009 at 5:19 AM, pieter claassen
>> >> > <pieter.claas...@gmail.com>
>> >> > wrote:
>> >> >>
>> >> >> I have a link on a panel that is included in many pages. When the
>> >> >> user
>> >> >> clicks on the link, I change something in the user settings that
>> >> >> will
>> >> >> affect what gets displayed on the page. However, for that to work, I
>> >> >> need to reload the page after the user clicked on the link as by
>> >> >> default the other components that now need to be checked for
>> >> >> conditional visibility don't re-render (why not?). setResponsePage()
>> >> >> requires me to pass into the panel a target page and this becomes
>> >> >> complex when you have a mix of statefull and stateless pages as
>> >> >> targets (and it just doesn't feel right).
>> >> >>
>> >> >> I am sure there must be an easier way to just re-render a page?
>> >> >>
>> >> >> Any tips?
>> >> >>
>> >> >> Thanks,
>> >> >> pieter
>> >> >>
>> >> >>
>> >> >> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> >> >> For additional commands, e-mail: users-h...@wicket.apache.org
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Pedro Henrique Oliveira dos Santos
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Pieter Claassen
>> >> musmato.com
>> >
>> >
>> >
>> > --
>> > Pedro Henrique Oliveira dos Santos
>> >
>>
>>
>>
>> --
>> Pieter Claassen
>> musmato.com
>
>



-- 
Pieter Claassen
musmato.com

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

Reply via email to