incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Hannum" <dhan...@quovadx.com>
Subject RE: Can I retrieve the currently selected menu item from a menuModel?
Date Thu, 14 Sep 2006 17:39:23 GMT
Thanks a lot!

Is there going to be a book? This is great information that I'm afraid
no one knows about because there isn't a good reference beside the
Javadocs. Now that I think about it, the skinning system is there too.
Complex, powerful, and spotty documentation.

I'd love to see a book about ADF or Trinidad. And I thought I read that
there would be one...

-----Original Message-----
From: Simon Lessard [mailto:simon.lessard.3@gmail.com] 
Sent: Thursday, September 14, 2006 10:52 AM
To: adffaces-user@incubator.apache.org
Subject: Re: Can I retrieve the currently selected menu item from a
menuModel?

Hello,

You can use:

// Backup the state
Object oldKey = model.getRowKey();

// Get the selected key
Object focusKey = model.getFocusRowKey();

// Get the selected data
model.setRowKey(focusKey);
Object data = model.getRowData();

// Restore the model's state
model.setRowKey(oldKey);


Regards,

~ Simon

On 9/14/06, Daniel Hannum <dhannum@quovadx.com> wrote:
>
> My question is one solution to a problem that I'm facing:
>
>
>
> Basically, I have a selectOneChoice in a facelets template, shared by
> all pages, but I'd like to disable it on some pages. One option is to
do
> "component.setDisabled(true)" in some backing beans but turn it back
on
> in all the others. Now, one method I read is to put that code in the
> backing bean's constructor, but that only works if all my beans are
> request-scoped, which I can't guarantee.
>
>
>
> Another option might be to use a tag attribute to make the component
> disable (or not render). If I could retrieve the currently selected
item
> from my menuModel in an EL expression, then I could store the "should
> this field be enabled?" information in the menu item class and
retrieve
> it at rendering time through EL. This would be ideal, because the
> information about whether the select box should be enabled or not
> naturally belongs in the description of the page, not in a random
> backing bean constructor. I don't know how to do it, though.
> ViewIdPropertyMenuModel doesn't seem to have a method that will get
the
> current menu item.
>
>
>
> Though it does have a method to get the current viewId, so maybe I
could
> write a method to traverse my tree of menu item backing beans and find
> the one with the same viewId.
>
>
>
> At this point, I'm contemplating ugly hacks. Any other ideas about how
> to accomplish this?
>
>
>
> Thanks
>
> Dan
>
>
>
>
>
>
>
>
>
>
>

Mime
View raw message