that is correct

-igor

On Wed, Mar 28, 2012 at 12:41 PM, Jeffrey Schneller
<jeffrey.schnel...@envisa.com> wrote:
> Here it is:
>
>
> public class Admin extends WebPage {
>
>        private Component workingPanel;
>
>        public Admin() {
>                super();
>                init();
>        }
>
>        @Override
>        public void renderHead(IHeaderResponse response) {
>                response.renderCSSReference("css/admin.css");
>                super.renderHead(response);
>        }
>
>        public void init() {
>                workingPanel = new MyEmptyPanel("workingPanel") {
>                        @Override
>                        public void onEvent(IEvent<?> event) {
>                                if (event.getPayload() instanceof 
> MyPanelEvent) {
>                                        MyPanelEvent e = (MyPanelEvent) 
> event.getPayload();
>                                        AjaxRequestTarget target = 
> e.getTarget();
>
>                                        Component replacement;
>                                        switch (e.getType()) {
>                                        case MyPanelEvent.PANEL1:
>                                                replacement = new 
> MyPanel1(this.getId());
>                                                break;
>                                        case MyPanelEvent.PANEL2:
>                                                replacement = new 
> MyPanel2(this.getId());
>                                                break;
>                                        case MyPanelEvent.PANEL3:
>                                                replacement = new 
> MyPanel3(this.getId());
>                                                break;
>                                        default:
>                                                replacement = 
> Admin.this.workingPanel;
>                                                break;
>                                        }
>
>                                        
> Admin.this.workingPanel.replaceWith(replacement);       // IS THIS RIGHT?
>                                        Admin.this.workingPanel = replacement; 
>                  // IS THIS RIGHT?
>                                        this.setOutputMarkupId(true);
>                                        target.add(this);
>                                        target.appendJavaScript("alert('Panel 
> changed to: " + e.getType() + "');");     // place-holder for future 
> javascript to be called
>                                }
>                                super.onEvent(event);
>                        }
>                };
>                workingPanel.setOutputMarkupId(true);
>                add(workingPanel);
>
>                AjaxLink p1Link = new AjaxLink("p1Link") {
>                        @Override
>                        public void onClick(AjaxRequestTarget target) {
>                                send(getPage(), Broadcast.BREADTH, new 
> MyPanelEvent(target, MyPanelEvent.PANEL1));
>                        }
>                };
>                p1Link.setOutputMarkupId(true);
>                p1Link.setMarkupId("p1Link");
>                add(p1Link);
>
>                AjaxLink p2Link = new AjaxLink("p2Link") {
>                        @Override
>                        public void onClick(AjaxRequestTarget target) {
>                                send(getPage(), Broadcast.BREADTH, new 
> MyPanelEvent(target, MyPanelEvent.PANEL2));
>                        }
>                };
>                p2Link.setOutputMarkupId(true);
>                p2Link.setMarkupId("p2Link");
>                add(p2Link);
>
>                AjaxLink p3Link = new AjaxLink("p3Link") {
>                        @Override
>                        public void onClick(AjaxRequestTarget target) {
>                                send(getPage(), Broadcast.BREADTH, new 
> MyPanelEvent(target, MyPanelEvent.PANEL3));
>                        }
>                };
>                p3Link.setOutputMarkupId(true);
>                p3Link.setMarkupId("p3Link");
>                add(p3Link);
>        }
> }
>
> -----Original Message-----
> From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
> Sent: Wednesday, March 28, 2012 3:29 PM
> To: users@wicket.apache.org
> Subject: Re: Event handling and swapping panels
>
> paste your entire panel/page class...
>
> -igor
>
> On Wed, Mar 28, 2012 at 12:15 PM, Jeffrey Schneller 
> <jeffrey.schnel...@envisa.com> wrote:
>> Thanks.  But what does OuterPanelClass refer to in my example?
>>
>> I don't think either of these are right:
>>
>> MyEmptyPanel.this.panel.replaceWith(replacement);
>> -or-
>> MyPage.this.panel.replaceWith(replacement);
>>
>> Or do I need to define workingPanel as a private member of my page class and 
>> then have:
>>
>> MyPage.this.workingPanel.replaceWith(replacement);
>> MyPage.this.workingPanel = replacement;
>>
>>
>>
>>
>>
>>
>> -----Original Message-----
>> From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
>> Sent: Wednesday, March 28, 2012 3:07 PM
>> To: users@wicket.apache.org
>> Subject: Re: Event handling and swapping panels
>>
>> OuterPanelClass.this.panel.replaceWith(replacement);
>> OuterPanelClass.this.panel=replacement;
>>
>> -igor
>>
>> On Wed, Mar 28, 2012 at 11:33 AM, Jeffrey Schneller 
>> <jeffrey.schnel...@envisa.com> wrote:
>>> I want to swap panels using the event model in 1.5.  This is very similar 
>>> to the panel swapping code (wicket 1.4.x)  found in the Apache Wicket 
>>> Cookbook but uses the event model instead.  The problem is I can't set the 
>>> panel equal to its replacement, like you would in 1.4.x.  This is found on 
>>> the line marked ***** THIS IS NOT POSSIBLE *****.
>>>
>>> How would you go about doing this?  Is it even possible?
>>>
>>> Component workingPanel = new MyEmptyPanel("workingPanel") {
>>>                @Override
>>>                public void onEvent(IEvent<?> event) {
>>>                                                if (event.getPayload()
>>> instanceof MyPanelEvent) {
>>>
>>> MyPanelEvent e = (MyPanelEvent) event.getPayload();
>>>
>>>                                                Component replacement;
>>>                                                                switch
>>> (e.getType()) {
>>>
>>>                                                                case 
>>> MyPanelEvent.PANEL1:
>>>
>>> replacement = new MyFirstPanel(this.getId());
>>>                                                                break;
>>>                                                default:
>>>
>>> replacement = this;
>>>                                                                break;
>>>                                                                }
>>>
>>> this.replaceWith(replacement);
>>>                                                this. = replacement;
>>> // ****** THIS IS NOT POSSIBLE - HOW WOULD I DO THIS *******
>>>
>>> this.setOutputMarkupId(true);
>>>                                                AjaxRequestTarget
>>> target = e.getTarget();
>>>                                                target.add(this);
>>>                                }
>>>                                super.onEvent(event);
>>>                }
>>> workingPanel.setOutputMarkupId(true);
>>> add(workingPanel);
>>>
>>> AjaxLink firsttab = new AjaxLink("firsttab") {
>>>                @Override
>>>                public void onClick(AjaxRequestTarget target) {
>>>                                send(getPage(), Broadcast.BREADTH, new
>>> MyPanelEvent (target, MyPanelEvent.PANEL1));
>>>                }
>>> };
>>> firsttab.setOutputMarkupId(true);
>>> firsttab.setMarkupId("firsttab ");
>>> add(firsttab);
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>

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

Reply via email to