I had the same need and basically solved the problem by extending the 
CoolMenuDisplayer and overridding the buildMenuString() method.

Here's the code I used, but we modified a number of other things in this class, so I 
don't know if it will work on it's own. If not, let me know and I'll send the entire 
class.

        protected void buildMenuString(MenuComponent menu, StringBuffer sb,
                        boolean allowed) {              
                if (allowed) {
                        sb.append(menuMessage.format(getArgs(menu, allowed)));
                        sb.append(")\n");
                        
                        MenuComponent[] subMenus = menu.getMenuComponents();

                        if (subMenus.length > 0) {
                                for (int i = 0; i < subMenus.length; i++) {
                                        buildMenuString(subMenus[i], sb,
                                                        (allowed) ? 
isAllowed(subMenus[i]) : allowed);
                                }
                        }
                }
                else {
                        sb.append("");
                }
        }

~thomas

On Fri, Apr 02, 2004 at 03:42:16PM -0500, [EMAIL PROTECTED] wrote:
> Thanks for answering my last question on Tiles & Buttons. With your
> suggestion I figured it out. 
> I now have a question about using the permissionsAdapter.
> I create my own subclass and it works great.
> My question is using the coolmenus (or any other style) how can I prevent
> the menu item for being added to the menu when the adapter's isAllowed()
> method returns false. Using coolmenus I can get these items to appear
> 'disabled' in a different color by specifying the 'cmDisXXX' variables in
> the javascript but I can't seem to figure out how to prevent them from being
> added altogether.
> Is there some setting I missed in the javascript or in the menu-config?
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
> _______________________________________________
> struts-menu-user mailing list
> [EMAIL PROTECTED]
> https://lists.sf.net/lists/listinfo/struts-menu-user
> 
<snip>

-- 
Thomas Lockney
[EMAIL PROTECTED]
http://opposable-thumbs.net


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
struts-menu-user mailing list
[EMAIL PROTECTED]
https://lists.sf.net/lists/listinfo/struts-menu-user

Reply via email to