Try setting the parent of the newly created menu using setParent of
MenuComponent.

HTH,

Matt

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Gustavo Padial
> Sent: Friday, February 27, 2004 10:33 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [struts-menu] Create dynamicaly menu itens
> 
> 
> Hello Matt
> 
> We found a error in Struts-menu when creating dynamicaly 
> menus. Look the JavaScript code:
> 
> <script type="text/javascript">
> if (document.getElementById) {
>       var UserMenu = new WebFXTree('Usuario de teste');
>       var p01 = new WebFXTreeItem('p01');
>     UserMenu.add(p01);
>      var b = new WebFXTreeItem('Bugs Resolvidos ()','a');
>     p02.add(b); <--------------------ERROR---------------------
>      var p02 = new WebFXTreeItem('p02');
>     UserMenu.add(p02);
>      var b = new WebFXTreeItem('Bugs Resolvidos ()','a');
>     p02.add(b);
>      document.write(UserMenu);
> } else {
>  var msg = "Your browser does not support 
> document.getElementById().\n";  msg += "You must use a modern 
> browser for this menu.";  alert(msg); } </script>
> 
> Look the line that i put the comment. The variable p02 is not 
> declared and the JavaScript use method .add to put something. 
> The correct is p01 and not p02. 
> 
> Look a piece of my code that a use to generate this JavaScript:
> 
> menu = new net.sf.navigator.menu.MenuComponent();
> menu.setName(MENU_NAME); menu.setTitle(menuFacade.getUserName());
> ProjectSmallInfo project;
> Iterator i = projects.iterator();
> while (i.hasNext()) {
>       project = (ProjectSmallInfo) i.next();
>       nodeTree = new MenuComponent();
>       nodeTree.setTitle(new String(project.getName()));
>       nodeTree.setName(project.getName());
>       nodeTree.addMenuComponent(infoProject);
>       menu.addMenuComponent(nodeTree);
> }
> 
> 
> Could you solve this problem and disponibilize a path for us ?
> 
> Thank's Matt
> 
> 
> 
> 
> On Fri, 2004-02-27 at 12:34, Matt Raible wrote:
> 
> 
> > Take all the time you need. ;-)
> > 
> > Matt
> > 
> > On Feb 27, 2004, at 6:01 AM, Gustavo Padial wrote:
> > 
> > > Ok Matt.
> > >
> > > I will write. No problem.
> > >
> > > Just give-me some days right ?
> > >
> > > thank's for your help
> > >
> > > Gustavo Padial
> > >
> > > On Thu, 2004-02-26 at 19:18, Matt Raible wrote:
> > >> Gustavo - I'd *love* it if you could write a tutorial on 
> creating 
> > >> dynamic menus.  You can use my wiki if you'd like - then 
> I'll move 
> > >> it into the main struts-menu documentation.
> > >>
> > >> I can also probably add some code to strip whitespaces 
> from names 
> > >> (or add an underscore).
> > >>
> > >> 
> http://raibledesigns.com/wiki/Wiki.jsp?page=StrutsMenuDynamicMenus
> > >>
> > >> Thanks!
> > >>
> > >> Matt
> > >>
> > >>> -----Original Message-----
> > >>> From: [EMAIL PROTECTED]
> > >>> [mailto:[EMAIL PROTECTED] On Behalf 
> Of Gustavo 
> > >>> Padial
> > >>> Sent: Thursday, February 26, 2004 3:10 PM
> > >>> To: [EMAIL PROTECTED]
> > >>> Subject: RE: [struts-menu] Create dynamicaly menu itens
> > >>>
> > >>>
> > >>> Hi Matt
> > >>>
> > >>> I create dynamicaly itens with no problems now.
> > >>> ;-)
> > >>>
> > >>> I discovery in method .setName we cant put "spaces".
> > >>>
> > >>> For example: .setName("Hello World") dont load the menu in page.
> > >>>
> > >>> .setName("HelloWorld") load menu in page. ;-P
> > >>>
> > >>> Our old friend JavaScript ! ;-)
> > >>>
> > >>> Thank's.
> > >>>
> > >>> Do you like that i write a tutorial to put in 
> struts-menu page to 
> > >>> show how create dynamicaly menu's ?
> > >>>
> > >>> Bye
> > >>>
> > >>> On Thu, 2004-02-26 at 18:37, Matt Raible wrote:
> > >>>> Have you tried the code below?  It looks like it'll work.
> > >>> I've never
> > >>>> tried to build a menu dynamically, so I'm just guessing here.
> > >>>>
> > >>>> Matt
> > >>>>
> > >>>>> -----Original Message-----
> > >>>>> From: [EMAIL PROTECTED]
> > >>>>> [mailto:[EMAIL PROTECTED] On Behalf Of 
> > >>>>> Gustavo Padial
> > >>>>> Sent: Thursday, February 26, 2004 2:27 PM
> > >>>>> To: [EMAIL PROTECTED]
> > >>>>> Subject: RE: [struts-menu] Create dynamicaly menu itens
> > >>>>>
> > >>>>>
> > >>>>> Ok i'll see old versions.
> > >>>>>
> > >>>>> But, in struts-menu 2.1 we dont have methods to create itens 
> > >>>>> dynamicaly ?
> > >>>>>
> > >>>>> How struts-menu 2.1 creates menu and subitens given a 
> > >>>>> struts-menu.xml ?
> > >>>>>
> > >>>>> Why i cant create with this code:
> > >>>>>
> > >>>>> MenuComponent infoProject = new MenuComponent(); 
> > >>>>> infoProject.setTitle("Bugs Resolvidos ()"); 
> > >>>>> infoProject.setName("Bugs Resolvidos ()"); 
> > >>>>> infoProject.setPage("/admin/teste.jsp");
> > >>>>> infoProject.setAction(""); infoProject.setLocation("a");
> > >>>>>
> > >>>>> nodeTree = repository.getMenu("UserProject");
> > >>>>> nodeTree.addMenuComponent(infoProject);
> > >>>>>
> > >>>>> Thank's Matt
> > >>>>>
> > >>>>> Gustavo
> > >>>>>
> > >>>>>
> > >>>>> On Thu, 2004-02-26 at 18:05, Matt Raible wrote:
> > >>>>>> I don't believe I removed or modified anything in 
> MenuComponent 
> > >>>>>> b/w 1.3 and 2.1.
> > >>>>>>
> > >>>>>> Matt
> > >>>>>>
> > >>>>>>> -----Original Message-----
> > >>>>>>> From: [EMAIL PROTECTED]
> > >>>>>>> [mailto:[EMAIL PROTECTED] On Behalf Of 
> > >>>>>>> Gustavo Padial
> > >>>>>>> Sent: Thursday, February 26, 2004 1:57 PM
> > >>>>>>> To: [EMAIL PROTECTED]
> > >>>>>>> Subject: RE: [struts-menu] Create dynamicaly menu itens
> > >>>>>>>
> > >>>>>>>
> > >>>>>>> Hello Matt
> > >>>>>>>
> > >>>>>>> I got the classes but i'm using Struts Menu 2.1.
> > >>>>>>> The class MenuComponentBuilder.java uses the folow 
> methods of 
> > >>>>>>> MenuComponent.class :
> > >>>>>>>
> > >>>>>>> menu.setBaseObject(obj);
> > >>>>>>> menu.setParams(params);
> > >>>>>>>
> > >>>>>>> The two methods above not exists in struts-menu 2.1 right
> > >>>>> ? We have
> > >>>>>>> a similary methods or i need to use old version of
> > >>> struts menu ?
> > >>>>>>>
> > >>>>>>> Thank's
> > >>>>>>>
> > >>>>>>> Gustavo
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>> On Thu, 2004-02-26 at 17:37, Matt Raible wrote:
> > >>>>>>>> Try this:
> > >>>>>>>>
> > >>>>>>>>
> > >>>>>>>
> > >>>>>
> > >>> 
> http://www.mail-archive.com/struts-menu-devel%40lists.sf.net/msg00
> > >>> 01
> > >>>>>>> 1.
> > >>>>>>>> ht
> > >>>>>>>> ml
> > >>>>>>>>
> > >>>>>>>> If it works for you, please let me know - I'd like to add a
> > >>>>>>> sample to
> > >>>>>>>> the example app.
> > >>>>>>>>
> > >>>>>>>> Matt
> > >>>>>>>>
> > >>>>>>>>
> > >>>>>>>>> -----Original Message-----
> > >>>>>>>>> From: [EMAIL PROTECTED]
> > >>>>>>>>> [mailto:[EMAIL PROTECTED] On Behalf Of 
> > >>>>>>>>> Gustavo Padial
> > >>>>>>>>> Sent: Thursday, February 26, 2004 1:00 PM
> > >>>>>>>>> To: [EMAIL PROTECTED]
> > >>>>>>>>> Subject: [struts-menu] Create dynamicaly menu itens
> > >>>>>>>>>
> > >>>>>>>>>
> > >>>>>>>>> Hello people
> > >>>>>>>>>
> > >>>>>>>>> I'm using struts-menu and i like so much, but i need
> > >>>>> to create
> > >>>>>>>>> dynamicaly items in menu. How can i make this ?
> > >>>>>>>>>
> > >>>>>>>>> I see a message posted but the answer is with wrong link.
> > >>>>>>>>>
> > >>>>>>>>> Thank's
> > >>>>>>>>>
> > >>>>>>>>>
> > >>>>>>>>> --
> > >>>>>>>>> ===========================
> > >>>>>>>>> Gustavo Padial
> > >>>>>>>>> Gerente de Projetos
> > >>>>>>>>> Kaffa Software Consulting
> > >>>>>>>>> +55 19 3296 3505
> > >>>>>>>>> www.kaffa.com.br
> > >>>>>>>>> ===========================
> > >>>>>>>>>
> > >>>>>>>>>                                                   
> > >>>>>>>>>
> > >>>>>>>>>
> > >>>>>>>>>
> > >>>>>>>>> -------------------------------------------------------
> > >>>>>>>>> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > >>>>>>> Build and
> > >>>>>>>>> deploy apps & Web services for Linux with a free DVD 
> > >>>>>>>>> software kit
> > >>>>>>>>> from IBM. Click Now!
> > >>>>>>> http://ads.osdn.com/?ad_id=1356&alloc_id=3438>
> > >>>>>>>>> &op=click
> > >>>>>>>
> > >>>>>>>>>
> > >>>>>>>>> _______________________________________________
> > >>>>>>>>>
> > >>>>>>>>> struts-menu-user mailing list
> > >>> [EMAIL PROTECTED]
> > >>>>>>>>> https://lists.sf.net/lists/listinfo/struts-> menu-user
> > >>>>>>>>>
> > >>>>>>>>
> > >>>>>>>>
> > >>>>>>>>
> > >>>>>>>>
> > >>>>>>>> -------------------------------------------------------
> > >>>>>>>> SF.Net is sponsored by: Speed Start Your Linux Apps
> > >>>>> Now. Build and
> > >>>>>>>> deploy apps & Web services for Linux with a free DVD
> > >>>>>>> software kit from
> > >>>>>>>> IBM. Click Now!
> > >>>>>>> http://ads.osdn.com/?ad_id=1356&alloc_id=3438> &op=click
> > >>>>>>>>
> > >>>>>>> _______________________________________________
> > >>>>>>>
> > >>>>>>>> struts-menu-user mailing list 
> [EMAIL PROTECTED] 
> > >>>>>>>> https://lists.sf.net/lists/listinfo/struts-menu-user
> > >>>>>>> --
> > >>>>>>> ===========================
> > >>>>>>> Gustavo Padial
> > >>>>>>> Gerente de Projetos
> > >>>>>>> Kaffa Software Consulting
> > >>>>>>> +55 19 3296 3505
> > >>>>>>> www.kaffa.com.br
> > >>>>>>> ===========================
> > >>>>>>>
> > >>>>>>>                                                     
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>> -------------------------------------------------------
> > >>>>>>> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > >>>>> Build and
> > >>>>>>> deploy apps & Web services for Linux with a free 
> DVD software 
> > >>>>>>> kit from IBM. Click Now!
> > >>>>> http://ads.osdn.com/?ad_id=1356&alloc_id=3438>
> > >>>>>>> &op=click
> > >>>>>
> > >>>>>>>
> > >>>>>>> _______________________________________________
> > >>>>>>>
> > >>>>>>> struts-menu-user mailing list [EMAIL PROTECTED] 
> > >>>>>>> https://lists.sf.net/lists/listinfo/struts-> menu-user
> > >>>>>>>
> > >>>>>>
> > >>>>>>
> > >>>>>>
> > >>>>>>
> > >>>>>> -------------------------------------------------------
> > >>>>>> SF.Net is sponsored by: Speed Start Your Linux Apps
> > >>> Now. Build and
> > >>>>>> deploy apps & Web services for Linux with a free DVD
> > >>>>> software kit from
> > >>>>>> IBM. Click Now!
> > >>>>> http://ads.osdn.com/?ad_id=1356&alloc_id=3438> &op=click
> > >>>>>>
> > >>>>> _______________________________________________
> > >>>>>
> > >>>>>> struts-menu-user mailing list [EMAIL PROTECTED] 
> > >>>>>> https://lists.sf.net/lists/listinfo/struts-menu-user
> > >>>>> --
> > >>>>> ===========================
> > >>>>> Gustavo Padial
> > >>>>> Gerente de Projetos
> > >>>>> Kaffa Software Consulting
> > >>>>> +55 19 3296 3505
> > >>>>> www.kaffa.com.br
> > >>>>> ===========================
> > >>>>>
> > >>>>>                                                       
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>> -------------------------------------------------------
> > >>>>> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> > >>> Build and
> > >>>>> deploy apps & Web services for Linux with a free DVD software 
> > >>>>> kit from IBM. Click Now!
> > >>> http://ads.osdn.com/?ad_id=1356&alloc_id=3438>
> > >>>>> &op=click
> > >>>
> > >>>>>
> > >>>>> _______________________________________________
> > >>>>>
> > >>>>> struts-menu-user mailing list [EMAIL PROTECTED]
> > >>>>> https://lists.sf.net/lists/listinfo/struts-> menu-user
> > >>>>>
> > >>>>
> > >>>>
> > >>>>
> > >>>>
> > >>>> -------------------------------------------------------
> > >>>> SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build 
> > >>>> and deploy apps & Web services for Linux with a free DVD
> > >>> software kit from
> > >>>> IBM. Click Now!
> > >>> http://ads.osdn.com/?ad_id=1356&alloc_id=3438> &op=click
> > >>>>
> > >>> _______________________________________________
> > >>>
> > >>>> struts-menu-user mailing list [EMAIL PROTECTED]
> > >>>> https://lists.sf.net/lists/listinfo/struts-menu-user
> > >>> --
> > >>> ===========================
> > >>> Gustavo Padial
> > >>> Gerente de Projetos
> > >>> Kaffa Software Consulting
> > >>> +55 19 3296 3505
> > >>> www.kaffa.com.br
> > >>> ===========================
> > >>>
> > >>>                                                         
> > >>>
> > >>>
> > >>>
> > >>> -------------------------------------------------------
> > >>> SF.Net is sponsored by: Speed Start Your Linux Apps 
> Now. Build and 
> > >>> deploy apps & Web services for Linux with a free DVD 
> software kit 
> > >>> from IBM. Click Now! 
> > >>> http://ads.osdn.com/?ad_id=1356&alloc_id=3438> &op=click
> > >>>
> > >>> _______________________________________________
> > >>>
> > >>> struts-menu-user mailing list [EMAIL PROTECTED]
> > >>> https://lists.sf.net/lists/listinfo/struts-> menu-user
> > >>>
> > >>
> > >>
> > >>
> > >>
> > >> -------------------------------------------------------
> > >> SF.Net is sponsored by: Speed Start Your Linux Apps Now. 
> Build and 
> > >> deploy apps & Web services for Linux with a free DVD 
> software kit 
> > >> from IBM. Click Now! 
> > >> http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > >> _______________________________________________
> > >> struts-menu-user mailing list [EMAIL PROTECTED]
> > >> https://lists.sf.net/lists/listinfo/struts-menu-user
> > > --
> > > ===========================
> > > Gustavo Padial
> > > Gerente de Projetos
> > > Kaffa Software Consulting
> > > +55 19 3296 3505
> > > www.kaffa.com.br
> > > ===========================
> > >
> > >                                                   
> > >
> > >
> > >
> > > -------------------------------------------------------
> > > SF.Net is sponsored by: Speed Start Your Linux Apps Now. 
> Build and 
> > > deploy apps & Web services for Linux with a free DVD software kit 
> > > from IBM. Click Now! 
> > > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> > > _______________________________________________
> > > struts-menu-user mailing list
> > > [EMAIL PROTECTED] 
> > > https://lists.sf.net/lists/listinfo/struts-menu-user
> > 
> > 
> > 
> > -------------------------------------------------------
> > SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and 
> > deploy apps & Web services for Linux with a free DVD 
> software kit from 
> > IBM. Click Now! 
> http://ads.osdn.com/?ad_id=1356&alloc_id=3438> &op=click
> > 
> _______________________________________________
> 
> > struts-menu-user mailing list
> > [EMAIL PROTECTED]
> > https://lists.sf.net/lists/listinfo/struts-menu-user
> -- 
> ===========================
> Gustavo Padial
> Gerente de Projetos
> Kaffa Software Consulting
> +55 19 3296 3505
> www.kaffa.com.br
> ===========================
> 
>                                                       
> 
> 
> 
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now! 
> http://ads.osdn.com/?ad_id=1356&alloc_id=3438> &op=click
> 
> _______________________________________________
> 
> struts-menu-user mailing list
> [EMAIL PROTECTED] 
> https://lists.sf.net/lists/listinfo/struts-> menu-user
> 




-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
struts-menu-user mailing list
[EMAIL PROTECTED]
https://lists.sf.net/lists/listinfo/struts-menu-user

Reply via email to