incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Lessard" <simon.lessar...@gmail.com>
Subject Re: Can I retrieve the currently selected menu item from a menuModel?
Date Thu, 14 Sep 2006 14:51:58 GMT
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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message