So I've finally found the problem. When the page refreshed with the tabbed panel, the panel displayed was NOT the tab with the edit form on it. It turns out that the method called depends on the panel being displayed since the wrong panel was displayed the method was not called. Once I ensured that the panel that was displayed on refresh was the panel with the edit form, then the method call occurred on the edit form.
This was done by including a hidden field on the form that had the name tabPanelIndex. Once that was done the method call was made on the form. Tony On Thu, Oct 25, 2012 at 2:04 PM, Naoki Takezoe <[email protected]> wrote: > Hi Tony, > > I tested following code and it works well. > > ======== > public class HomePage extends Page { > > private TabbedPanel tabbedPanel = new TabbedPanel("tabbedPanel"); > > public void onInit() { > Panel panel = new FormPanel("panel"); > tabbedPanel.add(panel); > addControl(tabbedPanel); > } > > public static class FormPanel extends Panel { > > public FormPanel(String name) { > super(name, "formPanel.htm"); > } > > public boolean onSaveClicked() { > System.out.println("clicked!"); > return (true); > } > > public void onInit() { > super.onInit(); > Form form = new Form("form"); > form.add(new Submit("save", "Save", this, > "onSaveClicked")); > add(form); > } > } > > } > ======== > > Although some part of your code above seems omitted, > did you add TabbedPanel, Panel and Form to the parent component correctly? > If you couldn't solve your problem, please show complete code. > > Hope this helps. > > 2012/10/25 Tony Giaccone <[email protected]>: > > Yes, I have the value set to trace. Which I believe is a higher level > then > > debug, but I wasn't paying attention to it. I'll look at it now and see > if > > that helps me find the problem. > > > > Tony > > > > > > On Thu, Oct 25, 2012 at 8:45 AM, Gilberto <[email protected]> wrote: > >> > >> Hi, Tony! > >> Have you enabled the debug mode[1]? That could help! > >> > >> > >> Gilberto > >> [1] > >> > http://click.apache.org/docs/user-guide/htmlsingle/click-book.html#application-mode > >> > >> > >> ---------- Forwarded message ---------- > >> From: Tony Giaccone <[email protected]> > >> Date: 2012/10/24 > >> Subject: > >> To: [email protected] > >> > >> > >> I'm learning click and having a small problem. > >> > >> I have a Page that has a border component. > >> > >> In that page, I have a TabbedPanel. The Panel has two tabs, each Tab > >> is a panel that is implemented by sub-classing Panel > >> > >> public class NoticeTemplatePage extends BorderPage { > >> > >> private TabbedPanel tabbedPanel = new TabbedPanel("tabbedPanel"); > >> > >> public void onInit() > >> { > >> Panel listNoticeTemplatePanel = new > >> ListNoticeTemplatePanel("listNoticeTemplatePanel"); > >> Panel editNoticeTemplatePanel = new > >> EditNoticeTemplatePanel("editNoticeTemplatePanel"); > >> tabbedPanel.add(listNoticeTemplatePanel); > >> tabbedPanel.add(editNoticeTemplatePanel); > >> } > >> > >> } > >> > >> > >> For the purposes of this question I'm going to ignore the > >> listNoticeTemplatePanel. The EditNoticeTemplatePanel is defined like > >> this: > >> > >> > >> public class EditNoticeTemplatePanel extends Panel { > >> > >> public EditNoticeTemplatePanel(String name) > >> { > >> super(name,"panel/notice/editNotice.htm"); > >> } > >> > >> public boolean onSaveClicked() { > >> return(true); > >> } > >> public void onInit() > >> { > >> super.onInit(); > >> > >> //there's stuff that's been removed that defines the fields on the form > >> > >> noticeTemplateCreationForm.add(new Submit("save", "Save", this, > >> "onSaveClicked")); > >> noticeTemplateCreationForm.add(new Submit("cancel","Cancel", this, > >> "onCancelClicked")); > >> } > >> } > >> > >> The problem is that when the save button is clicked the > >> onSaveClickedMethod on this page is never called. I have a similar > >> construct on a page and that gets called. What am I missing? > >> > >> > >> Tony > > > > > > > > -- > Naoki Takezoe >
