Unable to edit custom events

Hi all!
I’ve followed successfully created a timeline view. Events are loaded.

This is my event class:

public class Event extends DHXEvent {

	public String user;
	public String status;
	public String urgency;
        public String textColor;
        public String color;
        
        
        
	public String getUser() {
		return user;
	}
	public void setUser(String user) {
		this.user = user;
	}
        
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	public String getUrgency() {
		return urgency;
	}
	public void setUrgency(String urgency) {
		this.urgency = urgency;
	}
        
        public String getTextColor() {
                return textColor;
        }
        public void setTextColor(String textColor) {
                this.textColor = textColor;
        }
 
        
        public String getColor() {
                return color;
        }
        public void setColor(String color) {
                this.color = color;
        }
}

And this is my EventManager

public class EventsManager extends DHXEventsManager {

    private List<Gruppo> eleGruppi;
    private List<User> eleUtenti;

    public EventsManager(HttpServletRequest request) {
        super(request);
    }

    @Override
    public Iterable<DHXEv> getEvents() {
        Utils ut = new Utils();

        List<Calendg> eleEventi = Collections.EMPTY_LIST;

        eleGruppi = new ArrayList<Gruppo>();
        eleUtenti = new ArrayList<User>();

        try {
            CalendgJpaController ctrlCalen = new CalendgJpaController();
            eleEventi = ctrlCalen.getAllAttivitaRange("01", ut.FromStringToDate("01/01/2014", "dd/MM/yyyy"), ut.FromStringToDate("31/03/2014", "dd/MM/yyyy"));

            CalendgrpJpaController ctrlGruppi = new CalendgrpJpaController();
            List<Calendgrp> eleGrp = ctrlGruppi.getGruppi();

            for (Calendgrp grp : eleGrp) {
                Gruppo gruppo = new Gruppo();
                gruppo.setCodice(grp.getCalendgrpPK().getIdgruppo());
                gruppo.setDescrizione(grp.getDescr());
                gruppo.setElencoUtenti(new ArrayList<User>());
                eleGruppi.add(gruppo);
            }

            CalendrowJpaController ctrlUtenti = new CalendrowJpaController();
            List<Calendrow> eleRighe = ctrlUtenti.getRighePlanningAttive("");
            int idU = 1;

            for (Calendrow riga : eleRighe) {
                User us = new User();
                us.setId(idU);
                us.setMatricola(riga.getMatric());
                us.setName(riga.getRisorsa());

                us.setColor(coloreCasuale());
                eleUtenti.add(us);

                idU++;
            }

            idU = 1;
            for (Calendrow riga : eleRighe) {
                User us = new User();
                us.setId(idU);
                us.setMatricola(riga.getMatric());
                us.setName(riga.getRisorsa());

                us.setColor(coloreCasuale());

                for (Gruppo grp : eleGruppi) {
                    if (ut.getValore(grp.getCodice(), true).equals(ut.getValore(riga.getIdgruppo(), true))) {
                        grp.getElencoUtenti().add(us);
                    }
                }

                idU++;
            }

        } catch (Exception e) {
            e.printStackTrace();
        }

        ArrayList events = new ArrayList<Event>();
        int id = 1;

        DHXEventsManager.date_format = "dd/MM/yyyy HH:mm";
        for (Calendg ev : eleEventi) {

            Event ev1 = new Event();
            ev1.setId(id);

            if (id == 106) {
                id = 106;
            }
            id++;
            String dataInizio = ut.FromDateToString(ev.getOrainiz(), "dd/MM/yyyy HH:mm");
            String dataFine = ut.FromDateToString(ev.getOrafine(), "dd/MM/yyyy  HH:mm");
            if (dataInizio == null || dataFine == null) {
                continue;
            }
            String idUser = "";
            String color = "blue";


            for (User us : eleUtenti) {
                if (ut.getValore(ev.getCalendgPK().getMatric(), true).equals(ut.getValore(us.getMatricola(), true))) {
                    idUser = us.getId() + "";
                    color = us.getColor();
                    break;
                }
            }

            ev1.setUser(idUser);
            ev1.setStart_date(dataInizio);
            ev1.setEnd_date(dataFine);
            ev1.setColor(color);

            ev1.setText(ev.getNomea());
            events.add(ev1);

        }

        DHXEventsManager.date_format = "MM/dd/yyyy HH:mm";

        return events;
    }

    @Override
    public DHXStatus saveEvent(DHXEv event, DHXStatus status) {
        
        try {
           Event evf = (Event)event;
           
            if (status == DHXStatus.UPDATE) {
                
            } else if (status == DHXStatus.INSERT) {

            } else if (status == DHXStatus.DELETE) {

            }

        } catch (Exception e) {
            e.printStackTrace();
        } finally {

        }

        return status;
    }

    @Override
    public DHXEv createEvent(String id, DHXStatus status) {
        return new DHXEvent();
    }

    @Override
    public HashMap<String, Iterable<DHXCollection>> getCollections() {

        ArrayList<DHXCollection> users_list = new ArrayList<DHXCollection>();

        for (int i = 0; i < eleUtenti.size(); i++) {
            users_list.add(new DHXCollection(eleUtenti.get(i).getId().toString(), eleUtenti.get(i).getName()));
        }

        HashMap<String, Iterable<DHXCollection>> c = new HashMap<String, Iterable<DHXCollection>>();
        c.put("users", users_list);

        ArrayList<DHXCollection> status = new ArrayList<DHXCollection>();
        status.add(new DHXCollection("pending", "Pending"));
        status.add(new DHXCollection("started", "Started"));
        status.add(new DHXCollection("completed", "Completed"));
        c.put("status", status);

        ArrayList<DHXCollection> urgency = new ArrayList<DHXCollection>();
        urgency.add(new DHXCollection("low", "Low"));
        urgency.add(new DHXCollection("medium", "Medium"));
        urgency.add(new DHXCollection("high", "High"));
        c.put("urgency", urgency);

        return c;
    }

    private String coloreCasuale() {
        String[] letters = new String[15];
        letters = "0123456789ABCDEF".split("");
        String code = "#";
        for (int i = 0; i < 6; i++) {
            double ind = Math.random() * 15;
            int index = (int) Math.round(ind);
            code += letters[index];
        }
        return code;
    }
}

The problem is that when i Update an event, the saveEvent method is called but when I try to cast the DHXEv variable to my customized Event class I get :

com.dhtmlx.planner.DHXEvent cannot be cast to managedBean.Event

Where is the problem??
Thanks You!

Ok I solved!!

I’ve changed

@Override
    public DHXEv createEvent(String id, DHXStatus status) {
        return new DHXEv();
    }

to

@Override
    public DHXEv createEvent(String id, DHXStatus status) {
        return new Evento();
    }

Now the class is cast correctly!