You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Gajo Csaba <cg...@i-rose.si> on 2009/07/29 09:40:38 UTC

Beginner problems with TabbedPanel

Hello,

I've recently started working with Wicket, so a lot of things are still 
unknown for me. For example, right now I have a tabbed panel with two 
tabs. In the begining, I write setSelectedTab(1), so that the first tab 
is the default. This works ok.

However, I have an AjaxFallbackLink on the second tab. When I click on 
it, I want the following to happen:
tabbedPanel.setSelectedTab(0);

This creates an exception, saying that some components from tab #1 
aren't visble. And they shouldn't be, because I've selected tab #0.

If I click on the tab link manually (with a mouse), the tab opens fine.

What am I doing wrong? How can I select another tab through an ajax 
fallback link?

Thank you in advance,
Csaba



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


Re: Beginner problems with TabbedPanel

Posted by meduolis <me...@gmail.com>.
Just tried Igor's solution with JavaScript disabled using AjaxFallbackButton

Exception appears:

java.lang.IllegalStateException: No Page found for component
[MarkupContainer [Component id = xlsUploadForm]]

Components tree:

Page
  TabbedPanel
    Panel
      Form
        Button

Any ideas how to make it fallback correct?

With js everything works just perfect

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Beginner-problems-with-TabbedPanel-tp1887205p3473115.html
Sent from the Users forum 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: Beginner problems with TabbedPanel

Posted by Igor Vaynberg <ig...@gmail.com>.
completely untrue. see my sample that works with a regular tabbed panel.

-igor

On Thu, Jul 30, 2009 at 3:06 AM, Gajo Csaba<cg...@i-rose.si> wrote:
> Hi Iain,
>
> I solved the problem thanks to martin-g from ##wicket. Seems like the
> problem was I was using a non-ajax tabbed panel with an ajax button. When I
> switched to an ajax panel, it worked great.
> I've also tried using a non-ajax tabbed panel with a non-ajax button like
> you suggested, and it also seems to work.
>
> Looks like the only problem here is that you shouldn't mix ajax components
> with non-ajax ones.
>
> Regards,
> Csaba
>
>
> Iain Reddick wrote:
>>
>> Surely this is what you want for a non-ajax solution:
>>
>> class MyPage extends Page {
>>  private TabbedPanel tabPanel;
>>  ...
>>  public MyPage() {
>>   tabPanel = new TabPanel(...);
>>   add( tabPanel );
>>   ...
>>   confirmBtn = new Button("confirm") {
>>     private static final long serialVersionUID = 1L;
>>
>>     @Override
>>     public void onSubmit() {
>>       tabPanel.setSelectedTab(0);
>>     }
>>   };
>>   add( confirmBtn );
>>  }
>> }
>>
>> And for an ajax solution, just add tabPanel to the ajax request in the
>> submit handler?
>>
>> Sorry if this isn't right, but I don't see what the issue is.
>>
>> Gajo Csaba wrote:
>>>
>>> That may be true Igor, but there doesn't seem to be any other solution to
>>> make this work:
>>>
>>> confirmBtn = new Button("confirm") {
>>>   private static final long serialVersionUID = 1L;
>>>   @Override
>>>   public void onSubmit() {
>>>       Page page = getPage();
>>>       TabbedPanel tabPanel = ((HomePage)getWebPage()).getTabbedPanel();
>>>                    tabPanel.setSelectedTab(0);
>>>       setResponsePage(page);
>>>   }
>>> };
>>>
>>> I cannot repaint the tabPanel (either with render() or
>>> renderComponent()), cannot repaint the whole page, cannot go with Linda's
>>> suggestion because even after Martin's fix it still generates an error. I
>>> just want to set the tabbedpanel's selected tab to be #0. It's not that
>>> complicated. In Swing, I would write: tabPanel.setSelectedTab(0); and that
>>> would be it.
>>>
>>> Now I'm not very critical about how software systems are constructed, and
>>> don't care if some features may cause minor side-effects, or cause the
>>> programmer to write a bit hacky code. But having the setSelectedTab() method
>>> detach the page for no apparent reason and without any warning is as bad as
>>> having a goto command in a programming language. "Side effects" are one of
>>> the first thing that you learn in college, and why you should avoid them at
>>> all cost. The documentation for the setSelectedTab() says "sets the selected
>>> tab". What it's missing is a big warning sign "WARNING!!!! IT DETACHES THE
>>> PAGE!!!! WILL CAUSE UNRELATED ERROR MESSAGES!!!"
>>>
>>> So what is your suggestion Igor? How should I use the framework properly?
>>>
>>> Regards,
>>> Csaba
>>>
>>>
>>> Igor Vaynberg wrote:
>>>>
>>>> of course there is no reason to use an ajax link if all you are going
>>>> to do is repaint the entire page anyways...
>>>>
>>>> also code like this: setresponsepage(getpage()) is always suspect. by
>>>> default wicket repaints the same page so there is no need to call
>>>> this. when inside ajax you should add components you want repainted to
>>>> the request target that is passed in to you.
>>>>
>>>> setresponsepage should only be used when actually going to a different
>>>> page. you are not using the framework properly...
>>>>
>>>> -igor
>>>>
>>>> 2009/7/29 Martin Makundi <ma...@koodaripalvelut.com>:
>>>>
>>>>>
>>>>> 1.
>>>>>
>>>>> You can fix linda's suggestion by calling setOutputMarkupId(true) on
>>>>> your tabbedpanel.
>>>>>
>>>>> 2. The reason for:
>>>>>
>>>>> 10:42:27 ERROR [RequestCycle] - No Page found for component
>>>>> [MarkupContainer [Component id = panel]]
>>>>> java.lang.IllegalStateException: No Page found for component
>>>>> [MarkupContainer [Component id = panel]]
>>>>>     at org.apache.wicket.Component.getPage(Component.java:1729)
>>>>>
>>>>> Is that you just called setSelectedTab() which DISCONNECTS the current
>>>>> tab from the page hierarcy. Try getting the page before that:
>>>>> onClick() {
>>>>>  Page page = getPage();
>>>>>  tabbedPanel.setSelectedTab(0);
>>>>>  setREsponsePage(page);
>>>>> }
>>>>>
>>>>>
>>>>> **
>>>>> Martin
>>>>>
>>>>>
>>>>> **
>>>>> Martin
>>>>>
>>>>> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>>>>>
>>>>>>
>>>>>> Hmm there's something very wrong here...
>>>>>>
>>>>>> I try to refresh the page like this:
>>>>>> setResponsePage(getPage());
>>>>>>
>>>>>> When this is the only action, the current page is refreshed. When I
>>>>>> write
>>>>>> setSelectedTab(0) above it, I get an error.
>>>>>>
>>>>>> 10:42:27 ERROR [RequestCycle] - No Page found for component
>>>>>> [MarkupContainer
>>>>>> [Component id = panel]]
>>>>>> java.lang.IllegalStateException: No Page found for component
>>>>>> [MarkupContainer [Component id = panel]]
>>>>>>      at org.apache.wicket.Component.getPage(Component.java:1729)
>>>>>>      at
>>>>>>
>>>>>> si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:160)
>>>>>>      at
>>>>>>
>>>>>> si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45)
>>>>>>      at
>>>>>>
>>>>>> si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95)
>>>>>>      at
>>>>>>
>>>>>> org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74)
>>>>>>      at
>>>>>>
>>>>>> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140)
>>>>>>      at
>>>>>>
>>>>>> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166)
>>>>>>      at
>>>>>>
>>>>>> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299)
>>>>>>      at
>>>>>>
>>>>>> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105)
>>>>>>      at
>>>>>>
>>>>>> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
>>>>>>      at
>>>>>>
>>>>>> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192)
>>>>>>      at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
>>>>>>      at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
>>>>>>      at org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
>>>>>>      at
>>>>>>
>>>>>> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455)
>>>>>>      at
>>>>>>
>>>>>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288)
>>>>>>      at
>>>>>>
>>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>>>>>>      at
>>>>>>
>>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>>>>>      at
>>>>>>
>>>>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>>>>>>      at
>>>>>>
>>>>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>>>>>>      at
>>>>>>
>>>>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>>>>>>      at
>>>>>>
>>>>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>>>>>      at
>>>>>>
>>>>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>>>>>>      at
>>>>>>
>>>>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
>>>>>>      at
>>>>>>
>>>>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
>>>>>>      at
>>>>>>
>>>>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>>>>>>      at
>>>>>>
>>>>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
>>>>>>      at java.lang.Thread.run(Thread.java:619)
>>>>>>
>>>>>>
>>>>>> I've also tried with render() and renderComponent(), on a page and on
>>>>>> the
>>>>>> tabPanel level...
>>>>>>
>>>>>> Linda's suggestion also generates an error, albeit a different one.
>>>>>> "innertabs" is found in HomePage.html, which looks like this:
>>>>>>
>>>>>> <html>
>>>>>> <head>
>>>>>> </head>
>>>>>> <body>
>>>>>>  <wicket:extend>
>>>>>>      <div wicket:id="innertabs" class="innertabpanel">[inner tabbed
>>>>>> panel
>>>>>> will be here]</div>
>>>>>>  </wicket:extend>
>>>>>> </body>
>>>>>> </html>
>>>>>>
>>>>>> The tabbed panel is the "innertabs". The generated exception is:
>>>>>>
>>>>>> java.lang.IllegalArgumentException: cannot update component that does
>>>>>> not
>>>>>> have setOutputMarkupId property set to true. Component:
>>>>>> [MarkupContainer
>>>>>> [Component id = innertabs]]
>>>>>>   at
>>>>>>
>>>>>> org.apache.wicket.ajax.AjaxRequestTarget.addComponent(AjaxRequestTarget.java:345)
>>>>>>   at
>>>>>>
>>>>>> si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:161)
>>>>>>   at
>>>>>>
>>>>>> si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45)
>>>>>>   at
>>>>>>
>>>>>> si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95)
>>>>>>   at
>>>>>>
>>>>>> org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74)
>>>>>>   at
>>>>>>
>>>>>> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140)
>>>>>>   at
>>>>>>
>>>>>> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166)
>>>>>>   at
>>>>>>
>>>>>> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299)
>>>>>>   at
>>>>>>
>>>>>> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105)
>>>>>>   at
>>>>>>
>>>>>> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
>>>>>>   at
>>>>>>
>>>>>> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192)
>>>>>>   at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
>>>>>>   at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
>>>>>>   at org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
>>>>>>   at
>>>>>>
>>>>>> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455)
>>>>>>   at
>>>>>>
>>>>>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288)
>>>>>>   at
>>>>>>
>>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>>>>>>   at
>>>>>>
>>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>>>>>   at
>>>>>>
>>>>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>>>>>>   at
>>>>>>
>>>>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>>>>>>   at
>>>>>>
>>>>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>>>>>>   at
>>>>>>
>>>>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>>>>>   at
>>>>>>
>>>>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>>>>>>   at
>>>>>>
>>>>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
>>>>>>   at
>>>>>>
>>>>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
>>>>>>   at
>>>>>>
>>>>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>>>>>>   at
>>>>>>
>>>>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
>>>>>>   at java.lang.Thread.run(Thread.java:619)
>>>>>>
>>>>>>
>>>>>> getPage().addOrReplace(tabPanel); also generates some third error...
>>>>>>
>>>>>> tabPanel.addOrReplace(tabPanel); generates an error saying I can't
>>>>>> replace a
>>>>>> component with itself :)
>>>>>>
>>>>>> Writing the complete URL
>>>>>>
>>>>>> ?wicket:interface=:2:innertabs:tabs-container:tabs:0:link:1:ILinkListener::
>>>>>> seems to be the only suggestion which actually works for now.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Martin Makundi wrote:
>>>>>>
>>>>>>>
>>>>>>> Ah.. do you repaint the page after your ajax button call?
>>>>>>>
>>>>>>> **
>>>>>>> Martin
>>>>>>>
>>>>>>> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> This is what the link does in Wicket's source code:
>>>>>>>>
>>>>>>>> new Link(linkId) {
>>>>>>>>         private static final long serialVersionUID = 1L;
>>>>>>>>
>>>>>>>>         @Override
>>>>>>>>         public void onClick() {
>>>>>>>>             setSelectedTab(index);   // <-----
>>>>>>>>         }
>>>>>>>>     };
>>>>>>>>
>>>>>>>>
>>>>>>>> This is my code:
>>>>>>>>  /** Click on the Delete button */
>>>>>>>>  private void deleteBtnClick(AjaxRequestTarget target, Form<?> form)
>>>>>>>> {
>>>>>>>>     TabbedPanel tabPanel =
>>>>>>>> ((HomePage)getWebPage()).getTabbedPanel();
>>>>>>>>     tabPanel.setSelectedTab(0);      // <-------
>>>>>>>>  }
>>>>>>>>
>>>>>>>> Wicket's code works, mine doesn't. I've tried with a button and an
>>>>>>>> ajaxfallbacklink... Maybe I really should redirect to the same page
>>>>>>>> with
>>>>>>>> another parameter, like you did.
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Beginner problems with TabbedPanel

Posted by Gajo Csaba <cg...@i-rose.si>.
Hi Iain,

I solved the problem thanks to martin-g from ##wicket. Seems like the 
problem was I was using a non-ajax tabbed panel with an ajax button. 
When I switched to an ajax panel, it worked great.
I've also tried using a non-ajax tabbed panel with a non-ajax button 
like you suggested, and it also seems to work.

Looks like the only problem here is that you shouldn't mix ajax 
components with non-ajax ones.

Regards,
Csaba


Iain Reddick wrote:
> Surely this is what you want for a non-ajax solution:
>
> class MyPage extends Page {
>  private TabbedPanel tabPanel;
>  ...
>  public MyPage() {
>    tabPanel = new TabPanel(...);
>    add( tabPanel );
>    ...
>    confirmBtn = new Button("confirm") {
>      private static final long serialVersionUID = 1L;
>
>      @Override
>      public void onSubmit() {
>        tabPanel.setSelectedTab(0);
>      }
>    };
>    add( confirmBtn );
>  }
> }
>
> And for an ajax solution, just add tabPanel to the ajax request in the 
> submit handler?
>
> Sorry if this isn't right, but I don't see what the issue is.
>
> Gajo Csaba wrote:
>> That may be true Igor, but there doesn't seem to be any other 
>> solution to make this work:
>>
>> confirmBtn = new Button("confirm") {
>>    private static final long serialVersionUID = 1L;
>>    @Override
>>    public void onSubmit() {
>>        Page page = getPage();
>>        TabbedPanel tabPanel = 
>> ((HomePage)getWebPage()).getTabbedPanel();                      
>> tabPanel.setSelectedTab(0);
>>        setResponsePage(page);
>>    }
>> };
>>
>> I cannot repaint the tabPanel (either with render() or 
>> renderComponent()), cannot repaint the whole page, cannot go with 
>> Linda's suggestion because even after Martin's fix it still generates 
>> an error. I just want to set the tabbedpanel's selected tab to be #0. 
>> It's not that complicated. In Swing, I would write: 
>> tabPanel.setSelectedTab(0); and that would be it.
>>
>> Now I'm not very critical about how software systems are constructed, 
>> and don't care if some features may cause minor side-effects, or 
>> cause the programmer to write a bit hacky code. But having the 
>> setSelectedTab() method detach the page for no apparent reason and 
>> without any warning is as bad as having a goto command in a 
>> programming language. "Side effects" are one of the first thing that 
>> you learn in college, and why you should avoid them at all cost. The 
>> documentation for the setSelectedTab() says "sets the selected tab". 
>> What it's missing is a big warning sign "WARNING!!!! IT DETACHES THE 
>> PAGE!!!! WILL CAUSE UNRELATED ERROR MESSAGES!!!"
>>
>> So what is your suggestion Igor? How should I use the framework 
>> properly?
>>
>> Regards,
>> Csaba
>>
>>
>> Igor Vaynberg wrote:
>>> of course there is no reason to use an ajax link if all you are going
>>> to do is repaint the entire page anyways...
>>>
>>> also code like this: setresponsepage(getpage()) is always suspect. by
>>> default wicket repaints the same page so there is no need to call
>>> this. when inside ajax you should add components you want repainted to
>>> the request target that is passed in to you.
>>>
>>> setresponsepage should only be used when actually going to a different
>>> page. you are not using the framework properly...
>>>
>>> -igor
>>>
>>> 2009/7/29 Martin Makundi <ma...@koodaripalvelut.com>:
>>>  
>>>> 1.
>>>>
>>>> You can fix linda's suggestion by calling setOutputMarkupId(true) on
>>>> your tabbedpanel.
>>>>
>>>> 2. The reason for:
>>>>
>>>> 10:42:27 ERROR [RequestCycle] - No Page found for component
>>>> [MarkupContainer [Component id = panel]]
>>>> java.lang.IllegalStateException: No Page found for component
>>>> [MarkupContainer [Component id = panel]]
>>>>      at org.apache.wicket.Component.getPage(Component.java:1729)
>>>>
>>>> Is that you just called setSelectedTab() which DISCONNECTS the current
>>>> tab from the page hierarcy. Try getting the page before that:
>>>> onClick() {
>>>>  Page page = getPage();
>>>>  tabbedPanel.setSelectedTab(0);
>>>>  setREsponsePage(page);
>>>> }
>>>>
>>>>
>>>> **
>>>> Martin
>>>>
>>>>
>>>> **
>>>> Martin
>>>>
>>>> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>>>>   
>>>>> Hmm there's something very wrong here...
>>>>>
>>>>> I try to refresh the page like this:
>>>>> setResponsePage(getPage());
>>>>>
>>>>> When this is the only action, the current page is refreshed. When 
>>>>> I write
>>>>> setSelectedTab(0) above it, I get an error.
>>>>>
>>>>> 10:42:27 ERROR [RequestCycle] - No Page found for component 
>>>>> [MarkupContainer
>>>>> [Component id = panel]]
>>>>> java.lang.IllegalStateException: No Page found for component
>>>>> [MarkupContainer [Component id = panel]]
>>>>>       at org.apache.wicket.Component.getPage(Component.java:1729)
>>>>>       at
>>>>> si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:160) 
>>>>>
>>>>>       at
>>>>> si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45) 
>>>>>
>>>>>       at
>>>>> si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95) 
>>>>>
>>>>>       at
>>>>> org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74) 
>>>>>
>>>>>       at
>>>>> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140) 
>>>>>
>>>>>       at
>>>>> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166) 
>>>>>
>>>>>       at
>>>>> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299) 
>>>>>
>>>>>       at
>>>>> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105) 
>>>>>
>>>>>       at
>>>>> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92) 
>>>>>
>>>>>       at
>>>>> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192) 
>>>>>
>>>>>       at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
>>>>>       at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
>>>>>       at 
>>>>> org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
>>>>>       at
>>>>> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455) 
>>>>>
>>>>>       at
>>>>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288) 
>>>>>
>>>>>       at
>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
>>>>>
>>>>>       at
>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
>>>>>
>>>>>       at
>>>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 
>>>>>
>>>>>       at
>>>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
>>>>>
>>>>>       at
>>>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) 
>>>>>
>>>>>       at
>>>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
>>>>>
>>>>>       at
>>>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
>>>>>
>>>>>       at
>>>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) 
>>>>>
>>>>>       at
>>>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) 
>>>>>
>>>>>       at
>>>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) 
>>>>>
>>>>>       at
>>>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) 
>>>>>
>>>>>       at java.lang.Thread.run(Thread.java:619)
>>>>>
>>>>>
>>>>> I've also tried with render() and renderComponent(), on a page and 
>>>>> on the
>>>>> tabPanel level...
>>>>>
>>>>> Linda's suggestion also generates an error, albeit a different one.
>>>>> "innertabs" is found in HomePage.html, which looks like this:
>>>>>
>>>>> <html>
>>>>> <head>
>>>>> </head>
>>>>> <body>
>>>>>   <wicket:extend>
>>>>>       <div wicket:id="innertabs" class="innertabpanel">[inner 
>>>>> tabbed panel
>>>>> will be here]</div>
>>>>>   </wicket:extend>
>>>>> </body>
>>>>> </html>
>>>>>
>>>>> The tabbed panel is the "innertabs". The generated exception is:
>>>>>
>>>>> java.lang.IllegalArgumentException: cannot update component that 
>>>>> does not
>>>>> have setOutputMarkupId property set to true. Component: 
>>>>> [MarkupContainer
>>>>> [Component id = innertabs]]
>>>>>    at
>>>>> org.apache.wicket.ajax.AjaxRequestTarget.addComponent(AjaxRequestTarget.java:345) 
>>>>>
>>>>>    at
>>>>> si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:161) 
>>>>>
>>>>>    at
>>>>> si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45) 
>>>>>
>>>>>    at
>>>>> si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95) 
>>>>>
>>>>>    at
>>>>> org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74) 
>>>>>
>>>>>    at
>>>>> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140) 
>>>>>
>>>>>    at
>>>>> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166) 
>>>>>
>>>>>    at
>>>>> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299) 
>>>>>
>>>>>    at
>>>>> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105) 
>>>>>
>>>>>    at
>>>>> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92) 
>>>>>
>>>>>    at
>>>>> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192) 
>>>>>
>>>>>    at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
>>>>>    at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
>>>>>    at org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
>>>>>    at
>>>>> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455) 
>>>>>
>>>>>    at
>>>>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288) 
>>>>>
>>>>>    at
>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
>>>>>
>>>>>    at
>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
>>>>>
>>>>>    at
>>>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 
>>>>>
>>>>>    at
>>>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
>>>>>
>>>>>    at
>>>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) 
>>>>>
>>>>>    at
>>>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
>>>>>
>>>>>    at
>>>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
>>>>>
>>>>>    at
>>>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) 
>>>>>
>>>>>    at
>>>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) 
>>>>>
>>>>>    at
>>>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) 
>>>>>
>>>>>    at
>>>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) 
>>>>>
>>>>>    at java.lang.Thread.run(Thread.java:619)
>>>>>
>>>>>
>>>>> getPage().addOrReplace(tabPanel); also generates some third error...
>>>>>
>>>>> tabPanel.addOrReplace(tabPanel); generates an error saying I can't 
>>>>> replace a
>>>>> component with itself :)
>>>>>
>>>>> Writing the complete URL
>>>>> ?wicket:interface=:2:innertabs:tabs-container:tabs:0:link:1:ILinkListener:: 
>>>>>
>>>>> seems to be the only suggestion which actually works for now.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Martin Makundi wrote:
>>>>>     
>>>>>> Ah.. do you repaint the page after your ajax button call?
>>>>>>
>>>>>> **
>>>>>> Martin
>>>>>>
>>>>>> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>>>>>>
>>>>>>       
>>>>>>> This is what the link does in Wicket's source code:
>>>>>>>
>>>>>>> new Link(linkId) {
>>>>>>>          private static final long serialVersionUID = 1L;
>>>>>>>
>>>>>>>          @Override
>>>>>>>          public void onClick() {
>>>>>>>              setSelectedTab(index);   // <-----
>>>>>>>          }
>>>>>>>      };
>>>>>>>
>>>>>>>
>>>>>>> This is my code:
>>>>>>>  /** Click on the Delete button */
>>>>>>>  private void deleteBtnClick(AjaxRequestTarget target, Form<?> 
>>>>>>> form) {
>>>>>>>      TabbedPanel tabPanel = 
>>>>>>> ((HomePage)getWebPage()).getTabbedPanel();
>>>>>>>      tabPanel.setSelectedTab(0);      // <-------
>>>>>>>  }
>>>>>>>
>>>>>>> Wicket's code works, mine doesn't. I've tried with a button and an
>>>>>>> ajaxfallbacklink... Maybe I really should redirect to the same 
>>>>>>> page with
>>>>>>> another parameter, like you did.
>>>>>>>
>>>>>>>           
>>>>>> --------------------------------------------------------------------- 
>>>>>>
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>         
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>       
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>     
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>   
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: Beginner problems with TabbedPanel

Posted by Igor Vaynberg <ig...@gmail.com>.
TabbedPanel tb=new TabbedPanel("tb");
tb.setOutputMarkupId(true);

<div wicket:id="tb"></div>

on panel 2...

add(new AjaxFallbackLink("switch"){
	public void onClick(AjaxRequestTarget target) {
		TabbedPanel tb = findParent(TabbedPanel.class);
		tb.setSelectedTab(0);
		if (target != null){target.addComponent(tb);}
	}
});

this is how the framework is meant to be used. the following works
with ajax when js is enabled and a regular refresh when js is
disabled.

clean and simple.

-igor

On Thu, Jul 30, 2009 at 1:35 AM, Gajo Csaba<cg...@i-rose.si> wrote:
> That may be true Igor, but there doesn't seem to be any other solution to
> make this work:
>
> confirmBtn = new Button("confirm") {
>   private static final long serialVersionUID = 1L;
>   @Override
>   public void onSubmit() {
>       Page page = getPage();
>       TabbedPanel tabPanel = ((HomePage)getWebPage()).getTabbedPanel();
>                 tabPanel.setSelectedTab(0);
>       setResponsePage(page);
>   }
> };
>
> I cannot repaint the tabPanel (either with render() or renderComponent()),
> cannot repaint the whole page, cannot go with Linda's suggestion because
> even after Martin's fix it still generates an error. I just want to set the
> tabbedpanel's selected tab to be #0. It's not that complicated. In Swing, I
> would write: tabPanel.setSelectedTab(0); and that would be it.
>
> Now I'm not very critical about how software systems are constructed, and
> don't care if some features may cause minor side-effects, or cause the
> programmer to write a bit hacky code. But having the setSelectedTab() method
> detach the page for no apparent reason and without any warning is as bad as
> having a goto command in a programming language. "Side effects" are one of
> the first thing that you learn in college, and why you should avoid them at
> all cost. The documentation for the setSelectedTab() says "sets the selected
> tab". What it's missing is a big warning sign "WARNING!!!! IT DETACHES THE
> PAGE!!!! WILL CAUSE UNRELATED ERROR MESSAGES!!!"
>
> So what is your suggestion Igor? How should I use the framework properly?
>
> Regards,
> Csaba
>
>
> Igor Vaynberg wrote:
>>
>> of course there is no reason to use an ajax link if all you are going
>> to do is repaint the entire page anyways...
>>
>> also code like this: setresponsepage(getpage()) is always suspect. by
>> default wicket repaints the same page so there is no need to call
>> this. when inside ajax you should add components you want repainted to
>> the request target that is passed in to you.
>>
>> setresponsepage should only be used when actually going to a different
>> page. you are not using the framework properly...
>>
>> -igor
>>
>> 2009/7/29 Martin Makundi <ma...@koodaripalvelut.com>:
>>
>>>
>>> 1.
>>>
>>> You can fix linda's suggestion by calling setOutputMarkupId(true) on
>>> your tabbedpanel.
>>>
>>> 2. The reason for:
>>>
>>> 10:42:27 ERROR [RequestCycle] - No Page found for component
>>> [MarkupContainer [Component id = panel]]
>>> java.lang.IllegalStateException: No Page found for component
>>> [MarkupContainer [Component id = panel]]
>>>     at org.apache.wicket.Component.getPage(Component.java:1729)
>>>
>>> Is that you just called setSelectedTab() which DISCONNECTS the current
>>> tab from the page hierarcy. Try getting the page before that:
>>> onClick() {
>>>  Page page = getPage();
>>>  tabbedPanel.setSelectedTab(0);
>>>  setREsponsePage(page);
>>> }
>>>
>>>
>>> **
>>> Martin
>>>
>>>
>>> **
>>> Martin
>>>
>>> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>>>
>>>>
>>>> Hmm there's something very wrong here...
>>>>
>>>> I try to refresh the page like this:
>>>> setResponsePage(getPage());
>>>>
>>>> When this is the only action, the current page is refreshed. When I
>>>> write
>>>> setSelectedTab(0) above it, I get an error.
>>>>
>>>> 10:42:27 ERROR [RequestCycle] - No Page found for component
>>>> [MarkupContainer
>>>> [Component id = panel]]
>>>> java.lang.IllegalStateException: No Page found for component
>>>> [MarkupContainer [Component id = panel]]
>>>>      at org.apache.wicket.Component.getPage(Component.java:1729)
>>>>      at
>>>>
>>>> si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:160)
>>>>      at
>>>>
>>>> si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45)
>>>>      at
>>>>
>>>> si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95)
>>>>      at
>>>>
>>>> org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74)
>>>>      at
>>>>
>>>> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140)
>>>>      at
>>>>
>>>> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166)
>>>>      at
>>>>
>>>> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299)
>>>>      at
>>>>
>>>> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105)
>>>>      at
>>>>
>>>> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
>>>>      at
>>>>
>>>> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192)
>>>>      at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
>>>>      at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
>>>>      at org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
>>>>      at
>>>>
>>>> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455)
>>>>      at
>>>>
>>>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288)
>>>>      at
>>>>
>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>>>>      at
>>>>
>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>>>      at
>>>>
>>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>>>>      at
>>>>
>>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>>>>      at
>>>>
>>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>>>>      at
>>>>
>>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>>>      at
>>>>
>>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>>>>      at
>>>>
>>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
>>>>      at
>>>>
>>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
>>>>      at
>>>>
>>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>>>>      at
>>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
>>>>      at java.lang.Thread.run(Thread.java:619)
>>>>
>>>>
>>>> I've also tried with render() and renderComponent(), on a page and on
>>>> the
>>>> tabPanel level...
>>>>
>>>> Linda's suggestion also generates an error, albeit a different one.
>>>> "innertabs" is found in HomePage.html, which looks like this:
>>>>
>>>> <html>
>>>> <head>
>>>> </head>
>>>> <body>
>>>>  <wicket:extend>
>>>>      <div wicket:id="innertabs" class="innertabpanel">[inner tabbed
>>>> panel
>>>> will be here]</div>
>>>>  </wicket:extend>
>>>> </body>
>>>> </html>
>>>>
>>>> The tabbed panel is the "innertabs". The generated exception is:
>>>>
>>>> java.lang.IllegalArgumentException: cannot update component that does
>>>> not
>>>> have setOutputMarkupId property set to true. Component: [MarkupContainer
>>>> [Component id = innertabs]]
>>>>   at
>>>>
>>>> org.apache.wicket.ajax.AjaxRequestTarget.addComponent(AjaxRequestTarget.java:345)
>>>>   at
>>>>
>>>> si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:161)
>>>>   at
>>>>
>>>> si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45)
>>>>   at
>>>>
>>>> si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95)
>>>>   at
>>>>
>>>> org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74)
>>>>   at
>>>>
>>>> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140)
>>>>   at
>>>>
>>>> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166)
>>>>   at
>>>>
>>>> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299)
>>>>   at
>>>>
>>>> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105)
>>>>   at
>>>>
>>>> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
>>>>   at
>>>>
>>>> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192)
>>>>   at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
>>>>   at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
>>>>   at org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
>>>>   at
>>>>
>>>> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455)
>>>>   at
>>>>
>>>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288)
>>>>   at
>>>>
>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>>>>   at
>>>>
>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>>>   at
>>>>
>>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>>>>   at
>>>>
>>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>>>>   at
>>>>
>>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>>>>   at
>>>>
>>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>>>   at
>>>>
>>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>>>>   at
>>>>
>>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
>>>>   at
>>>>
>>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
>>>>   at
>>>>
>>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>>>>   at
>>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
>>>>   at java.lang.Thread.run(Thread.java:619)
>>>>
>>>>
>>>> getPage().addOrReplace(tabPanel); also generates some third error...
>>>>
>>>> tabPanel.addOrReplace(tabPanel); generates an error saying I can't
>>>> replace a
>>>> component with itself :)
>>>>
>>>> Writing the complete URL
>>>>
>>>> ?wicket:interface=:2:innertabs:tabs-container:tabs:0:link:1:ILinkListener::
>>>> seems to be the only suggestion which actually works for now.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Martin Makundi wrote:
>>>>
>>>>>
>>>>> Ah.. do you repaint the page after your ajax button call?
>>>>>
>>>>> **
>>>>> Martin
>>>>>
>>>>> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>>>>>
>>>>>
>>>>>>
>>>>>> This is what the link does in Wicket's source code:
>>>>>>
>>>>>> new Link(linkId) {
>>>>>>         private static final long serialVersionUID = 1L;
>>>>>>
>>>>>>         @Override
>>>>>>         public void onClick() {
>>>>>>             setSelectedTab(index);   // <-----
>>>>>>         }
>>>>>>     };
>>>>>>
>>>>>>
>>>>>> This is my code:
>>>>>>  /** Click on the Delete button */
>>>>>>  private void deleteBtnClick(AjaxRequestTarget target, Form<?> form) {
>>>>>>     TabbedPanel tabPanel = ((HomePage)getWebPage()).getTabbedPanel();
>>>>>>     tabPanel.setSelectedTab(0);      // <-------
>>>>>>  }
>>>>>>
>>>>>> Wicket's code works, mine doesn't. I've tried with a button and an
>>>>>> ajaxfallbacklink... Maybe I really should redirect to the same page
>>>>>> with
>>>>>> another parameter, like you did.
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Beginner problems with TabbedPanel

Posted by Iain Reddick <ia...@beatsystems.com>.
confirmBtn = new Button("confirm") {
   private static final long serialVersionUID = 1L;
   @Override
   public void onSubmit() {
       Page homePage = (HomePage)getPage();
       homePage.getTabbedPanel().setSelectedTab(0);
   }
};

Iain Reddick wrote:
> Sorry - I've re-read your initial post and see what your issue is.
>
> Iain Reddick wrote:
>> Surely this is what you want for a non-ajax solution:
>>
>> class MyPage extends Page {
>>  private TabbedPanel tabPanel;
>>  ...
>>  public MyPage() {
>>    tabPanel = new TabPanel(...);
>>    add( tabPanel );
>>    ...
>>    confirmBtn = new Button("confirm") {
>>      private static final long serialVersionUID = 1L;
>>
>>      @Override
>>      public void onSubmit() {
>>        tabPanel.setSelectedTab(0);
>>      }
>>    };
>>    add( confirmBtn );
>>  }
>> }
>>
>> And for an ajax solution, just add tabPanel to the ajax request in 
>> the submit handler?
>>
>> Sorry if this isn't right, but I don't see what the issue is.
>>
>> Gajo Csaba wrote:
>>> That may be true Igor, but there doesn't seem to be any other 
>>> solution to make this work:
>>>
>>> confirmBtn = new Button("confirm") {
>>>    private static final long serialVersionUID = 1L;
>>>    @Override
>>>    public void onSubmit() {
>>>        Page page = getPage();
>>>        TabbedPanel tabPanel = 
>>> ((HomePage)getWebPage()).getTabbedPanel();                      
>>> tabPanel.setSelectedTab(0);
>>>        setResponsePage(page);
>>>    }
>>> };
>>>
>>> I cannot repaint the tabPanel (either with render() or 
>>> renderComponent()), cannot repaint the whole page, cannot go with 
>>> Linda's suggestion because even after Martin's fix it still 
>>> generates an error. I just want to set the tabbedpanel's selected 
>>> tab to be #0. It's not that complicated. In Swing, I would write: 
>>> tabPanel.setSelectedTab(0); and that would be it.
>>>
>>> Now I'm not very critical about how software systems are 
>>> constructed, and don't care if some features may cause minor 
>>> side-effects, or cause the programmer to write a bit hacky code. But 
>>> having the setSelectedTab() method detach the page for no apparent 
>>> reason and without any warning is as bad as having a goto command in 
>>> a programming language. "Side effects" are one of the first thing 
>>> that you learn in college, and why you should avoid them at all 
>>> cost. The documentation for the setSelectedTab() says "sets the 
>>> selected tab". What it's missing is a big warning sign "WARNING!!!! 
>>> IT DETACHES THE PAGE!!!! WILL CAUSE UNRELATED ERROR MESSAGES!!!"
>>>
>>> So what is your suggestion Igor? How should I use the framework 
>>> properly?
>>>
>>> Regards,
>>> Csaba
>>>
>>>
>>> Igor Vaynberg wrote:
>>>> of course there is no reason to use an ajax link if all you are going
>>>> to do is repaint the entire page anyways...
>>>>
>>>> also code like this: setresponsepage(getpage()) is always suspect. by
>>>> default wicket repaints the same page so there is no need to call
>>>> this. when inside ajax you should add components you want repainted to
>>>> the request target that is passed in to you.
>>>>
>>>> setresponsepage should only be used when actually going to a different
>>>> page. you are not using the framework properly...
>>>>
>>>> -igor
>>>>
>>>> 2009/7/29 Martin Makundi <ma...@koodaripalvelut.com>:
>>>>  
>>>>> 1.
>>>>>
>>>>> You can fix linda's suggestion by calling setOutputMarkupId(true) on
>>>>> your tabbedpanel.
>>>>>
>>>>> 2. The reason for:
>>>>>
>>>>> 10:42:27 ERROR [RequestCycle] - No Page found for component
>>>>> [MarkupContainer [Component id = panel]]
>>>>> java.lang.IllegalStateException: No Page found for component
>>>>> [MarkupContainer [Component id = panel]]
>>>>>      at org.apache.wicket.Component.getPage(Component.java:1729)
>>>>>
>>>>> Is that you just called setSelectedTab() which DISCONNECTS the 
>>>>> current
>>>>> tab from the page hierarcy. Try getting the page before that:
>>>>> onClick() {
>>>>>  Page page = getPage();
>>>>>  tabbedPanel.setSelectedTab(0);
>>>>>  setREsponsePage(page);
>>>>> }
>>>>>
>>>>>
>>>>> **
>>>>> Martin
>>>>>
>>>>>
>>>>> **
>>>>> Martin
>>>>>
>>>>> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>>>>>  
>>>>>> Hmm there's something very wrong here...
>>>>>>
>>>>>> I try to refresh the page like this:
>>>>>> setResponsePage(getPage());
>>>>>>
>>>>>> When this is the only action, the current page is refreshed. When 
>>>>>> I write
>>>>>> setSelectedTab(0) above it, I get an error.
>>>>>>
>>>>>> 10:42:27 ERROR [RequestCycle] - No Page found for component 
>>>>>> [MarkupContainer
>>>>>> [Component id = panel]]
>>>>>> java.lang.IllegalStateException: No Page found for component
>>>>>> [MarkupContainer [Component id = panel]]
>>>>>>       at org.apache.wicket.Component.getPage(Component.java:1729)
>>>>>>       at
>>>>>> si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:160) 
>>>>>>
>>>>>>       at
>>>>>> si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45) 
>>>>>>
>>>>>>       at
>>>>>> si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95) 
>>>>>>
>>>>>>       at
>>>>>> org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74) 
>>>>>>
>>>>>>       at
>>>>>> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140) 
>>>>>>
>>>>>>       at
>>>>>> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166) 
>>>>>>
>>>>>>       at
>>>>>> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299) 
>>>>>>
>>>>>>       at
>>>>>> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105) 
>>>>>>
>>>>>>       at
>>>>>> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92) 
>>>>>>
>>>>>>       at
>>>>>> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192) 
>>>>>>
>>>>>>       at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
>>>>>>       at 
>>>>>> org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
>>>>>>       at 
>>>>>> org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
>>>>>>       at
>>>>>> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455) 
>>>>>>
>>>>>>       at
>>>>>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288) 
>>>>>>
>>>>>>       at
>>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
>>>>>>
>>>>>>       at
>>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
>>>>>>
>>>>>>       at
>>>>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 
>>>>>>
>>>>>>       at
>>>>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
>>>>>>
>>>>>>       at
>>>>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) 
>>>>>>
>>>>>>       at
>>>>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
>>>>>>
>>>>>>       at
>>>>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
>>>>>>
>>>>>>       at
>>>>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) 
>>>>>>
>>>>>>       at
>>>>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) 
>>>>>>
>>>>>>       at
>>>>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) 
>>>>>>
>>>>>>       at
>>>>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) 
>>>>>>
>>>>>>       at java.lang.Thread.run(Thread.java:619)
>>>>>>
>>>>>>
>>>>>> I've also tried with render() and renderComponent(), on a page 
>>>>>> and on the
>>>>>> tabPanel level...
>>>>>>
>>>>>> Linda's suggestion also generates an error, albeit a different one.
>>>>>> "innertabs" is found in HomePage.html, which looks like this:
>>>>>>
>>>>>> <html>
>>>>>> <head>
>>>>>> </head>
>>>>>> <body>
>>>>>>   <wicket:extend>
>>>>>>       <div wicket:id="innertabs" class="innertabpanel">[inner 
>>>>>> tabbed panel
>>>>>> will be here]</div>
>>>>>>   </wicket:extend>
>>>>>> </body>
>>>>>> </html>
>>>>>>
>>>>>> The tabbed panel is the "innertabs". The generated exception is:
>>>>>>
>>>>>> java.lang.IllegalArgumentException: cannot update component that 
>>>>>> does not
>>>>>> have setOutputMarkupId property set to true. Component: 
>>>>>> [MarkupContainer
>>>>>> [Component id = innertabs]]
>>>>>>    at
>>>>>> org.apache.wicket.ajax.AjaxRequestTarget.addComponent(AjaxRequestTarget.java:345) 
>>>>>>
>>>>>>    at
>>>>>> si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:161) 
>>>>>>
>>>>>>    at
>>>>>> si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45) 
>>>>>>
>>>>>>    at
>>>>>> si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95) 
>>>>>>
>>>>>>    at
>>>>>> org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74) 
>>>>>>
>>>>>>    at
>>>>>> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140) 
>>>>>>
>>>>>>    at
>>>>>> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166) 
>>>>>>
>>>>>>    at
>>>>>> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299) 
>>>>>>
>>>>>>    at
>>>>>> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105) 
>>>>>>
>>>>>>    at
>>>>>> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92) 
>>>>>>
>>>>>>    at
>>>>>> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192) 
>>>>>>
>>>>>>    at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
>>>>>>    at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
>>>>>>    at org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
>>>>>>    at
>>>>>> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455) 
>>>>>>
>>>>>>    at
>>>>>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288) 
>>>>>>
>>>>>>    at
>>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
>>>>>>
>>>>>>    at
>>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
>>>>>>
>>>>>>    at
>>>>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 
>>>>>>
>>>>>>    at
>>>>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
>>>>>>
>>>>>>    at
>>>>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) 
>>>>>>
>>>>>>    at
>>>>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
>>>>>>
>>>>>>    at
>>>>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
>>>>>>
>>>>>>    at
>>>>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) 
>>>>>>
>>>>>>    at
>>>>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) 
>>>>>>
>>>>>>    at
>>>>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) 
>>>>>>
>>>>>>    at
>>>>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) 
>>>>>>
>>>>>>    at java.lang.Thread.run(Thread.java:619)
>>>>>>
>>>>>>
>>>>>> getPage().addOrReplace(tabPanel); also generates some third error...
>>>>>>
>>>>>> tabPanel.addOrReplace(tabPanel); generates an error saying I 
>>>>>> can't replace a
>>>>>> component with itself :)
>>>>>>
>>>>>> Writing the complete URL
>>>>>> ?wicket:interface=:2:innertabs:tabs-container:tabs:0:link:1:ILinkListener:: 
>>>>>>
>>>>>> seems to be the only suggestion which actually works for now.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Martin Makundi wrote:
>>>>>>    
>>>>>>> Ah.. do you repaint the page after your ajax button call?
>>>>>>>
>>>>>>> **
>>>>>>> Martin
>>>>>>>
>>>>>>> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>>>>>>>
>>>>>>>      
>>>>>>>> This is what the link does in Wicket's source code:
>>>>>>>>
>>>>>>>> new Link(linkId) {
>>>>>>>>          private static final long serialVersionUID = 1L;
>>>>>>>>
>>>>>>>>          @Override
>>>>>>>>          public void onClick() {
>>>>>>>>              setSelectedTab(index);   // <-----
>>>>>>>>          }
>>>>>>>>      };
>>>>>>>>
>>>>>>>>
>>>>>>>> This is my code:
>>>>>>>>  /** Click on the Delete button */
>>>>>>>>  private void deleteBtnClick(AjaxRequestTarget target, Form<?> 
>>>>>>>> form) {
>>>>>>>>      TabbedPanel tabPanel = 
>>>>>>>> ((HomePage)getWebPage()).getTabbedPanel();
>>>>>>>>      tabPanel.setSelectedTab(0);      // <-------
>>>>>>>>  }
>>>>>>>>
>>>>>>>> Wicket's code works, mine doesn't. I've tried with a button and an
>>>>>>>> ajaxfallbacklink... Maybe I really should redirect to the same 
>>>>>>>> page with
>>>>>>>> another parameter, like you did.
>>>>>>>>
>>>>>>>>           
>>>>>>> --------------------------------------------------------------------- 
>>>>>>>
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>         
>>>>>> --------------------------------------------------------------------- 
>>>>>>
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>       
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>     
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>   
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: Beginner problems with TabbedPanel

Posted by Iain Reddick <ia...@beatsystems.com>.
Sorry - I've re-read your initial post and see what your issue is.

Iain Reddick wrote:
> Surely this is what you want for a non-ajax solution:
>
> class MyPage extends Page {
>  private TabbedPanel tabPanel;
>  ...
>  public MyPage() {
>    tabPanel = new TabPanel(...);
>    add( tabPanel );
>    ...
>    confirmBtn = new Button("confirm") {
>      private static final long serialVersionUID = 1L;
>
>      @Override
>      public void onSubmit() {
>        tabPanel.setSelectedTab(0);
>      }
>    };
>    add( confirmBtn );
>  }
> }
>
> And for an ajax solution, just add tabPanel to the ajax request in the 
> submit handler?
>
> Sorry if this isn't right, but I don't see what the issue is.
>
> Gajo Csaba wrote:
>> That may be true Igor, but there doesn't seem to be any other 
>> solution to make this work:
>>
>> confirmBtn = new Button("confirm") {
>>    private static final long serialVersionUID = 1L;
>>    @Override
>>    public void onSubmit() {
>>        Page page = getPage();
>>        TabbedPanel tabPanel = 
>> ((HomePage)getWebPage()).getTabbedPanel();                      
>> tabPanel.setSelectedTab(0);
>>        setResponsePage(page);
>>    }
>> };
>>
>> I cannot repaint the tabPanel (either with render() or 
>> renderComponent()), cannot repaint the whole page, cannot go with 
>> Linda's suggestion because even after Martin's fix it still generates 
>> an error. I just want to set the tabbedpanel's selected tab to be #0. 
>> It's not that complicated. In Swing, I would write: 
>> tabPanel.setSelectedTab(0); and that would be it.
>>
>> Now I'm not very critical about how software systems are constructed, 
>> and don't care if some features may cause minor side-effects, or 
>> cause the programmer to write a bit hacky code. But having the 
>> setSelectedTab() method detach the page for no apparent reason and 
>> without any warning is as bad as having a goto command in a 
>> programming language. "Side effects" are one of the first thing that 
>> you learn in college, and why you should avoid them at all cost. The 
>> documentation for the setSelectedTab() says "sets the selected tab". 
>> What it's missing is a big warning sign "WARNING!!!! IT DETACHES THE 
>> PAGE!!!! WILL CAUSE UNRELATED ERROR MESSAGES!!!"
>>
>> So what is your suggestion Igor? How should I use the framework 
>> properly?
>>
>> Regards,
>> Csaba
>>
>>
>> Igor Vaynberg wrote:
>>> of course there is no reason to use an ajax link if all you are going
>>> to do is repaint the entire page anyways...
>>>
>>> also code like this: setresponsepage(getpage()) is always suspect. by
>>> default wicket repaints the same page so there is no need to call
>>> this. when inside ajax you should add components you want repainted to
>>> the request target that is passed in to you.
>>>
>>> setresponsepage should only be used when actually going to a different
>>> page. you are not using the framework properly...
>>>
>>> -igor
>>>
>>> 2009/7/29 Martin Makundi <ma...@koodaripalvelut.com>:
>>>  
>>>> 1.
>>>>
>>>> You can fix linda's suggestion by calling setOutputMarkupId(true) on
>>>> your tabbedpanel.
>>>>
>>>> 2. The reason for:
>>>>
>>>> 10:42:27 ERROR [RequestCycle] - No Page found for component
>>>> [MarkupContainer [Component id = panel]]
>>>> java.lang.IllegalStateException: No Page found for component
>>>> [MarkupContainer [Component id = panel]]
>>>>      at org.apache.wicket.Component.getPage(Component.java:1729)
>>>>
>>>> Is that you just called setSelectedTab() which DISCONNECTS the current
>>>> tab from the page hierarcy. Try getting the page before that:
>>>> onClick() {
>>>>  Page page = getPage();
>>>>  tabbedPanel.setSelectedTab(0);
>>>>  setREsponsePage(page);
>>>> }
>>>>
>>>>
>>>> **
>>>> Martin
>>>>
>>>>
>>>> **
>>>> Martin
>>>>
>>>> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>>>>   
>>>>> Hmm there's something very wrong here...
>>>>>
>>>>> I try to refresh the page like this:
>>>>> setResponsePage(getPage());
>>>>>
>>>>> When this is the only action, the current page is refreshed. When 
>>>>> I write
>>>>> setSelectedTab(0) above it, I get an error.
>>>>>
>>>>> 10:42:27 ERROR [RequestCycle] - No Page found for component 
>>>>> [MarkupContainer
>>>>> [Component id = panel]]
>>>>> java.lang.IllegalStateException: No Page found for component
>>>>> [MarkupContainer [Component id = panel]]
>>>>>       at org.apache.wicket.Component.getPage(Component.java:1729)
>>>>>       at
>>>>> si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:160) 
>>>>>
>>>>>       at
>>>>> si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45) 
>>>>>
>>>>>       at
>>>>> si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95) 
>>>>>
>>>>>       at
>>>>> org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74) 
>>>>>
>>>>>       at
>>>>> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140) 
>>>>>
>>>>>       at
>>>>> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166) 
>>>>>
>>>>>       at
>>>>> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299) 
>>>>>
>>>>>       at
>>>>> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105) 
>>>>>
>>>>>       at
>>>>> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92) 
>>>>>
>>>>>       at
>>>>> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192) 
>>>>>
>>>>>       at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
>>>>>       at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
>>>>>       at 
>>>>> org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
>>>>>       at
>>>>> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455) 
>>>>>
>>>>>       at
>>>>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288) 
>>>>>
>>>>>       at
>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
>>>>>
>>>>>       at
>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
>>>>>
>>>>>       at
>>>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 
>>>>>
>>>>>       at
>>>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
>>>>>
>>>>>       at
>>>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) 
>>>>>
>>>>>       at
>>>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
>>>>>
>>>>>       at
>>>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
>>>>>
>>>>>       at
>>>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) 
>>>>>
>>>>>       at
>>>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) 
>>>>>
>>>>>       at
>>>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) 
>>>>>
>>>>>       at
>>>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) 
>>>>>
>>>>>       at java.lang.Thread.run(Thread.java:619)
>>>>>
>>>>>
>>>>> I've also tried with render() and renderComponent(), on a page and 
>>>>> on the
>>>>> tabPanel level...
>>>>>
>>>>> Linda's suggestion also generates an error, albeit a different one.
>>>>> "innertabs" is found in HomePage.html, which looks like this:
>>>>>
>>>>> <html>
>>>>> <head>
>>>>> </head>
>>>>> <body>
>>>>>   <wicket:extend>
>>>>>       <div wicket:id="innertabs" class="innertabpanel">[inner 
>>>>> tabbed panel
>>>>> will be here]</div>
>>>>>   </wicket:extend>
>>>>> </body>
>>>>> </html>
>>>>>
>>>>> The tabbed panel is the "innertabs". The generated exception is:
>>>>>
>>>>> java.lang.IllegalArgumentException: cannot update component that 
>>>>> does not
>>>>> have setOutputMarkupId property set to true. Component: 
>>>>> [MarkupContainer
>>>>> [Component id = innertabs]]
>>>>>    at
>>>>> org.apache.wicket.ajax.AjaxRequestTarget.addComponent(AjaxRequestTarget.java:345) 
>>>>>
>>>>>    at
>>>>> si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:161) 
>>>>>
>>>>>    at
>>>>> si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45) 
>>>>>
>>>>>    at
>>>>> si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95) 
>>>>>
>>>>>    at
>>>>> org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74) 
>>>>>
>>>>>    at
>>>>> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140) 
>>>>>
>>>>>    at
>>>>> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166) 
>>>>>
>>>>>    at
>>>>> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299) 
>>>>>
>>>>>    at
>>>>> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105) 
>>>>>
>>>>>    at
>>>>> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92) 
>>>>>
>>>>>    at
>>>>> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192) 
>>>>>
>>>>>    at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
>>>>>    at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
>>>>>    at org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
>>>>>    at
>>>>> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455) 
>>>>>
>>>>>    at
>>>>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288) 
>>>>>
>>>>>    at
>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
>>>>>
>>>>>    at
>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
>>>>>
>>>>>    at
>>>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 
>>>>>
>>>>>    at
>>>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
>>>>>
>>>>>    at
>>>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) 
>>>>>
>>>>>    at
>>>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
>>>>>
>>>>>    at
>>>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
>>>>>
>>>>>    at
>>>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) 
>>>>>
>>>>>    at
>>>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) 
>>>>>
>>>>>    at
>>>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) 
>>>>>
>>>>>    at
>>>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) 
>>>>>
>>>>>    at java.lang.Thread.run(Thread.java:619)
>>>>>
>>>>>
>>>>> getPage().addOrReplace(tabPanel); also generates some third error...
>>>>>
>>>>> tabPanel.addOrReplace(tabPanel); generates an error saying I can't 
>>>>> replace a
>>>>> component with itself :)
>>>>>
>>>>> Writing the complete URL
>>>>> ?wicket:interface=:2:innertabs:tabs-container:tabs:0:link:1:ILinkListener:: 
>>>>>
>>>>> seems to be the only suggestion which actually works for now.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Martin Makundi wrote:
>>>>>     
>>>>>> Ah.. do you repaint the page after your ajax button call?
>>>>>>
>>>>>> **
>>>>>> Martin
>>>>>>
>>>>>> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>>>>>>
>>>>>>       
>>>>>>> This is what the link does in Wicket's source code:
>>>>>>>
>>>>>>> new Link(linkId) {
>>>>>>>          private static final long serialVersionUID = 1L;
>>>>>>>
>>>>>>>          @Override
>>>>>>>          public void onClick() {
>>>>>>>              setSelectedTab(index);   // <-----
>>>>>>>          }
>>>>>>>      };
>>>>>>>
>>>>>>>
>>>>>>> This is my code:
>>>>>>>  /** Click on the Delete button */
>>>>>>>  private void deleteBtnClick(AjaxRequestTarget target, Form<?> 
>>>>>>> form) {
>>>>>>>      TabbedPanel tabPanel = 
>>>>>>> ((HomePage)getWebPage()).getTabbedPanel();
>>>>>>>      tabPanel.setSelectedTab(0);      // <-------
>>>>>>>  }
>>>>>>>
>>>>>>> Wicket's code works, mine doesn't. I've tried with a button and an
>>>>>>> ajaxfallbacklink... Maybe I really should redirect to the same 
>>>>>>> page with
>>>>>>> another parameter, like you did.
>>>>>>>
>>>>>>>           
>>>>>> --------------------------------------------------------------------- 
>>>>>>
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>         
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>       
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>     
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>   
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: Beginner problems with TabbedPanel

Posted by Iain Reddick <ia...@beatsystems.com>.
Surely this is what you want for a non-ajax solution:

class MyPage extends Page {
  private TabbedPanel tabPanel;
  ...
  public MyPage() {
    tabPanel = new TabPanel(...);
    add( tabPanel );
    ...
    confirmBtn = new Button("confirm") {
      private static final long serialVersionUID = 1L;
 
      @Override
      public void onSubmit() {
        tabPanel.setSelectedTab(0);
      }
    };
    add( confirmBtn );
  }
}

And for an ajax solution, just add tabPanel to the ajax request in the 
submit handler?

Sorry if this isn't right, but I don't see what the issue is.

Gajo Csaba wrote:
> That may be true Igor, but there doesn't seem to be any other solution 
> to make this work:
>
> confirmBtn = new Button("confirm") {
>    private static final long serialVersionUID = 1L;
>    @Override
>    public void onSubmit() {
>        Page page = getPage();
>        TabbedPanel tabPanel = 
> ((HomePage)getWebPage()).getTabbedPanel();                      
> tabPanel.setSelectedTab(0);
>        setResponsePage(page);
>    }
> };
>
> I cannot repaint the tabPanel (either with render() or 
> renderComponent()), cannot repaint the whole page, cannot go with 
> Linda's suggestion because even after Martin's fix it still generates 
> an error. I just want to set the tabbedpanel's selected tab to be #0. 
> It's not that complicated. In Swing, I would write: 
> tabPanel.setSelectedTab(0); and that would be it.
>
> Now I'm not very critical about how software systems are constructed, 
> and don't care if some features may cause minor side-effects, or cause 
> the programmer to write a bit hacky code. But having the 
> setSelectedTab() method detach the page for no apparent reason and 
> without any warning is as bad as having a goto command in a 
> programming language. "Side effects" are one of the first thing that 
> you learn in college, and why you should avoid them at all cost. The 
> documentation for the setSelectedTab() says "sets the selected tab". 
> What it's missing is a big warning sign "WARNING!!!! IT DETACHES THE 
> PAGE!!!! WILL CAUSE UNRELATED ERROR MESSAGES!!!"
>
> So what is your suggestion Igor? How should I use the framework properly?
>
> Regards,
> Csaba
>
>
> Igor Vaynberg wrote:
>> of course there is no reason to use an ajax link if all you are going
>> to do is repaint the entire page anyways...
>>
>> also code like this: setresponsepage(getpage()) is always suspect. by
>> default wicket repaints the same page so there is no need to call
>> this. when inside ajax you should add components you want repainted to
>> the request target that is passed in to you.
>>
>> setresponsepage should only be used when actually going to a different
>> page. you are not using the framework properly...
>>
>> -igor
>>
>> 2009/7/29 Martin Makundi <ma...@koodaripalvelut.com>:
>>  
>>> 1.
>>>
>>> You can fix linda's suggestion by calling setOutputMarkupId(true) on
>>> your tabbedpanel.
>>>
>>> 2. The reason for:
>>>
>>> 10:42:27 ERROR [RequestCycle] - No Page found for component
>>> [MarkupContainer [Component id = panel]]
>>> java.lang.IllegalStateException: No Page found for component
>>> [MarkupContainer [Component id = panel]]
>>>      at org.apache.wicket.Component.getPage(Component.java:1729)
>>>
>>> Is that you just called setSelectedTab() which DISCONNECTS the current
>>> tab from the page hierarcy. Try getting the page before that:
>>> onClick() {
>>>  Page page = getPage();
>>>  tabbedPanel.setSelectedTab(0);
>>>  setREsponsePage(page);
>>> }
>>>
>>>
>>> **
>>> Martin
>>>
>>>
>>> **
>>> Martin
>>>
>>> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>>>    
>>>> Hmm there's something very wrong here...
>>>>
>>>> I try to refresh the page like this:
>>>> setResponsePage(getPage());
>>>>
>>>> When this is the only action, the current page is refreshed. When I 
>>>> write
>>>> setSelectedTab(0) above it, I get an error.
>>>>
>>>> 10:42:27 ERROR [RequestCycle] - No Page found for component 
>>>> [MarkupContainer
>>>> [Component id = panel]]
>>>> java.lang.IllegalStateException: No Page found for component
>>>> [MarkupContainer [Component id = panel]]
>>>>       at org.apache.wicket.Component.getPage(Component.java:1729)
>>>>       at
>>>> si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:160) 
>>>>
>>>>       at
>>>> si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45) 
>>>>
>>>>       at
>>>> si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95) 
>>>>
>>>>       at
>>>> org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74) 
>>>>
>>>>       at
>>>> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140) 
>>>>
>>>>       at
>>>> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166) 
>>>>
>>>>       at
>>>> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299) 
>>>>
>>>>       at
>>>> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105) 
>>>>
>>>>       at
>>>> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92) 
>>>>
>>>>       at
>>>> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192) 
>>>>
>>>>       at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
>>>>       at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
>>>>       at org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
>>>>       at
>>>> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455) 
>>>>
>>>>       at
>>>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288) 
>>>>
>>>>       at
>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
>>>>
>>>>       at
>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
>>>>
>>>>       at
>>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 
>>>>
>>>>       at
>>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
>>>>
>>>>       at
>>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) 
>>>>
>>>>       at
>>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
>>>>
>>>>       at
>>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
>>>>
>>>>       at
>>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) 
>>>>
>>>>       at
>>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) 
>>>>
>>>>       at
>>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) 
>>>>
>>>>       at
>>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) 
>>>>
>>>>       at java.lang.Thread.run(Thread.java:619)
>>>>
>>>>
>>>> I've also tried with render() and renderComponent(), on a page and 
>>>> on the
>>>> tabPanel level...
>>>>
>>>> Linda's suggestion also generates an error, albeit a different one.
>>>> "innertabs" is found in HomePage.html, which looks like this:
>>>>
>>>> <html>
>>>> <head>
>>>> </head>
>>>> <body>
>>>>   <wicket:extend>
>>>>       <div wicket:id="innertabs" class="innertabpanel">[inner 
>>>> tabbed panel
>>>> will be here]</div>
>>>>   </wicket:extend>
>>>> </body>
>>>> </html>
>>>>
>>>> The tabbed panel is the "innertabs". The generated exception is:
>>>>
>>>> java.lang.IllegalArgumentException: cannot update component that 
>>>> does not
>>>> have setOutputMarkupId property set to true. Component: 
>>>> [MarkupContainer
>>>> [Component id = innertabs]]
>>>>    at
>>>> org.apache.wicket.ajax.AjaxRequestTarget.addComponent(AjaxRequestTarget.java:345) 
>>>>
>>>>    at
>>>> si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:161) 
>>>>
>>>>    at
>>>> si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45) 
>>>>
>>>>    at
>>>> si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95) 
>>>>
>>>>    at
>>>> org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74) 
>>>>
>>>>    at
>>>> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140) 
>>>>
>>>>    at
>>>> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166) 
>>>>
>>>>    at
>>>> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299) 
>>>>
>>>>    at
>>>> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105) 
>>>>
>>>>    at
>>>> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92) 
>>>>
>>>>    at
>>>> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192) 
>>>>
>>>>    at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
>>>>    at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
>>>>    at org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
>>>>    at
>>>> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455) 
>>>>
>>>>    at
>>>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288) 
>>>>
>>>>    at
>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
>>>>
>>>>    at
>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
>>>>
>>>>    at
>>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 
>>>>
>>>>    at
>>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
>>>>
>>>>    at
>>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) 
>>>>
>>>>    at
>>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
>>>>
>>>>    at
>>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
>>>>
>>>>    at
>>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) 
>>>>
>>>>    at
>>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) 
>>>>
>>>>    at
>>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) 
>>>>
>>>>    at
>>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) 
>>>>
>>>>    at java.lang.Thread.run(Thread.java:619)
>>>>
>>>>
>>>> getPage().addOrReplace(tabPanel); also generates some third error...
>>>>
>>>> tabPanel.addOrReplace(tabPanel); generates an error saying I can't 
>>>> replace a
>>>> component with itself :)
>>>>
>>>> Writing the complete URL
>>>> ?wicket:interface=:2:innertabs:tabs-container:tabs:0:link:1:ILinkListener:: 
>>>>
>>>> seems to be the only suggestion which actually works for now.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Martin Makundi wrote:
>>>>      
>>>>> Ah.. do you repaint the page after your ajax button call?
>>>>>
>>>>> **
>>>>> Martin
>>>>>
>>>>> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>>>>>
>>>>>        
>>>>>> This is what the link does in Wicket's source code:
>>>>>>
>>>>>> new Link(linkId) {
>>>>>>          private static final long serialVersionUID = 1L;
>>>>>>
>>>>>>          @Override
>>>>>>          public void onClick() {
>>>>>>              setSelectedTab(index);   // <-----
>>>>>>          }
>>>>>>      };
>>>>>>
>>>>>>
>>>>>> This is my code:
>>>>>>  /** Click on the Delete button */
>>>>>>  private void deleteBtnClick(AjaxRequestTarget target, Form<?> 
>>>>>> form) {
>>>>>>      TabbedPanel tabPanel = 
>>>>>> ((HomePage)getWebPage()).getTabbedPanel();
>>>>>>      tabPanel.setSelectedTab(0);      // <-------
>>>>>>  }
>>>>>>
>>>>>> Wicket's code works, mine doesn't. I've tried with a button and an
>>>>>> ajaxfallbacklink... Maybe I really should redirect to the same 
>>>>>> page with
>>>>>> another parameter, like you did.
>>>>>>
>>>>>>           
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>         
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>       
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>     
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>   
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: Beginner problems with TabbedPanel

Posted by Gajo Csaba <cg...@i-rose.si>.
That may be true Igor, but there doesn't seem to be any other solution 
to make this work:

confirmBtn = new Button("confirm") {
    private static final long serialVersionUID = 1L;
    @Override
    public void onSubmit() {
        Page page = getPage();
        TabbedPanel tabPanel = 
((HomePage)getWebPage()).getTabbedPanel();               
        tabPanel.setSelectedTab(0);
        setResponsePage(page);
    }
};

I cannot repaint the tabPanel (either with render() or 
renderComponent()), cannot repaint the whole page, cannot go with 
Linda's suggestion because even after Martin's fix it still generates an 
error. I just want to set the tabbedpanel's selected tab to be #0. It's 
not that complicated. In Swing, I would write: 
tabPanel.setSelectedTab(0); and that would be it.

Now I'm not very critical about how software systems are constructed, 
and don't care if some features may cause minor side-effects, or cause 
the programmer to write a bit hacky code. But having the 
setSelectedTab() method detach the page for no apparent reason and 
without any warning is as bad as having a goto command in a programming 
language. "Side effects" are one of the first thing that you learn in 
college, and why you should avoid them at all cost. The documentation 
for the setSelectedTab() says "sets the selected tab". What it's missing 
is a big warning sign "WARNING!!!! IT DETACHES THE PAGE!!!! WILL CAUSE 
UNRELATED ERROR MESSAGES!!!"

So what is your suggestion Igor? How should I use the framework properly?

Regards,
Csaba


Igor Vaynberg wrote:
> of course there is no reason to use an ajax link if all you are going
> to do is repaint the entire page anyways...
>
> also code like this: setresponsepage(getpage()) is always suspect. by
> default wicket repaints the same page so there is no need to call
> this. when inside ajax you should add components you want repainted to
> the request target that is passed in to you.
>
> setresponsepage should only be used when actually going to a different
> page. you are not using the framework properly...
>
> -igor
>
> 2009/7/29 Martin Makundi <ma...@koodaripalvelut.com>:
>   
>> 1.
>>
>> You can fix linda's suggestion by calling setOutputMarkupId(true) on
>> your tabbedpanel.
>>
>> 2. The reason for:
>>
>> 10:42:27 ERROR [RequestCycle] - No Page found for component
>> [MarkupContainer [Component id = panel]]
>> java.lang.IllegalStateException: No Page found for component
>> [MarkupContainer [Component id = panel]]
>>      at org.apache.wicket.Component.getPage(Component.java:1729)
>>
>> Is that you just called setSelectedTab() which DISCONNECTS the current
>> tab from the page hierarcy. Try getting the page before that:
>> onClick() {
>>  Page page = getPage();
>>  tabbedPanel.setSelectedTab(0);
>>  setREsponsePage(page);
>> }
>>
>>
>> **
>> Martin
>>
>>
>> **
>> Martin
>>
>> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>>     
>>> Hmm there's something very wrong here...
>>>
>>> I try to refresh the page like this:
>>> setResponsePage(getPage());
>>>
>>> When this is the only action, the current page is refreshed. When I write
>>> setSelectedTab(0) above it, I get an error.
>>>
>>> 10:42:27 ERROR [RequestCycle] - No Page found for component [MarkupContainer
>>> [Component id = panel]]
>>> java.lang.IllegalStateException: No Page found for component
>>> [MarkupContainer [Component id = panel]]
>>>       at org.apache.wicket.Component.getPage(Component.java:1729)
>>>       at
>>> si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:160)
>>>       at
>>> si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45)
>>>       at
>>> si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95)
>>>       at
>>> org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74)
>>>       at
>>> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140)
>>>       at
>>> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166)
>>>       at
>>> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299)
>>>       at
>>> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105)
>>>       at
>>> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
>>>       at
>>> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192)
>>>       at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
>>>       at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
>>>       at org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
>>>       at
>>> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455)
>>>       at
>>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288)
>>>       at
>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>>>       at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>>       at
>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>>>       at
>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>>>       at
>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>>>       at
>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>>       at
>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>>>       at
>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
>>>       at
>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
>>>       at
>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>>>       at
>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
>>>       at java.lang.Thread.run(Thread.java:619)
>>>
>>>
>>> I've also tried with render() and renderComponent(), on a page and on the
>>> tabPanel level...
>>>
>>> Linda's suggestion also generates an error, albeit a different one.
>>> "innertabs" is found in HomePage.html, which looks like this:
>>>
>>> <html>
>>> <head>
>>> </head>
>>> <body>
>>>   <wicket:extend>
>>>       <div wicket:id="innertabs" class="innertabpanel">[inner tabbed panel
>>> will be here]</div>
>>>   </wicket:extend>
>>> </body>
>>> </html>
>>>
>>> The tabbed panel is the "innertabs". The generated exception is:
>>>
>>> java.lang.IllegalArgumentException: cannot update component that does not
>>> have setOutputMarkupId property set to true. Component: [MarkupContainer
>>> [Component id = innertabs]]
>>>    at
>>> org.apache.wicket.ajax.AjaxRequestTarget.addComponent(AjaxRequestTarget.java:345)
>>>    at
>>> si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:161)
>>>    at
>>> si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45)
>>>    at
>>> si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95)
>>>    at
>>> org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74)
>>>    at
>>> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140)
>>>    at
>>> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166)
>>>    at
>>> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299)
>>>    at
>>> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105)
>>>    at
>>> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
>>>    at
>>> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192)
>>>    at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
>>>    at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
>>>    at org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
>>>    at
>>> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455)
>>>    at
>>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288)
>>>    at
>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>>>    at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>>    at
>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>>>    at
>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>>>    at
>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>>>    at
>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>>    at
>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>>>    at
>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
>>>    at
>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
>>>    at
>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>>>    at
>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
>>>    at java.lang.Thread.run(Thread.java:619)
>>>
>>>
>>> getPage().addOrReplace(tabPanel); also generates some third error...
>>>
>>> tabPanel.addOrReplace(tabPanel); generates an error saying I can't replace a
>>> component with itself :)
>>>
>>> Writing the complete URL
>>> ?wicket:interface=:2:innertabs:tabs-container:tabs:0:link:1:ILinkListener::
>>> seems to be the only suggestion which actually works for now.
>>>
>>>
>>>
>>>
>>>
>>> Martin Makundi wrote:
>>>       
>>>> Ah.. do you repaint the page after your ajax button call?
>>>>
>>>> **
>>>> Martin
>>>>
>>>> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>>>>
>>>>         
>>>>> This is what the link does in Wicket's source code:
>>>>>
>>>>> new Link(linkId) {
>>>>>          private static final long serialVersionUID = 1L;
>>>>>
>>>>>          @Override
>>>>>          public void onClick() {
>>>>>              setSelectedTab(index);   // <-----
>>>>>          }
>>>>>      };
>>>>>
>>>>>
>>>>> This is my code:
>>>>>  /** Click on the Delete button */
>>>>>  private void deleteBtnClick(AjaxRequestTarget target, Form<?> form) {
>>>>>      TabbedPanel tabPanel = ((HomePage)getWebPage()).getTabbedPanel();
>>>>>      tabPanel.setSelectedTab(0);      // <-------
>>>>>  }
>>>>>
>>>>> Wicket's code works, mine doesn't. I've tried with a button and an
>>>>> ajaxfallbacklink... Maybe I really should redirect to the same page with
>>>>> another parameter, like you did.
>>>>>
>>>>>           
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>         
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>   


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


Re: Beginner problems with TabbedPanel

Posted by Igor Vaynberg <ig...@gmail.com>.
of course there is no reason to use an ajax link if all you are going
to do is repaint the entire page anyways...

also code like this: setresponsepage(getpage()) is always suspect. by
default wicket repaints the same page so there is no need to call
this. when inside ajax you should add components you want repainted to
the request target that is passed in to you.

setresponsepage should only be used when actually going to a different
page. you are not using the framework properly...

-igor

2009/7/29 Martin Makundi <ma...@koodaripalvelut.com>:
> 1.
>
> You can fix linda's suggestion by calling setOutputMarkupId(true) on
> your tabbedpanel.
>
> 2. The reason for:
>
> 10:42:27 ERROR [RequestCycle] - No Page found for component
> [MarkupContainer [Component id = panel]]
> java.lang.IllegalStateException: No Page found for component
> [MarkupContainer [Component id = panel]]
>      at org.apache.wicket.Component.getPage(Component.java:1729)
>
> Is that you just called setSelectedTab() which DISCONNECTS the current
> tab from the page hierarcy. Try getting the page before that:
> onClick() {
>  Page page = getPage();
>  tabbedPanel.setSelectedTab(0);
>  setREsponsePage(page);
> }
>
>
> **
> Martin
>
>
> **
> Martin
>
> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>> Hmm there's something very wrong here...
>>
>> I try to refresh the page like this:
>> setResponsePage(getPage());
>>
>> When this is the only action, the current page is refreshed. When I write
>> setSelectedTab(0) above it, I get an error.
>>
>> 10:42:27 ERROR [RequestCycle] - No Page found for component [MarkupContainer
>> [Component id = panel]]
>> java.lang.IllegalStateException: No Page found for component
>> [MarkupContainer [Component id = panel]]
>>       at org.apache.wicket.Component.getPage(Component.java:1729)
>>       at
>> si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:160)
>>       at
>> si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45)
>>       at
>> si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95)
>>       at
>> org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74)
>>       at
>> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140)
>>       at
>> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166)
>>       at
>> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299)
>>       at
>> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105)
>>       at
>> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
>>       at
>> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192)
>>       at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
>>       at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
>>       at org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
>>       at
>> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455)
>>       at
>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288)
>>       at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>>       at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>       at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>>       at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>>       at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>>       at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>       at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>>       at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
>>       at
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
>>       at
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>>       at
>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
>>       at java.lang.Thread.run(Thread.java:619)
>>
>>
>> I've also tried with render() and renderComponent(), on a page and on the
>> tabPanel level...
>>
>> Linda's suggestion also generates an error, albeit a different one.
>> "innertabs" is found in HomePage.html, which looks like this:
>>
>> <html>
>> <head>
>> </head>
>> <body>
>>   <wicket:extend>
>>       <div wicket:id="innertabs" class="innertabpanel">[inner tabbed panel
>> will be here]</div>
>>   </wicket:extend>
>> </body>
>> </html>
>>
>> The tabbed panel is the "innertabs". The generated exception is:
>>
>> java.lang.IllegalArgumentException: cannot update component that does not
>> have setOutputMarkupId property set to true. Component: [MarkupContainer
>> [Component id = innertabs]]
>>    at
>> org.apache.wicket.ajax.AjaxRequestTarget.addComponent(AjaxRequestTarget.java:345)
>>    at
>> si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:161)
>>    at
>> si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45)
>>    at
>> si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95)
>>    at
>> org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74)
>>    at
>> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140)
>>    at
>> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166)
>>    at
>> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299)
>>    at
>> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105)
>>    at
>> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
>>    at
>> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192)
>>    at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
>>    at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
>>    at org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
>>    at
>> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455)
>>    at
>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288)
>>    at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>>    at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>    at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>>    at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>>    at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>>    at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>    at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>>    at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
>>    at
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
>>    at
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>>    at
>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
>>    at java.lang.Thread.run(Thread.java:619)
>>
>>
>> getPage().addOrReplace(tabPanel); also generates some third error...
>>
>> tabPanel.addOrReplace(tabPanel); generates an error saying I can't replace a
>> component with itself :)
>>
>> Writing the complete URL
>> ?wicket:interface=:2:innertabs:tabs-container:tabs:0:link:1:ILinkListener::
>> seems to be the only suggestion which actually works for now.
>>
>>
>>
>>
>>
>> Martin Makundi wrote:
>>>
>>> Ah.. do you repaint the page after your ajax button call?
>>>
>>> **
>>> Martin
>>>
>>> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>>>
>>>>
>>>> This is what the link does in Wicket's source code:
>>>>
>>>> new Link(linkId) {
>>>>          private static final long serialVersionUID = 1L;
>>>>
>>>>          @Override
>>>>          public void onClick() {
>>>>              setSelectedTab(index);   // <-----
>>>>          }
>>>>      };
>>>>
>>>>
>>>> This is my code:
>>>>  /** Click on the Delete button */
>>>>  private void deleteBtnClick(AjaxRequestTarget target, Form<?> form) {
>>>>      TabbedPanel tabPanel = ((HomePage)getWebPage()).getTabbedPanel();
>>>>      tabPanel.setSelectedTab(0);      // <-------
>>>>  }
>>>>
>>>> Wicket's code works, mine doesn't. I've tried with a button and an
>>>> ajaxfallbacklink... Maybe I really should redirect to the same page with
>>>> another parameter, like you did.
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Beginner problems with TabbedPanel

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Good. Finally I said something useful :)

**
Martin

2009/7/29 Gajo Csaba <cg...@i-rose.si>:
> Thanks Martin, it finally works! :)
>
>

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


Re: Beginner problems with TabbedPanel

Posted by Gajo Csaba <cg...@i-rose.si>.
Thanks Martin, it finally works! :)


Martin Makundi wrote:
> 1.
>
> You can fix linda's suggestion by calling setOutputMarkupId(true) on
> your tabbedpanel.
>
> 2. The reason for:
>
> 10:42:27 ERROR [RequestCycle] - No Page found for component
> [MarkupContainer [Component id = panel]]
> java.lang.IllegalStateException: No Page found for component
> [MarkupContainer [Component id = panel]]
>       at org.apache.wicket.Component.getPage(Component.java:1729)
>
> Is that you just called setSelectedTab() which DISCONNECTS the current
> tab from the page hierarcy. Try getting the page before that:
> onClick() {
>   Page page = getPage();
>   tabbedPanel.setSelectedTab(0);
>   setREsponsePage(page);
> }
>
>
> **
> Martin
>
>
> **
> Martin
>
> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>   
>> Hmm there's something very wrong here...
>>
>> I try to refresh the page like this:
>> setResponsePage(getPage());
>>
>> When this is the only action, the current page is refreshed. When I write
>> setSelectedTab(0) above it, I get an error.
>>
>> 10:42:27 ERROR [RequestCycle] - No Page found for component [MarkupContainer
>> [Component id = panel]]
>> java.lang.IllegalStateException: No Page found for component
>> [MarkupContainer [Component id = panel]]
>>       at org.apache.wicket.Component.getPage(Component.java:1729)
>>       at
>> si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:160)
>>       at
>> si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45)
>>       at
>> si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95)
>>       at
>> org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74)
>>       at
>> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140)
>>       at
>> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166)
>>       at
>> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299)
>>       at
>> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105)
>>       at
>> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
>>       at
>> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192)
>>       at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
>>       at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
>>       at org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
>>       at
>> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455)
>>       at
>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288)
>>       at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>>       at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>       at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>>       at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>>       at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>>       at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>       at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>>       at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
>>       at
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
>>       at
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>>       at
>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
>>       at java.lang.Thread.run(Thread.java:619)
>>
>>
>> I've also tried with render() and renderComponent(), on a page and on the
>> tabPanel level...
>>
>> Linda's suggestion also generates an error, albeit a different one.
>> "innertabs" is found in HomePage.html, which looks like this:
>>
>> <html>
>> <head>
>> </head>
>> <body>
>>   <wicket:extend>
>>       <div wicket:id="innertabs" class="innertabpanel">[inner tabbed panel
>> will be here]</div>
>>   </wicket:extend>
>> </body>
>> </html>
>>
>> The tabbed panel is the "innertabs". The generated exception is:
>>
>> java.lang.IllegalArgumentException: cannot update component that does not
>> have setOutputMarkupId property set to true. Component: [MarkupContainer
>> [Component id = innertabs]]
>>    at
>> org.apache.wicket.ajax.AjaxRequestTarget.addComponent(AjaxRequestTarget.java:345)
>>    at
>> si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:161)
>>    at
>> si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45)
>>    at
>> si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95)
>>    at
>> org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74)
>>    at
>> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140)
>>    at
>> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166)
>>    at
>> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299)
>>    at
>> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105)
>>    at
>> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
>>    at
>> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192)
>>    at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
>>    at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
>>    at org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
>>    at
>> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455)
>>    at
>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288)
>>    at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>>    at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>    at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>>    at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>>    at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>>    at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>    at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>>    at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
>>    at
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
>>    at
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>>    at
>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
>>    at java.lang.Thread.run(Thread.java:619)
>>
>>
>> getPage().addOrReplace(tabPanel); also generates some third error...
>>
>> tabPanel.addOrReplace(tabPanel); generates an error saying I can't replace a
>> component with itself :)
>>
>> Writing the complete URL
>> ?wicket:interface=:2:innertabs:tabs-container:tabs:0:link:1:ILinkListener::
>> seems to be the only suggestion which actually works for now.
>>
>>
>>
>>
>>
>> Martin Makundi wrote:
>>     
>>> Ah.. do you repaint the page after your ajax button call?
>>>
>>> **
>>> Martin
>>>
>>> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>>>
>>>       
>>>> This is what the link does in Wicket's source code:
>>>>
>>>> new Link(linkId) {
>>>>          private static final long serialVersionUID = 1L;
>>>>
>>>>          @Override
>>>>          public void onClick() {
>>>>              setSelectedTab(index);   // <-----
>>>>          }
>>>>      };
>>>>
>>>>
>>>> This is my code:
>>>>  /** Click on the Delete button */
>>>>  private void deleteBtnClick(AjaxRequestTarget target, Form<?> form) {
>>>>      TabbedPanel tabPanel = ((HomePage)getWebPage()).getTabbedPanel();
>>>>      tabPanel.setSelectedTab(0);      // <-------
>>>>  }
>>>>
>>>> Wicket's code works, mine doesn't. I've tried with a button and an
>>>> ajaxfallbacklink... Maybe I really should redirect to the same page with
>>>> another parameter, like you did.
>>>>
>>>>         
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>   


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


Re: Beginner problems with TabbedPanel

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
1.

You can fix linda's suggestion by calling setOutputMarkupId(true) on
your tabbedpanel.

2. The reason for:

10:42:27 ERROR [RequestCycle] - No Page found for component
[MarkupContainer [Component id = panel]]
java.lang.IllegalStateException: No Page found for component
[MarkupContainer [Component id = panel]]
      at org.apache.wicket.Component.getPage(Component.java:1729)

Is that you just called setSelectedTab() which DISCONNECTS the current
tab from the page hierarcy. Try getting the page before that:
onClick() {
  Page page = getPage();
  tabbedPanel.setSelectedTab(0);
  setREsponsePage(page);
}


**
Martin


**
Martin

2009/7/29 Gajo Csaba <cg...@i-rose.si>:
> Hmm there's something very wrong here...
>
> I try to refresh the page like this:
> setResponsePage(getPage());
>
> When this is the only action, the current page is refreshed. When I write
> setSelectedTab(0) above it, I get an error.
>
> 10:42:27 ERROR [RequestCycle] - No Page found for component [MarkupContainer
> [Component id = panel]]
> java.lang.IllegalStateException: No Page found for component
> [MarkupContainer [Component id = panel]]
>       at org.apache.wicket.Component.getPage(Component.java:1729)
>       at
> si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:160)
>       at
> si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45)
>       at
> si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95)
>       at
> org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74)
>       at
> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140)
>       at
> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166)
>       at
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299)
>       at
> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105)
>       at
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
>       at
> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192)
>       at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
>       at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
>       at org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
>       at
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455)
>       at
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288)
>       at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>       at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>       at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>       at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>       at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>       at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>       at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>       at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
>       at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
>       at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>       at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
>       at java.lang.Thread.run(Thread.java:619)
>
>
> I've also tried with render() and renderComponent(), on a page and on the
> tabPanel level...
>
> Linda's suggestion also generates an error, albeit a different one.
> "innertabs" is found in HomePage.html, which looks like this:
>
> <html>
> <head>
> </head>
> <body>
>   <wicket:extend>
>       <div wicket:id="innertabs" class="innertabpanel">[inner tabbed panel
> will be here]</div>
>   </wicket:extend>
> </body>
> </html>
>
> The tabbed panel is the "innertabs". The generated exception is:
>
> java.lang.IllegalArgumentException: cannot update component that does not
> have setOutputMarkupId property set to true. Component: [MarkupContainer
> [Component id = innertabs]]
>    at
> org.apache.wicket.ajax.AjaxRequestTarget.addComponent(AjaxRequestTarget.java:345)
>    at
> si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:161)
>    at
> si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45)
>    at
> si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95)
>    at
> org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74)
>    at
> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140)
>    at
> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166)
>    at
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299)
>    at
> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105)
>    at
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
>    at
> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192)
>    at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
>    at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
>    at org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
>    at
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455)
>    at
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288)
>    at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>    at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>    at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>    at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>    at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>    at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>    at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>    at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
>    at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
>    at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>    at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
>    at java.lang.Thread.run(Thread.java:619)
>
>
> getPage().addOrReplace(tabPanel); also generates some third error...
>
> tabPanel.addOrReplace(tabPanel); generates an error saying I can't replace a
> component with itself :)
>
> Writing the complete URL
> ?wicket:interface=:2:innertabs:tabs-container:tabs:0:link:1:ILinkListener::
> seems to be the only suggestion which actually works for now.
>
>
>
>
>
> Martin Makundi wrote:
>>
>> Ah.. do you repaint the page after your ajax button call?
>>
>> **
>> Martin
>>
>> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>>
>>>
>>> This is what the link does in Wicket's source code:
>>>
>>> new Link(linkId) {
>>>          private static final long serialVersionUID = 1L;
>>>
>>>          @Override
>>>          public void onClick() {
>>>              setSelectedTab(index);   // <-----
>>>          }
>>>      };
>>>
>>>
>>> This is my code:
>>>  /** Click on the Delete button */
>>>  private void deleteBtnClick(AjaxRequestTarget target, Form<?> form) {
>>>      TabbedPanel tabPanel = ((HomePage)getWebPage()).getTabbedPanel();
>>>      tabPanel.setSelectedTab(0);      // <-------
>>>  }
>>>
>>> Wicket's code works, mine doesn't. I've tried with a button and an
>>> ajaxfallbacklink... Maybe I really should redirect to the same page with
>>> another parameter, like you did.
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Beginner problems with TabbedPanel

Posted by Gajo Csaba <cg...@i-rose.si>.
Hmm there's something very wrong here...

I try to refresh the page like this:
setResponsePage(getPage());

When this is the only action, the current page is refreshed. When I 
write setSelectedTab(0) above it, I get an error.

10:42:27 ERROR [RequestCycle] - No Page found for component 
[MarkupContainer [Component id = panel]]
java.lang.IllegalStateException: No Page found for component 
[MarkupContainer [Component id = panel]]
        at org.apache.wicket.Component.getPage(Component.java:1729)
        at 
si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:160)
        at 
si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45)
        at 
si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95)
        at 
org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74)
        at 
org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140)
        at 
org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166)
        at 
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299)
        at 
org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105)
        at 
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
        at 
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192)
        at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
        at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
        at org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
        at 
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455)
        at 
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
        at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
        at java.lang.Thread.run(Thread.java:619)


I've also tried with render() and renderComponent(), on a page and on 
the tabPanel level...

Linda's suggestion also generates an error, albeit a different one. 
"innertabs" is found in HomePage.html, which looks like this:

<html>
<head>
</head>
<body>
    <wicket:extend>
        <div wicket:id="innertabs" class="innertabpanel">[inner tabbed 
panel will be here]</div>
    </wicket:extend>
</body>
</html>

The tabbed panel is the "innertabs". The generated exception is:

java.lang.IllegalArgumentException: cannot update component that does not have setOutputMarkupId property set to true. Component: [MarkupContainer [Component id = innertabs]]
     at org.apache.wicket.ajax.AjaxRequestTarget.addComponent(AjaxRequestTarget.java:345)
     at si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:161)
     at si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45)
     at si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95)
     at org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74)
     at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140)
     at org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166)
     at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299)
     at org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105)
     at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
     at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192)
     at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
     at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
     at org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
     at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455)
     at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
     at java.lang.Thread.run(Thread.java:619)


getPage().addOrReplace(tabPanel); also generates some third error...

tabPanel.addOrReplace(tabPanel); generates an error saying I can't 
replace a component with itself :)

Writing the complete URL 
?wicket:interface=:2:innertabs:tabs-container:tabs:0:link:1:ILinkListener:: 
seems to be the only suggestion which actually works for now.





Martin Makundi wrote:
> Ah.. do you repaint the page after your ajax button call?
>
> **
> Martin
>
> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>   
>> This is what the link does in Wicket's source code:
>>
>> new Link(linkId) {
>>           private static final long serialVersionUID = 1L;
>>
>>           @Override
>>           public void onClick() {
>>               setSelectedTab(index);   // <-----
>>           }
>>       };
>>
>>
>> This is my code:
>>   /** Click on the Delete button */
>>   private void deleteBtnClick(AjaxRequestTarget target, Form<?> form) {
>>       TabbedPanel tabPanel = ((HomePage)getWebPage()).getTabbedPanel();
>>       tabPanel.setSelectedTab(0);      // <-------
>>   }
>>
>> Wicket's code works, mine doesn't. I've tried with a button and an
>> ajaxfallbacklink... Maybe I really should redirect to the same page with
>> another parameter, like you did.
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>   


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


Re: Beginner problems with TabbedPanel

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Ah.. do you repaint the page after your ajax button call?

**
Martin

2009/7/29 Gajo Csaba <cg...@i-rose.si>:
> This is what the link does in Wicket's source code:
>
> new Link(linkId) {
>           private static final long serialVersionUID = 1L;
>
>           @Override
>           public void onClick() {
>               setSelectedTab(index);   // <-----
>           }
>       };
>
>
> This is my code:
>   /** Click on the Delete button */
>   private void deleteBtnClick(AjaxRequestTarget target, Form<?> form) {
>       TabbedPanel tabPanel = ((HomePage)getWebPage()).getTabbedPanel();
>       tabPanel.setSelectedTab(0);      // <-------
>   }
>
> Wicket's code works, mine doesn't. I've tried with a button and an
> ajaxfallbacklink... Maybe I really should redirect to the same page with
> another parameter, like you did.

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


Re: Beginner problems with TabbedPanel

Posted by Gajo Csaba <cg...@i-rose.si>.
This is what the link does in Wicket's source code:

 new Link(linkId) {
            private static final long serialVersionUID = 1L;

            @Override
            public void onClick() {
                setSelectedTab(index);   // <-----
            }
        };
 

This is my code:
    /** Click on the Delete button */
    private void deleteBtnClick(AjaxRequestTarget target, Form<?> form) {
        TabbedPanel tabPanel = ((HomePage)getWebPage()).getTabbedPanel();
        tabPanel.setSelectedTab(0);      // <-------
    }

Wicket's code works, mine doesn't. I've tried with a button and an 
ajaxfallbacklink... Maybe I really should redirect to the same page with 
another parameter, like you did.



Martin Makundi wrote:
> Nono... just look at the source code of the link.
>
> **
> Martin
>
> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>   
>> I really hope that I don't have to write
>>
>> ?wicket:interface=:6:innertabs:tabs-container:tabs:0:link:8:ILinkListener::
>>
>> into the code :(
>>
>>
>>
>> Martin Makundi wrote:
>>     
>>> Duh.. I am not sure but I guess you must create a mechanism... for
>>> example ajax button opens page with such parameter that the tab
>>> selects tab 0. You need to build that logic into tabbedpanel when it
>>> is being rendered...
>>>
>>> That's what we did. I am not sure if it is possible to call
>>> setSelectedTab after the page has rendered... you could have a look at
>>> the code in the tab link and do something similar.
>>>
>>> **
>>> Martin
>>>
>>> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>>>
>>>       
>>>> Hello,
>>>>
>>>> I've recently started working with Wicket, so a lot of things are still
>>>> unknown for me. For example, right now I have a tabbed panel with two
>>>> tabs.
>>>> In the begining, I write setSelectedTab(1), so that the first tab is the
>>>> default. This works ok.
>>>>
>>>> However, I have an AjaxFallbackLink on the second tab. When I click on
>>>> it, I
>>>> want the following to happen:
>>>> tabbedPanel.setSelectedTab(0);
>>>>
>>>> This creates an exception, saying that some components from tab #1 aren't
>>>> visble. And they shouldn't be, because I've selected tab #0.
>>>>
>>>> If I click on the tab link manually (with a mouse), the tab opens fine.
>>>>
>>>> What am I doing wrong? How can I select another tab through an ajax
>>>> fallback
>>>> link?
>>>>
>>>> Thank you in advance,
>>>> Csaba
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>>         
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>   


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


Re: Beginner problems with TabbedPanel

Posted by Linda van der Pal <lv...@heritageagenturen.nl>.
Try adding the following line to that delteBtnClick method (as the last 
line):

    target.addComponent(tabPanel);

Linda

Gajo Csaba wrote:
> This is what the link does in Wicket's source code:
>
> new Link(linkId) {
>            private static final long serialVersionUID = 1L;
>
>            @Override
>            public void onClick() {
>                setSelectedTab(index);   // <-----
>            }
>        };
>
>
> This is my code:
>    /** Click on the Delete button */
>    private void deleteBtnClick(AjaxRequestTarget target, Form<?> form) {
>        TabbedPanel tabPanel = ((HomePage)getWebPage()).getTabbedPanel();
>        tabPanel.setSelectedTab(0);      // <-------
>    }
>
> Wicket's code works, mine doesn't. I've tried with a button and an 
> ajaxfallbacklink... Maybe I really should redirect to the same page 
> with another parameter, like you did.
>
>


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


Re: Beginner problems with TabbedPanel

Posted by Gajo Csaba <cg...@i-rose.si>.
This is what the link does in Wicket's source code:

 new Link(linkId) {
            private static final long serialVersionUID = 1L;

            @Override
            public void onClick() {
                setSelectedTab(index);   // <-----
            }
        };
 

This is my code:
    /** Click on the Delete button */
    private void deleteBtnClick(AjaxRequestTarget target, Form<?> form) {
        TabbedPanel tabPanel = ((HomePage)getWebPage()).getTabbedPanel();
        tabPanel.setSelectedTab(0);      // <-------
    }

Wicket's code works, mine doesn't. I've tried with a button and an 
ajaxfallbacklink... Maybe I really should redirect to the same page with 
another parameter, like you did.



Martin Makundi wrote:
> Nono... just look at the source code of the link.
>
> **
> Martin
>
> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>   
>> I really hope that I don't have to write
>>
>> ?wicket:interface=:6:innertabs:tabs-container:tabs:0:link:8:ILinkListener::
>>
>> into the code :(
>>
>>
>>
>> Martin Makundi wrote:
>>     
>>> Duh.. I am not sure but I guess you must create a mechanism... for
>>> example ajax button opens page with such parameter that the tab
>>> selects tab 0. You need to build that logic into tabbedpanel when it
>>> is being rendered...
>>>
>>> That's what we did. I am not sure if it is possible to call
>>> setSelectedTab after the page has rendered... you could have a look at
>>> the code in the tab link and do something similar.
>>>
>>> **
>>> Martin
>>>
>>> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>>>
>>>       
>>>> Hello,
>>>>
>>>> I've recently started working with Wicket, so a lot of things are still
>>>> unknown for me. For example, right now I have a tabbed panel with two
>>>> tabs.
>>>> In the begining, I write setSelectedTab(1), so that the first tab is the
>>>> default. This works ok.
>>>>
>>>> However, I have an AjaxFallbackLink on the second tab. When I click on
>>>> it, I
>>>> want the following to happen:
>>>> tabbedPanel.setSelectedTab(0);
>>>>
>>>> This creates an exception, saying that some components from tab #1 aren't
>>>> visble. And they shouldn't be, because I've selected tab #0.
>>>>
>>>> If I click on the tab link manually (with a mouse), the tab opens fine.
>>>>
>>>> What am I doing wrong? How can I select another tab through an ajax
>>>> fallback
>>>> link?
>>>>
>>>> Thank you in advance,
>>>> Csaba
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>>         
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>   


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


Re: Beginner problems with TabbedPanel

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Nono... just look at the source code of the link.

**
Martin

2009/7/29 Gajo Csaba <cg...@i-rose.si>:
> I really hope that I don't have to write
>
> ?wicket:interface=:6:innertabs:tabs-container:tabs:0:link:8:ILinkListener::
>
> into the code :(
>
>
>
> Martin Makundi wrote:
>>
>> Duh.. I am not sure but I guess you must create a mechanism... for
>> example ajax button opens page with such parameter that the tab
>> selects tab 0. You need to build that logic into tabbedpanel when it
>> is being rendered...
>>
>> That's what we did. I am not sure if it is possible to call
>> setSelectedTab after the page has rendered... you could have a look at
>> the code in the tab link and do something similar.
>>
>> **
>> Martin
>>
>> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>>
>>>
>>> Hello,
>>>
>>> I've recently started working with Wicket, so a lot of things are still
>>> unknown for me. For example, right now I have a tabbed panel with two
>>> tabs.
>>> In the begining, I write setSelectedTab(1), so that the first tab is the
>>> default. This works ok.
>>>
>>> However, I have an AjaxFallbackLink on the second tab. When I click on
>>> it, I
>>> want the following to happen:
>>> tabbedPanel.setSelectedTab(0);
>>>
>>> This creates an exception, saying that some components from tab #1 aren't
>>> visble. And they shouldn't be, because I've selected tab #0.
>>>
>>> If I click on the tab link manually (with a mouse), the tab opens fine.
>>>
>>> What am I doing wrong? How can I select another tab through an ajax
>>> fallback
>>> link?
>>>
>>> Thank you in advance,
>>> Csaba
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Beginner problems with TabbedPanel

Posted by Gajo Csaba <cg...@i-rose.si>.
I really hope that I don't have to write

?wicket:interface=:6:innertabs:tabs-container:tabs:0:link:8:ILinkListener::

into the code :(



Martin Makundi wrote:
> Duh.. I am not sure but I guess you must create a mechanism... for
> example ajax button opens page with such parameter that the tab
> selects tab 0. You need to build that logic into tabbedpanel when it
> is being rendered...
>
> That's what we did. I am not sure if it is possible to call
> setSelectedTab after the page has rendered... you could have a look at
> the code in the tab link and do something similar.
>
> **
> Martin
>
> 2009/7/29 Gajo Csaba <cg...@i-rose.si>:
>   
>> Hello,
>>
>> I've recently started working with Wicket, so a lot of things are still
>> unknown for me. For example, right now I have a tabbed panel with two tabs.
>> In the begining, I write setSelectedTab(1), so that the first tab is the
>> default. This works ok.
>>
>> However, I have an AjaxFallbackLink on the second tab. When I click on it, I
>> want the following to happen:
>> tabbedPanel.setSelectedTab(0);
>>
>> This creates an exception, saying that some components from tab #1 aren't
>> visble. And they shouldn't be, because I've selected tab #0.
>>
>> If I click on the tab link manually (with a mouse), the tab opens fine.
>>
>> What am I doing wrong? How can I select another tab through an ajax fallback
>> link?
>>
>> Thank you in advance,
>> Csaba
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>   


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


Re: Beginner problems with TabbedPanel

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Duh.. I am not sure but I guess you must create a mechanism... for
example ajax button opens page with such parameter that the tab
selects tab 0. You need to build that logic into tabbedpanel when it
is being rendered...

That's what we did. I am not sure if it is possible to call
setSelectedTab after the page has rendered... you could have a look at
the code in the tab link and do something similar.

**
Martin

2009/7/29 Gajo Csaba <cg...@i-rose.si>:
> Hello,
>
> I've recently started working with Wicket, so a lot of things are still
> unknown for me. For example, right now I have a tabbed panel with two tabs.
> In the begining, I write setSelectedTab(1), so that the first tab is the
> default. This works ok.
>
> However, I have an AjaxFallbackLink on the second tab. When I click on it, I
> want the following to happen:
> tabbedPanel.setSelectedTab(0);
>
> This creates an exception, saying that some components from tab #1 aren't
> visble. And they shouldn't be, because I've selected tab #0.
>
> If I click on the tab link manually (with a mouse), the tab opens fine.
>
> What am I doing wrong? How can I select another tab through an ajax fallback
> link?
>
> Thank you in advance,
> Csaba
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Components and nullable data

Posted by Igor Vaynberg <ig...@gmail.com>.
add(new Link<User>("editgroup", user) {
  onclick() {
   ...
  }

  isvisible() {
   return user.getgroup()!=null;
  }
}

?

-igor

2009/7/30 Iain Reddick <ia...@beatsystems.com>:
> Hi all,
>
> One of the difficulties I am finding with wicket is the best practice when
> displaying/using data that is potentially null.
>
> Example:
>
> I have a "user" object which has a nullable "group" property. I want to show
> a link to the group details page when the "group" property is not null, but
> show nothing otherwise (let's keep this simple).
>
> My issue is that either way, I have to construct the link component and add
> it to the page, whether I want it is visible or not. This is tricky at the
> best of times, as I must always carry out a lot of  "is null" logic.
>
> The construction issue becomes multiplied if I want the same behaviour on a
> stateful page (i.e. the link, etc. can be appropriate for linking to the
> group, or be null and not visible and can switch between the two states).
>
> My question is - am I missing something, or do I just need to have a better
> strategy for this type of situation?
>
> If the answer is the latter, does anyone have any tips and/or components
> that would cut down on the extra coding?
>
> Thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Components and nullable data

Posted by Iain Reddick <ia...@beatsystems.com>.
Hi all,

One of the difficulties I am finding with wicket is the best practice 
when displaying/using data that is potentially null.

Example:

I have a "user" object which has a nullable "group" property. I want to 
show a link to the group details page when the "group" property is not 
null, but show nothing otherwise (let's keep this simple).

My issue is that either way, I have to construct the link component and 
add it to the page, whether I want it is visible or not. This is tricky 
at the best of times, as I must always carry out a lot of  "is null" logic.

The construction issue becomes multiplied if I want the same behaviour 
on a stateful page (i.e. the link, etc. can be appropriate for linking 
to the group, or be null and not visible and can switch between the two 
states).

My question is - am I missing something, or do I just need to have a 
better strategy for this type of situation?

If the answer is the latter, does anyone have any tips and/or components 
that would cut down on the extra coding?

Thanks

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