8 Replies Latest reply on Jan 19, 2009 4:23 AM by Jose Berardo

    ListShuttle with Entities and Seam

    asaf sh Expert

      Hey,

      Is it possible to use seam's EntityConverter with listShuttle? for easy entities submission ?



      Thanks,

      Asaf.

        • 1. Re: ListShuttle with Entities and Seam
          asaf sh Expert

          Eh, looks like it's working without any special coding :)


          Thanks.

          • 2. Re: ListShuttle with Entities and Seam
            x y Newbie

            trouby - do you mind sharing how u used the entityconverter with list shuttle. i am writing converters for everything (that i will put into list shuttle) here. thanks.

            • 3. Re: ListShuttle with Entities and Seam
              Francisco Antônio Newbie

              Hi!

               <rich:listShuttle var="papel" sourceValue="#{papelList.resultList}" targetValue="#{usuarioHome.instance.papeis}"
               sourceCaptionLabel="Permissões disponÃÂÂveis" targetCaptionLabel="Permissões atribuÃÂÂdas"
               copyAllControlLabel="#{messages.CopiarTudo}" copyControlLabel="#{messages.Copiar}"
               removeAllControlLabel="#{messages.RemoverTudo}" removeControlLabel="#{messages.Remover}"
               orderControlsVisible="false" fastOrderControlsVisible="false" converter="#{org.jboss.seam.ui.EntityConverter}">
              
               <rich:column>#{papel}</rich:column>
              
               </rich:listShuttle>
              


              Cheers,
              Francisco Barros
              "Although nobody can come back and make a new start, anyone can start now and make a new end." (Chico Xavier, Brazil's most famous medium)


              • 4. Re: ListShuttle with Entities and Seam
                Jose Berardo Newbie

                Francisco,


                Hi!

                Code:

                <rich:listShuttle var="papel" sourceValue="#{papelList.resultList}" targetValue="#{usuarioHome.instance.papeis}"
                sourceCaptionLabel="Permissoes disponiveis" targetCaptionLabel="Permissoes atribuidas"
                copyAllControlLabel="#{messages.CopiarTudo}" copyControlLabel="#{messages.Copiar}"
                removeAllControlLabel="#{messages.RemoverTudo}" removeControlLabel="#{messages.Remover}"
                orderControlsVisible="false" fastOrderControlsVisible="false"
                converter="#{org.jboss.seam.ui.EntityConverter}
                ">

                <rich:column>#{papel}</rich:column>

                </rich:listShuttle>




                It doesn't work with me.

                I'm getting java.lang.IllegalArgumentException.

                • 5. Re: ListShuttle with Entities and Seam
                  Nick Belaevski Master

                  Try using <s:convertEntity />

                  • 7. Re: ListShuttle with Entities and Seam
                    John Ament Master

                    how do you have your entity manager configured in seam? i believe s:convertEntity requires you to use the @In style, and only one entityManager bound to the name "entityManager"

                    • 8. Re: ListShuttle with Entities and Seam
                      Jose Berardo Newbie

                      My bean:

                      @Name("perguntasAction")

                      public class PerguntasAction {
                       @In private EntityManager entityManager;
                       @In private FacesMessages facesMessages;
                       @Logger private Log log;
                      
                       @DataModel private List<Pergunta> perguntas;
                       @DataModelSelection private Pergunta perguntaAtual;
                      
                       @Factory(value="perguntas")
                       public void loadPerguntas() {
                       perguntas = entityManager.createQuery("from Pergunta")
                       .getResultList();
                       }
                      
                      }


                      My view:
                      <rich:orderingList value="#{perguntas}" var="_pergunta">
                       <s:convertEntity></s:convertEntity>
                       <rich:column>
                       <f:facet name="header">Id</f:facet>
                       <h:outputText value="#{_pergunta.id}" />
                       </rich:column>
                      </rich:orderingList>


                      In this case, I'm using an orderingList, but I'm having the same error (IllegalArgumentException) using listShuttle