incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "D. Cardon" <my_trash_m...@yahoo.com>
Subject Re: [Trinidad] about usage of SelectManyShuttle/SelectOrderShuttle
Date Mon, 16 Apr 2007 17:54:54 GMT
Renzo,

Sorry about that last post--I accidentally sent it
before I was done...

Anyway, let me send the real message:

In order to populate the list of selectable items from
your backing bean, you can use:

<f:selectItems value="#{backingBean.shuttleItems} />

The backingBean object should have a 'getShuttleItems'
accessor, which returns a: SelectItem[].  Each select
item may be an object-label pair, so there's where you
store your object reference.  The value of the shuttle
component is an array of the objects (those which
appear in the object label pairs) that are currently
selected (on the right side of the shuttle).

For example, suppose the component on the page looks
like this:

<tr:selectManyShuttle 
    value="#{backingBean.selectedShuttleItems}">
	<f:selectItems 
	value="#{backingBean.shuttleItems}" />
</tr:selectManyShuttle>

...and our backing bean looks like this:

(BackingBean.java)
...
//
//  The list of selected items that should appear in
//  the shuttle component.
//
Gizmo [] itemList = null;

//
//  Returns the current selected objects.
//
Gizmo [] getSelectedShuttleItems()
{
}

//
//
//
...
public SelectItem[] getShuttleItems()
{
   SelectItem[] shuttleItems = new SelectItem[ 3 ];
   shuttleItems[ 0 ] = new SelectItem( 
}

If you bind the shuttle component to a variable in the
backing bean, that component's value will be an array
of objects.  For example, if getShuttleItems returns
an array of SelectItems, each 


Renzo,
It's possible to achieve all of the behavior that you
describe without resorting to JavaScript.
> 
> In order to populate the list of selectable items
from
> your backing bean, you can use:

> <f:selectItems value="#{backingBean.shuttleItems} />

> The backingBean object should have a
'getShuttleItems'
> accessor, which returns a: SelectItem[].  Each
select
> item may be an object-label pair, so there's where
you
> store your object reference.  For example:
> 
> (BackingBean.java)
> ...
> //
> //
> //
> Gizmo
> 
> ...
> public SelectItem[] getShuttleItems()
> {
>    SelectItem[] shuttleItems = new SelectItem[ 3 ];
>    shuttleItems[ 0 ] = new SelectItem( 
> }
> 
> If you bind the shuttle component to a variable in
the
> backing bean, that component's value will be an
array
> of objects.  For example, if getShuttleItems returns
> an array of SelectItems, each 
> 
> 
> 
> > Hi, I'm about to use these components, and I'm a
bit
> > confused about 
> > their documentation.
> > Included demos provide list contents through
> > tr:selectItem children. At 
> > the same time, I noticed that contents can be
get/set
> > through the 
> > "value" attribute.
> > Can anybody enlight such usage ? Is there any
other
> > public demo/example 
> > around ?
> > I also noticed that provided documentation refers
to
> > the chance of using 
> > generic objects as list elements. This would be >
> very
> > useful to append 
> > further properties to list elements, to be managed
by
> > footer widgets 
> > using provided js hooks on current selection. But
the
> > overall subject is 
> > somewhat obscure.
> > Furthermore, I noticed that lists are always
provided
> > on the left 
> > container only, where used has to move elements
> > rightwards. But I think 
> > that common usage would start having some elements
> > already on the right 
> > list (update mode). Is there any way to achive
this
> > initial setup - or 
> > do I need to preprocess by means of js and a
hidden
> > "init" list?
> > 
> > Thanks -- Renzo

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Mime
View raw message