Thanks Bob!

I am using stateful pages, so I appreciate the warning about 2.3.0. I'll
make sure I keep that in mind going forward.

I'm afraid I don't quite understand what you're suggesting about adding the
inner panel to the outer panel :-( .  I created a simplified version of my
problem:

--------
SamplePage.java (the main page that contains the outer TabbedPanel
containing Tab 1 and Tab 2:
public class SamplePage extends Page {

        private TabbedPanel tabbedPanel = new TabbedPanel("tabbedPanel");
        private Tab1Panel tab1Panel;
        private Tab2Panel tab2Panel;

        public SamplePage() {
                setStateful(true);

                tab1Panel = new Tab1Panel("tab1Panel", "Tab 1");
                tab2Panel = new Tab2Panel("tab2Panel", "Tab 2");
                
                tabbedPanel.add(tab1Panel);
                tabbedPanel.add(tab2Panel);
                
                addControl(tabbedPanel);
        }
}

--------
Sample.htm:
<html>
   <head>
     $headElements
   </head>
   <body>
     $tabbedPanel
   $jsElements
   </body>
 </html> 

--------
Tab1Panel.java (The first tab of the outer TabbedPanel that contains it's
own TabbedPanel containing Tab 3 and Tab 4):
public class Tab1Panel extends Panel {
        private TabbedPanel tab1TabbedPanel = new 
TabbedPanel("tab1TabbedPanel");
        private Tab3Panel tab3Panel;
        private Tab4Panel tab4Panel;
        
        public Tab1Panel(String name, String label) {
                super(name, "/sample/Tab1Panel.htm");
                setLabel(label);
                
                tab3Panel = new Tab3Panel("tab3Panel", "Tab 3");
                tab4Panel = new Tab4Panel("tab4Panel", "Tab 4");
                
                tab1TabbedPanel.add(tab3Panel);
                tab1TabbedPanel.add(tab4Panel);
                
                add(tab1TabbedPanel);
        }
}

--------
Tab1Panel.htm:
$tab1TabbedPanel

--------
Tab2Panel.htm (The second tab of the outer TabbedPanel, just contains a
Submit button with a print statement):
public class Tab2Panel extends Panel {
        Form form = new Form("form");
        Submit theButton = new Submit("theButton", "Click Me", this,
"onClickTheButton");
        public Tab2Panel(String name, String label) {
                super(name, "/sample/Tab2Panel.htm");
                setLabel(label);
                
                form.add(theButton);
                
                add(form);
        }
        
        public boolean onClickTheButton() {
                System.out.println("The button in Tab 2 was clicked");
                return true;
        }
}

--------
Tab2Panel.htm:
$form

--------
Tab3Panel.java (The first tab of the inner TabbedPanel, contains a Submit
button with a print statement):
public class Tab3Panel extends Panel {
        Form form = new Form("form");
        Submit theButton = new Submit("theButton", "Click Me", this,
"onClickTheButton");
        public Tab3Panel(String name, String label) {
                super(name, "/sample/Tab3Panel.htm");
                setLabel(label);
                
                form.add(theButton);
                
                add(form);
        }
        
        public boolean onClickTheButton() {
                System.out.println("The button in Tab 3 was clicked");
                return true;
        }
}

--------
Tab3Panel.htm:
$form

--------
Tab4Panel.java (The second tab of the inner TabbedPanel, just contains a
Submit button with a print statement):
public class Tab4Panel extends Panel {
        Form form = new Form("form");
        Submit theButton = new Submit("theButton", "Click Me", this,
"onClickTheButton");
        public Tab4Panel(String name, String label) {
                super(name, "/sample/Tab4Panel.htm");
                setLabel(label);
                
                form.add(theButton);
                
                add(form);
        }
        
        public boolean onClickTheButton() {
                System.out.println("The button in Tab 4 was clicked");
                return true;
        }
}

---------
Tab4Panel.htm:
$form

-----------------------------------


Below is an image of what these TabbedPanels look like initially:

         http://click.1134972.n2.nabble.com/file/n6028187/tabbedPanelSample.jpg 


-----------------------------------

In Click 2.1.0, this works perfectly.  I can click Tab 4 and the Tab4Panel
is displayed.  However, if I run this same sample using Click 2.2.0, when I
click Tab 4 nothing happens.

If I get a reference to the inner TabbedPanel, "tab1TabbedPanel", from
Tab1Panel and use addControl to add it to SamplePage, I can get
functionality back in the tabs ... but unfortunately when I click the Submit
buttons in the individual Panels, the "onClickTheButton" method is called
twice.  So, this workaround isn't quite right.

Based on my sample code, I was hoping that you could tell me if I had made a
huge error somewhere that is causing my problems, or if perhaps there is a
workaround I could use with Click 2.2.0 to restore the correct functionality
I was seeing in Click 2.1.0.

Thanks again!
-- 
View this message in context: 
http://click.1134972.n2.nabble.com/TabbedPanel-and-Click-2-2-0-tp6024395p6028187.html
Sent from the click-user mailing list archive at Nabble.com.

Reply via email to