You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Zied Hamdi <ja...@gmail.com> on 2007/07/13 18:22:42 UTC

[tobago] can we create a UIMenu structure on the fly (from the server side)?

Hi Tobago,

I have a little problem filling a UIMenu (I took a look at the mailing list
and no one had the problem) : I've tried this:


      *public* UIMenu getPhoneMenu() {

            *return* phoneMenu;

      }





      *public* *void* setPhoneMenu(UIMenu phoneMenu) {

            PhoneNumber number = *super*.getThroughEl( "phone", PhoneNumber.
*class* );

            *this*.phoneMenu = phoneMenu;

            phoneMenu.setId( "phoneTypes" );

            phoneMenu.getAttributes().*put*( "image", "image/phone_types/"+
number.getType() +".PNG" );

            *for*( PhoneType type : PhoneType.*values*() ) {

                  UICommand command = *new* UICommand();

                  phoneMenu.getChildren().*add*( command );

                  Map<String, Object> attributes = command.getAttributes();

                  attributes.*put*( "image", "image/phone_types/"+ type +".
PNG" );

                  attributes.*put*( "label", type.toString().toLowerCase()
);

            }

      }


It doesn't work, it seems UIMenu has in its attributes Map the list of
the Command ids it contains...
Are the factories used to interpret the jsf structure designed to be used by
third parties? Or there another solution for creating my UIMenu

Regards,

-- 
Zied Hamdi

Re: [tobago] can we create a UIMenu structure on the fly (from the server side)?

Posted by Zied Hamdi <ja...@gmail.com>.
Thanks a lot Bernd,

I did't expect such a complete answer ;-).


If I may suggest an idea: seen that select boxes doesn't support icons and
subgrouping, maybe it's a good alternative to have a renderer based on the
menu markup output to implement a "full tree structured" select component
with iconed values. That's what I'm doing in my app, with a server side
selection change handling...

Regards,
Zied

2007/7/17, Bernd Bohmann <be...@atanion.com>:
>
> Hello Zied,
>
> just added a menu example to test
>
> see:
>
>
> http://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/test/src/main/webapp/menu.jsp
>
>
> and method getFileMenu in TestBean
>
>
> http://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/TestBean.java
>
> Regards
>
> Bernd
>
> Zied Hamdi wrote:
> > Hello again, I forgot to tell you I'm new to JSF, It's possible I'm
> doingit
> > all bad.
> >
> > I took a look in debug mode at a UIMenu instance initialized with Jsf
> tags,
> > and I've found an attribute containing the list of nested commands ids.
> I
> > suppose there's a factory for doing these routines... Does someone have
> the
> > info please?
> >
> > Regards,
> > Zied
> >
> >
> > 2007/7/13, Zied Hamdi <ja...@gmail.com>:
> >>
> >> Hi Tobago,
> >>
> >> I have a little problem filling a UIMenu (I took a look at the mailing
> >> list and no one had the problem) : I've tried this:
> >>
> >>
> >>       *public* UIMenu getPhoneMenu() {
> >>
> >>             *return* phoneMenu ;
> >>
> >>       }
> >>
> >>
> >>
> >>
> >>
> >>       *public* *void* setPhoneMenu(UIMenu phoneMenu) {
> >>
> >>             PhoneNumber number = *super* .getThroughEl ( "phone" ,
> >> PhoneNumber.*class* );
> >>
> >>             *this*. phoneMenu = phoneMenu ;
> >>
> >>             phoneMenu.setId( "phoneTypes" );
> >>
> >>             phoneMenu.getAttributes().*put*( "image",
> >> "image/phone_types/"+
> >> number.getType() + ".PNG " );
> >>
> >>             *for* ( PhoneType type : PhoneType.*values*() ) {
> >>
> >>                   UICommand command = *new* UICommand();
> >>
> >>                   phoneMenu .getChildren().*add*( command );
> >>
> >>                   Map<String, Object> attributes =
> >> command.getAttributes();
> >>
> >>                   attributes.*put* ( "image", "image/phone_types/"+
> >> type +
> >> ".PNG " );
> >>
> >>                   attributes .*put*( "label" ,
> >> type.toString().toLowerCase() );
> >>
> >>             }
> >>
> >>       }
> >>
> >>
> >> It doesn't work, it seems UIMenu has in its attributes Map the list of
> >> the Command ids it contains...
> >> Are the factories used to interpret the jsf structure designed to be
> used
> >> by third parties? Or there another solution for creating my UIMenu
> >>
> >> Regards,
> >>
> >> --
> >> Zied Hamdi
> >>
> >>
> >
> >
> >
>



-- 
Zied Hamdi
zatreex.sourceforge.net

Re: [tobago] can we create a UIMenu structure on the fly (from the server side)?

Posted by Bernd Bohmann <be...@atanion.com>.
Hello Zied,

just added a menu example to test

see:

http://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/test/src/main/webapp/menu.jsp


and method getFileMenu in TestBean

http://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/TestBean.java

Regards

Bernd

Zied Hamdi wrote:
> Hello again, I forgot to tell you I'm new to JSF, It's possible I'm doingit
> all bad.
> 
> I took a look in debug mode at a UIMenu instance initialized with Jsf tags,
> and I've found an attribute containing the list of nested commands ids. I
> suppose there's a factory for doing these routines... Does someone have the
> info please?
> 
> Regards,
> Zied
> 
> 
> 2007/7/13, Zied Hamdi <ja...@gmail.com>:
>>
>> Hi Tobago,
>>
>> I have a little problem filling a UIMenu (I took a look at the mailing
>> list and no one had the problem) : I've tried this:
>>
>>
>>       *public* UIMenu getPhoneMenu() {
>>
>>             *return* phoneMenu ;
>>
>>       }
>>
>>
>>
>>
>>
>>       *public* *void* setPhoneMenu(UIMenu phoneMenu) {
>>
>>             PhoneNumber number = *super* .getThroughEl ( "phone" ,
>> PhoneNumber.*class* );
>>
>>             *this*. phoneMenu = phoneMenu ;
>>
>>             phoneMenu.setId( "phoneTypes" );
>>
>>             phoneMenu.getAttributes().*put*( "image", 
>> "image/phone_types/"+
>> number.getType() + ".PNG " );
>>
>>             *for* ( PhoneType type : PhoneType.*values*() ) {
>>
>>                   UICommand command = *new* UICommand();
>>
>>                   phoneMenu .getChildren().*add*( command );
>>
>>                   Map<String, Object> attributes = 
>> command.getAttributes();
>>
>>                   attributes.*put* ( "image", "image/phone_types/"+ 
>> type +
>> ".PNG " );
>>
>>                   attributes .*put*( "label" , 
>> type.toString().toLowerCase() );
>>
>>             }
>>
>>       }
>>
>>
>> It doesn't work, it seems UIMenu has in its attributes Map the list of
>> the Command ids it contains...
>> Are the factories used to interpret the jsf structure designed to be used
>> by third parties? Or there another solution for creating my UIMenu
>>
>> Regards,
>>
>> -- 
>> Zied Hamdi
>>
>>
> 
> 
> 

Re: [tobago] can we create a UIMenu structure on the fly (from the server side)?

Posted by Zied Hamdi <ja...@gmail.com>.
Hello again, I forgot to tell you I'm new to JSF, It's possible I'm doingit
all bad.

I took a look in debug mode at a UIMenu instance initialized with Jsf tags,
and I've found an attribute containing the list of nested commands ids. I
suppose there's a factory for doing these routines... Does someone have the
info please?

Regards,
Zied


2007/7/13, Zied Hamdi <ja...@gmail.com>:
>
> Hi Tobago,
>
> I have a little problem filling a UIMenu (I took a look at the mailing
> list and no one had the problem) : I've tried this:
>
>
>       *public* UIMenu getPhoneMenu() {
>
>             *return* phoneMenu ;
>
>       }
>
>
>
>
>
>       *public* *void* setPhoneMenu(UIMenu phoneMenu) {
>
>             PhoneNumber number = *super* .getThroughEl ( "phone" ,
> PhoneNumber.*class* );
>
>             *this*. phoneMenu = phoneMenu ;
>
>             phoneMenu.setId( "phoneTypes" );
>
>             phoneMenu.getAttributes().*put*( "image", "image/phone_types/"+
> number.getType() + ".PNG " );
>
>             *for* ( PhoneType type : PhoneType.*values*() ) {
>
>                   UICommand command = *new* UICommand();
>
>                   phoneMenu .getChildren().*add*( command );
>
>                   Map<String, Object> attributes = command.getAttributes();
>
>                   attributes.*put* ( "image", "image/phone_types/"+ type +
> ".PNG " );
>
>                   attributes .*put*( "label" , type.toString().toLowerCase() );
>
>             }
>
>       }
>
>
> It doesn't work, it seems UIMenu has in its attributes Map the list of
> the Command ids it contains...
> Are the factories used to interpret the jsf structure designed to be used
> by third parties? Or there another solution for creating my UIMenu
>
> Regards,
>
> --
> Zied Hamdi
>
>



-- 
Zied Hamdi
zatreex.sourceforge.net