I'm from a Spanish language country and I want to correct something:
/*  Now, the destiny page    */    is:

/*  Now, the TARGET page    */

On Fri, Sep 4, 2009 at 9:26 PM, Madtyn<mad...@gmail.com> wrote:
>  Hello. I keep trying to use the EventContext and made some advances.
> As Joshua said the enums can be sent between the onPassivate and
> onActivate methods (Thank you Joshua :).
>
>
>   But the problem is that I keep finding very strange problems. I
> have isolated the piece of code that is giving me hell. I'm passing
> two enums to the onActivate and I do inside two nested switch, but it
> always fails when trying to read the value of the second enum at the
> second switch and gives the classic:
>
>  java.lang.VerifyError Illegal constant pool index
>
>   And the stacktrace leads to the line where I first set an attribute
> to the destiny page.
>
>   If I comment the second switch, the code works, but I need to work
> with the value of the enum (that's why I'm passing it).
>
>   As I don't know if I'm allowed to send attached files, I copy the
> abbreviated code down here. Sorry if it bothers. The code problem is
> at the deep bottom. Getters and setters are omitted. Thanks on
> advance.
>
>
>
> public class FindSocios {
>
> @Property
>        private Long idSocio, idServ;
>
>       �...@property
>        private Date date1=null, date2=null;
>
>       �...@property
>        private String apellidos, login, dni;
>
>        private SocioSearchType socioSearchType = SocioSearchType.ALL;
>        private DateSearchType dateSearchType=DateSearchType.BYNODATE;
>        private CatType catSearchType = CatType.ADULTO;
>
>       �...@injectpage
>        private FindSocios refresh;
>
>       �...@injectpage
>        private ShowSocios showSocios;
>
>       �...@injectpage
>        private InfoSocio infoSocio;
>
>        Object[] onPassivate() {
>                if(busqueda) {
>                        return new Object[] {socioSearchType, dateSearchType};
>                }
>                else return null;
>        }
>
>
>        // Necesario para cuando la pagina muestra el segundo formulario
>        void onActivate(EventContext ev) {
>                if(ev.getCount()==2)
>                        socioSearchType = ev.get(SocioSearchType.class, 0);
>                        dateSearchType = ev.get(DateSearchType.class, 1);
>
>        }
> Object onSuccess() throws ParseException {
>                if(busqueda) {
>
>                        busqueda = false;
>
>                        infoSocio.setSocioSearchType(socioSearchType);
>                        infoSocio.setDateSearchType(dateSearchType);
>                        showSocios.setSocioSearchType(socioSearchType);
>                        switch(socioSearchType) {
>                                case BYAPELL:
>                                        showSocios.setApellidos(apellidos);
>                                        return showSocios;
>                                case BYSERVICIO:
>                                        showSocios.setIdServ(idServ);
>                                        return showSocios;
>                                case BYCATEGORIA:
>                                        
> showSocios.setCatSearchType(catSearchType);
>                                        return showSocios;
>                                case HISTORY:
>                                        showSocios.setIdSocio(idSocio);
>                                        return showSocios;
>                                case BYLOGIN:
>                                        infoSocio.setLogin(login);
>                                        return infoSocio;
>                                case BYDNI:
>                                        infoSocio.setDni(dni);
>                                        return infoSocio;
>                                case BYID:
>                                        infoSocio.setIdSocio(idSocio);
>                                        return infoSocio;
>                                case ALL:
>                                        switch(dateSearchType) {
>                                                case BYDATE:
>                                                        
> showSocios.setDateSearchType(dateSearchType);
>                                                        
> showSocios.setDate1(DateHandler.dateToSendFormat(date1));
>                                                        return showSocios;
>                                                case BYDATES:
>                                                        
> showSocios.setDateSearchType(dateSearchType);
>                                                        
> showSocios.setSocioSearchType(socioSearchType);
>                                                        
> showSocios.setDate1(DateHandler.dateToSendFormat(date1));
>                                                        
> showSocios.setDate2(DateHandler.dateToSendFormat(date2));
>                                                        return showSocios;
>                                        }
>                                default: return null;
>                        }
>        }
>        return null;
>
>        }
>
> }
>
>
>                                      /*  Now, the destiny page    */
>
> public class ShowSocios {
>
>       �...@property
>        private final int SOCIOS_PER_PAGE=10;
>
>        private SocioSearchType socioSearchType;
>        private DateSearchType dateSearchType;
>        private CatType catSearchType;
>
>        private int startIndex=0;
>
>       �...@property
>        private SocioInfo info;
>        private Block<SocioInfo> infos;
>
>
>        private Long idSocio, idServ;
>        private Date date1, date2;
>        private String apellidos, dni, login;
>
>       �...@property
>        private Socio socio;
>
>       �...@inject
>        private GimnasioService gimnasioService;
>
>       �...@inject
>        private Locale locale;
>
> Object onPassivate() {
>                switch(socioSearchType) {
>                        case BYAPELL:                           return new 
> Object[] {socioSearchType, apellidos};
>                        case BYCATEGORIA:                       return new 
> Object[] {socioSearchType, catSearchType};
>                        case BYSERVICIO:                        return new 
> Object[] {socioSearchType,idServ};
>                        case HISTORY:                           return new 
> Object[] {socioSearchType,idSocio};
>                        case ALL:
>                                switch(dateSearchType) {
>                                        case BYNODATE:  return new Object[] 
> {socioSearchType, dateSearchType};
>                                        case BYDATE:    return new Object[] 
> {socioSearchType, dateSearchType, date1};
>                                        case BYDATES:   return new Object[] 
> {socioSearchType,
> dateSearchType, date1, date2};
>                                }
>                        default: return new Object[] {};
>                }
>        }
>
>        void onActivate(EventContext ev) throws InstanceNotFoundException {
>                System.out.println(ev.getCount()+" = 
> "+ev.get(SocioSearchType.class,
> 0).toString()+"; "+ev.get(String.class, 1));
>
>                socioSearchType = ev.get(SocioSearchType.class, 0);
>
>                switch(socioSearchType) {
>                        case BYAPELL:
>                                apellidos = ev.get(String.class, 1);
>                                infos = 
> gimnasioService.findSociosByApell(apellidos, startIndex,
> SOCIOS_PER_PAGE);
>                                break;
>                        case BYCATEGORIA:
>                                catSearchType = ev.get(CatType.class, 1);
>                                infos = 
> gimnasioService.findEstSocios("categoria.idCategoria",
> catSearchType.getId(), null, null,  startIndex, SOCIOS_PER_PAGE);
>                                break;
>                        case HISTORY:
>                                idSocio = ev.get(Long.class, 1);
>                                infos = gimnasioService.histSocio(idSocio, 
> startIndex, SOCIOS_PER_PAGE);
>                                break;
>                        case BYSERVICIO:
>                                idServ = ev.get(Long.class, 1);
>                                infos = 
> gimnasioService.findActualSociosByConv(idServ, startIndex,
> SOCIOS_PER_PAGE);
>                                break;
>                        case ALL:
>                                infos=gimnasioService.findEstSocios(null, 
> null, null, null,
> startIndex, SOCIOS_PER_PAGE);
>                                dateSearchType = ev.get(DateSearchType.class, 
> 1);
>
>                /* THIS IS THE DANGEROUS CODE THAT BREAKS EVERYTHING */
>                                /*switch(dateSearchType) {
>                                        case BYNODATE:
>                                                break;
>                                        case BYDATE:
>                                                break;
>                                        case BYDATES:
>                                                break;
>                                }*/
>                                break;
>                }
>        }
> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to