I tried to reproduce this with the latest and greatest and could
not...   Specifically, the following page:

<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"; version="2.0"
         xmlns:f="http://java.sun.com/jsf/core";
         xmlns:tr="http://myfaces.apache.org/trinidad"; >
 <jsp:directive.page contentType="text/html;charset=utf-8"/>
 <f:view>
   <tr:document>
       <tr:form>
         <tr:panelGroupLayout layout="vertical">
           <tr:selectOrderShuttle id="foo" label="Cars"
                                 valueChangeListener="#{list.valueChanged}"
                                 value="#{list.selectedCars}">
             <f:selectItems value="#{list.makes}"/>
           </tr:selectOrderShuttle>
           <tr:message for="foo"/>
            <tr:commandButton text="Submit"/>
         </tr:panelGroupLayout>
       </tr:form>
`    </tr:document>
 </f:view>
</jsp:root>

... in the demo bundle.  That's f:selectItems where
value is a List<Car>, and the SelectItems have Car
objects as their values.

-- Adam


On 10/21/06, Adam Winer <[EMAIL PROTECTED]> wrote:
That's very disconcerting;  this could be a recently introduced
bug (I redid the implementation of the shuttle renderers).  I'll
have to build up a little testcase and see what's what.  You're
using a recent build, right?

-- Adam


On 10/20/06, Scott Wall <[EMAIL PROTECTED]> wrote:
> I tried three iterations...<tr:selectManyListbox>,<tr:selectManyShuttle> and
> <tr:selectOrderShuttle>...
>
> The single tag is the only thing that changed. The pertinent source is as
> follows:
>
> In the jsp...
>
> <tr:selectManyListbox value="#{backing_EditDiagnosis.pickedItems}">
>   <f:selectItems value="#{applicationParams.diagnoses}"/>
> </tr:selectManyListbox>
> <tr:commandButton text="OK"
> action="#{backing_EditDiagnosis.submitForm}"/>
>
> In the backing bean backing_EditDiagnosis...
>
> private List<Diagnosis> pickedItems = new ArrayList<Diagnosis>();
>
> public String submitForm() {
>     System.out.println(pickedItems);
>     AdfFacesContext.getCurrentInstance().returnFromDialog(null, null);
>     return null;
> }
>
> In the application-scope bean...
>
> private List<SelectItem> diagnoses;
> ...
> diagnoses = new ArrayList<SelectItem>();
> for( Diagnosis dg : d ) {
>     diagnoses.add(new SelectItem(dg,dg.getDescription()));
> }
>
> The <tr:selectManyListbox> control works as expected.
>
> In the <tr:selectManyShuttle> pickedItems "becomes" an array of
> java.lang.Integer's.
>
> In the <tr:selectOrderShuttle> pickedItems is a java.util.List of size()=0.
>
> I am REALLY baffled. The <tr:selectManyShuttle> especially seems to violate
> type safety, as the backing bean very clearly types pickedItems as an
> ArrayList<Diagnosis>(). Diagnosis inherits directly from java.lang.Object.
>
> Any thoughts would be helpful.
>
> Regards,
> Scott
>
> On 10/20/06, Adam Winer <[EMAIL PROTECTED]> wrote:
> >
> > selectedItems shouldn't be a List<SelectItem>.  It
> > should be a List<whateverTheValueOfYourSelectItems>.
> >
> > If your selectItems have a value that is String, selectedItems
> > should be List<String>.
> >
> > A hint:  use selectManyListbox, even h:selectManyListbox.
> > Then take *exactly* that code and just switch the tag to
> > <tr:selectOrderShuttle>.  If you know how to use
> > selectManyListbox or selectManyCheckbox, you know
> > how to use selectManyShuttle and selectOrderShuttle.
> >
> > -- Adam
> >
> >
> > On 10/20/06, Scott Wall <[EMAIL PROTECTED]> wrote:
> > > I am trying to use a selectOrderShuttle component to allow users to
> > select
> > > several elements from an array of <f:selectItems>. This is done in an
> > ADF
> > > dialog framework separate dialog that I would then like to return a
> > > java.util.List of objects to the backing bean of the page that opens the
> > > dialog. However, the array that is returned has 0 elements. I have gone
> > over
> > > and over this trying many different iterations such as:
> > >
> > > <%@ taglib uri="http://myfaces.apache.org/adf/faces/html"; prefix="trh"
> > %>
> > >  <%@ taglib uri="http://myfaces.apache.org/adf/faces"; prefix="tr" %>
> > > <%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f" %>
> > >
> > > <f:view>
> > > <trh:html>
> > > <trh:head title="Edit Diagnosis Dialog"/>
> > >
> > > <trh:body>
> > > <tr:form>
> > >
> > > <tr:selectOrderShuttle value="#{backing_EditDiagnosis.selectedItems}"
> > > binding="#{backing_EditDiagnosis.shuttle}">
> > >   <f:selectItems value="#{applicationParams.diagnoses}"/>
> > > </tr:selectOrderShuttle>
> > >
> > > <tr:commandButton text="OK"
> > action="#{backing_EditDiagnosis.submitForm}"/>
> > >
> > > </tr:form>
> > > </trh:body>
> > > </trh:html>
> > > </f:view>
> > >
> > > backing_EditDiagnosis is a session-scoped backing bean...
> > >
> > > import java.util.*;
> > > import org.apache.myfaces.context.AdfFacesContext;
> > > import
> > org.apache.myfaces.adf.component.core.input.CoreSelectOrderShuttle;
> > >
> > > public class EditDiagnosis {
> > >
> > > private ArrayList<SelectItem> selectedItems = new
> > ArrayList<SelectItem>();
> > > private CoreSelectOrderShuttle shuttle;
> > >
> > >   public String submitForm() {
> > >     for(SelectItem i  : selectedItems) {
> > >       System.out.println("Item: " + i.getLabel());
> > >     }
> > >     AdfFacesContext.getCurrentInstance().returnFromDialog(null,null);
> > >     return null;
> > >   }
> > >
> > > ...getters/setters for selectedItems, shuttle
> > >
> > > }
> > >
> > > ...applicationParams.diagnoses returns a SelectItem[]...
> > >
> > > but I can never get selectedItems to have anything other than a
> > size()=0.
> > > What am I doing wrong?
> > >
> > > Thanks in advance,
> > > Scott
> > >
> > >
> >
>
>

Reply via email to