Just a suggestion on how you might approach it. This is off the top of my head, but this is how I would approach it.

Create a reusable subcomponent, say "SecondRowMenu". In it have a switch component which switches the menus "SRMenu1", "SRMenu2", etc.. In SecondRowMenu component have a method that returns the actual menu component name bound to the switch component.

Now just figure our the logic for getting that name. For example if each page has a definite second row menu associated with it, then you can simply have a method public String srMenuName() in each page that returns the menu name. And rather than setting up bindings and binding this every time, just simply have a root() method that crawls up the WOComponent hierarchy to the top page and calls the srMenuName method to get the menu name.

In the end the top-level Page decides the menu to be displayed in the second row and all you do is change a string constant on each top- level page as you add pages.

SecondRowMenu can be dropped into any page you want to have a second row menu. Also it can nested multiple levels deep inside PageWrapper component for example.

What does a root() method look like ...
    /** @return WOComponent the topmost parent component that
                encloses this component */
    public WOComponent root() {
                WOComponent child = this;
                WOComponent parent = parent();
                
                while (parent != null) {
                        child = parent;
                        parent = child.parent();
                }
                
                return child;
    }

I suppose context().page() might also work to get a reference of the root page.

HTH, Kieran


On Sep 11, 2006, at 2:01 PM, Scott Winn wrote:

Hello all,

I'm trying to implement tabbed navigation for my first WebObjects project. I want two rows: click something from the top row and it changes the selections in the second row. Click something in the second row and it changes the page. I'm sure you know the type.

My own efforts have yielded a rather clumsy component that is a maze of booleans and WOConditionals (this is my first attempt). I have got user permissions and CSS working for the component, but I just know things are going to get more and more ugly as I add pages to the project.

I have heard of ERXNavigation in Project Wonder and I've made an effort to understand how it all works, but the "Documentation/ Navigation.html" is a bit to sketchy for me to follow. I also found a tabbed navigation project on wocode, but since it appeared to be single row I didn't think it really applied to my situation.

Would anyone care to share their wisdom in the ways of site navigation?

Thanks,

Scott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/kieran_lists% 40mac.com

This email sent to [EMAIL PROTECTED]

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Reply via email to