Example usage for org.apache.wicket.model StringResourceModel getString

List of usage examples for org.apache.wicket.model StringResourceModel getString

Introduction

In this page you can find the example usage for org.apache.wicket.model StringResourceModel getString.

Prototype

public final String getString() 

Source Link

Document

Gets the string currently represented by this model.

Usage

From source file:au.org.theark.core.web.component.navigator.ArkAjaxPagingNavigator.java

License:Open Source License

/**
 * Wraps the default onclick event call for a pageable link with a confirmation if the current form is "dirty"
 * @param onClickEvent the default Wicket AJAX onclick event
 * @return//from w w  w .java2 s  .  c  o  m
 */
private String dirtyFormJavaScript(String onClickEvent) {
    StringBuffer sb = new StringBuffer();
    sb.append("if(jQuery.DirtyForms.isDirty()) { if(!confirm('");
    StringResourceModel confirmation = new StringResourceModel("confirmation", this, null);
    sb.append(confirmation.getString());
    sb.append("')) { return false } else { ");
    sb.append(onClickEvent);
    sb.append("}}");
    return sb.toString();
}

From source file:com.asptt.plongee.resa.ui.web.wicket.page.AccueilPage.java

public AccueilPage() {

    //        // add the clock component
    //        Clock clock = new Clock("clock", TimeZone.getTimeZone("Europe/Paris"));
    //        add(clock);
    ////from   ww w . jav  a  2 s  .c  om
    //        // add the ajax behavior which will keep updating the component every 5
    //        // seconds
    //        clock.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(20)));

    setPageTitle("Accueil");
    Adherent adh = getResaSession().getAdherent();

    // Si l'adhrent est identifi mais qu'il n'a pas chang son password (password = licence)
    if (getResaSession().getAdherent().getNumeroLicense()
            .equalsIgnoreCase(getResaSession().getAdherent().getPassword())) {
        setResponsePage(ModifPasswordPage.class);
    }

    IModel<Adherent> model = new Model<Adherent>(adh);
    add(new Label("hello", new StringResourceModel(CatalogueMessages.ACCUEIL_BIENVENUE, this, model,
            new Object[] { new PropertyModel<Adherent>(model, "prenom"), calculerDateCourante() })));

    try {
        List<Message> messages = getResaSession().getAdherentService().rechercherMessage();
        List<Message> msgSepares = new ArrayList();
        Message ligne = new Message();
        ligne.setLibelle(" ");

        if (!messages.isEmpty()) {
            for (Message msg : messages) {
                msgSepares.add(msg);
                msgSepares.add(ligne);
            }
            int ledernier = msgSepares.size();
            msgSepares.remove(ledernier - 1);
        }

        MessageDataProvider pDataProvider = new MessageDataProvider(msgSepares);

        add(new DataView<Message>("listmessages", pDataProvider) {
            @Override
            protected void populateItem(final Item<Message> item) {
                final Message message = item.getModelObject();
                item.add(new Label("libelle", message.getLibelle()));

                item.add(new AttributeModifier("class", true, new AbstractReadOnlyModel<String>() {
                    @Override
                    public String getObject() {
                        String cssClass;
                        if (item.getIndex() % 2 == 1) {
                            cssClass = "even";
                        } else {
                            cssClass = "odd";
                        }
                        return cssClass;
                    }
                }));
            }
        });
        //gestion du message pour le certificat medical perim
        String msgCertificat = "";
        try {
            getResaSession().getPlongeeService().checkCertificatMedical(getResaSession().getAdherent(), null);
        } catch (ResaException e) {
            if (e.getKey().equalsIgnoreCase(CatalogueMessages.CM_PERIME)) {
                StringResourceModel srm = new StringResourceModel(CatalogueMessages.CM_PERIME, this, null);
                msgCertificat = srm.getString();
            } else {
                String nbJour = e.getKey().substring(14);
                StringResourceModel srm = new StringResourceModel(CatalogueMessages.CM_A_RENOUVELER, this,
                        model, new Object[] { new PropertyModel<Adherent>(model, "prenom"), nbJour });
                msgCertificat = srm.getString();
            }
        }
        add(new Label("certificat", msgCertificat));

        //gestion du message pour le cotisation non renouvelle
        try {
            getResaSession().getAdherentService().checkAnneeCotisation(getResaSession().getAdherent());
        } catch (ResaException e) {
            PageParameters pp = new PageParameters();
            StringResourceModel msgCotisation = new StringResourceModel(
                    CatalogueMessages.ACCUEIL_COTISATION_PERIME, this, new Model<Adherent>(adh));
            pp.add("cotisation", msgCotisation.getString());
            setResponsePage(new LoginPage(pp));
        }

    } catch (TechnicalException e) {
        e.printStackTrace();
        ErreurTechniquePage etp = new ErreurTechniquePage(e);
        setResponsePage(etp);
    }

}

From source file:com.asptt.plongee.resa.ui.web.wicket.page.inscription.DeInscriptionPlongeePage.java

private void init() {
    try {//from   www. jav  a  2  s .  c o  m
        plongees = getResaSession().getPlongeeService().rechercherPlongeesAdherentInscrit(
                getResaSession().getAdherent(), Parameters.getInt("desincription.nb.heure"));
    } catch (TechnicalException e) {
        e.printStackTrace();
        ErreurTechniquePage etp = new ErreurTechniquePage(e);
        setResponsePage(etp);
    }

    PlongeeDataProvider pDataProvider = new PlongeeDataProvider(plongees);

    add(new DataView<Plongee>("simple", pDataProvider) {

        private static final long serialVersionUID = 2877768852318892774L;

        protected void populateItem(final Item<Plongee> item) {
            final Plongee plongee = item.getModelObject();
            String nomDP = "Aucun";
            if (null != plongee.getDp()) {
                nomDP = plongee.getDp().getNom();
            }
            //preparation du message de confirmation
            IModel<Plongee> model = new Model<Plongee>(plongee);
            StringResourceModel srm = new StringResourceModel(CatalogueMessages.DESINSCRIPTION_CONFIRMATION,
                    this, model, new Object[] { new PropertyModel<Plongee>(model, "getType"),
                            ResaUtil.getDateString(plongee.getDate()) });

            item.add(new ConfirmAjaxLink("select", srm.getString()) {
                private static final long serialVersionUID = 1771547719792642196L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    deInscrire(target, item.getModel());
                }
            });

            // Mise en forme de la date
            Calendar cal = Calendar.getInstance();
            cal.setTime(plongee.getDate());
            String dateAffichee = cal.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, Locale.FRANCE) + " ";
            dateAffichee = dateAffichee + cal.get(Calendar.DAY_OF_MONTH) + " ";
            dateAffichee = dateAffichee + cal.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.FRANCE)
                    + " ";
            dateAffichee = dateAffichee + cal.get(Calendar.YEAR);

            item.add(new Label("date", dateAffichee));
            item.add(new Label("dp", nomDP));
            item.add(new Label("type", plongee.getType()));
            item.add(new Label("niveauMini", plongee.getNiveauMinimum().toString()));

            // Places restantes
            item.add(new Label("placesRestantes",
                    getResaSession().getPlongeeService().getNbPlaceRestante(plongee).toString()));

            item.add(new AttributeModifier("class", true, new AbstractReadOnlyModel<String>() {
                @Override
                public String getObject() {
                    String cssClass;
                    if (item.getIndex() % 2 == 1) {
                        cssClass = "even";
                    } else {
                        cssClass = "odd";
                    }
                    boolean isInscrit = false;
                    for (Adherent adherent : plongee.getParticipants()) {
                        if (adherent.getNumeroLicense().equals(adh.getNumeroLicense())) {
                            cssClass = cssClass + " inscrit";
                            isInscrit = true;
                        }
                    }
                    if (!plongee.isNbMiniAtteint(Parameters.getInt("nb.plongeur.mini"))) {
                        if (isInscrit) {
                            cssClass = cssClass + "MinimumPlongeur";
                        } else {
                            cssClass = cssClass + " minimumPlongeur";
                        }
                    }
                    return cssClass;
                }
            }));
        }
    });

}

From source file:com.asptt.plongee.resa.ui.web.wicket.page.inscription.DeInscriptionPlongeePage.java

public void deInscrire(AjaxRequestTarget target, IModel<Plongee> iModel) {

    final Plongee plongee = iModel.getObject();
    try {/*from   www.  j  a va  2 s  .c  om*/
        Adherent adherent = getResaSession().getAdherent();

        //SI c'est un encadrant il faut verifier s'il en reste assez
        //et sinon envoyer un mail 
        if (!adherent.isEncadrent()) {
            //Ce n'est pas un encadrant : on desinscrit

            //S'il y a des personnes en liste d'attente => mail aux ADMIN
            if (getResaSession().getPlongeeService().rechercherListeAttente(plongee).size() > 0) {
                getResaSession().getPlongeeService().deInscrireAdherent(plongee, getResaSession().getAdherent(),
                        PlongeeMail.MAIL_PLACES_LIBRES);

            } else {
                getResaSession().getPlongeeService().deInscrireAdherent(plongee, getResaSession().getAdherent(),
                        PlongeeMail.PAS_DE_MAIL);
            }
            setResponsePage(new InscriptionConfirmationPlongeePage(plongee));
        } else {
            //C'est un encadrant : on regarde s'il en reste assez
            if (getResaSession().getPlongeeService().isEnoughEncadrant(plongee)) {
                //S'il y a des personnes en liste d'attente => mail
                if (getResaSession().getPlongeeService().rechercherListeAttente(plongee).size() > 0) {
                    getResaSession().getPlongeeService().deInscrireAdherent(plongee,
                            getResaSession().getAdherent(), PlongeeMail.MAIL_PLACES_LIBRES);

                } else {
                    getResaSession().getPlongeeService().deInscrireAdherent(plongee,
                            getResaSession().getAdherent(), PlongeeMail.PAS_DE_MAIL);
                }
                setResponsePage(new InscriptionConfirmationPlongeePage(plongee));
            } else {
                // Il en reste pas assez
                // Fentre de confirmation
                replaceModalWindow(target, plongee);
                modalConfirm.show(target);
            }
        }
    } catch (TechnicalException e) {
        e.printStackTrace();
        error(e.getKey());
    } catch (ResaException e) {
        String libRetour = "";
        if (e.getKey().startsWith(CatalogueMessages.DESINSCRIPTION_IMPOSSIBLE)) {
            String nbHeure = e.getKey().substring(23);
            IModel<Adherent> model = new Model<Adherent>(adh);
            StringResourceModel srm = new StringResourceModel(CatalogueMessages.DESINSCRIPTION_IMPOSSIBLE, this,
                    model, new Object[] { new PropertyModel<Adherent>(model, "prenom"), nbHeure });
            libRetour = srm.getString();
        }
        error(libRetour);
    } finally {
        target.addComponent(feedback);
    }
}

From source file:com.asptt.plongee.resa.ui.web.wicket.page.inscription.DesinscriptionFilleulPage.java

private void init() {
    try {/*ww w.  j av a 2  s  .c o m*/
        plongeesDesFilleuls = getResaSession().getPlongeeService().rechercherPlongeesFilleulInscrit(parrain,
                Parameters.getInt("desincription.nb.heure"));
    } catch (TechnicalException e) {
        e.printStackTrace();
        ErreurTechniquePage etp = new ErreurTechniquePage(e);
        setResponsePage(etp);
    }

    PlongeeFilleulDataProvider pDataProvider = new PlongeeFilleulDataProvider(plongeesDesFilleuls);

    add(new DataView<InscriptionFilleul>("simple", pDataProvider) {

        private static final long serialVersionUID = 2877768852318892774L;

        protected void populateItem(final Item<InscriptionFilleul> item) {
            final InscriptionFilleul inscription = item.getModelObject();
            final Plongee plongee = inscription.getPlongeeInscrit();
            final Adherent filleul = inscription.getFilleul();
            String nomDP = "Aucun";
            if (null != plongee.getDp()) {
                nomDP = plongee.getDp().getNom();
            }
            //preparation du message de confirmation
            IModel<Plongee> model = new Model<Plongee>(plongee);
            StringResourceModel srm = new StringResourceModel(
                    CatalogueMessages.DESINSCRIPTION_FILLEUL_CONFIRMATION, this, model,
                    new Object[] { new PropertyModel<Plongee>(model, "getType"),
                            ResaUtil.getDateString(plongee.getDate()), filleul.getNom(), filleul.getPrenom() });

            item.add(new ConfirmAjaxLink("select", srm.getString()) {
                private static final long serialVersionUID = 1771547719792642196L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    desinscrire(target, plongee, filleul);
                }
            });

            String nomFilleul = filleul.getNom();
            String prenomFilleul = filleul.getPrenom();

            // Mise en forme de la date
            Calendar cal = Calendar.getInstance();
            cal.setTime(plongee.getDate());
            String dateAffichee = cal.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, Locale.FRANCE) + " ";
            dateAffichee = dateAffichee + cal.get(Calendar.DAY_OF_MONTH) + " ";
            dateAffichee = dateAffichee + cal.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.FRANCE)
                    + " ";
            dateAffichee = dateAffichee + cal.get(Calendar.YEAR);

            item.add(new Label("nom", nomFilleul));
            item.add(new Label("prenom", prenomFilleul));
            item.add(new Label("date", dateAffichee));
            item.add(new Label("type", plongee.getType()));

            item.add(new AttributeModifier("class", true, new AbstractReadOnlyModel<String>() {
                @Override
                public String getObject() {
                    String cssClass;
                    if (item.getIndex() % 2 == 1) {
                        cssClass = "even";
                    } else {
                        cssClass = "odd";
                    }
                    boolean isInscrit = false;
                    for (Adherent adherent : plongee.getParticipants()) {
                        if (adherent.getNumeroLicense().equals(parrain.getNumeroLicense())) {
                            cssClass = cssClass + " inscrit";
                            isInscrit = true;
                        }
                    }
                    if (!plongee.isNbMiniAtteint(Parameters.getInt("nb.plongeur.mini"))) {
                        if (isInscrit) {
                            cssClass = cssClass + "MinimumPlongeur";
                        } else {
                            cssClass = cssClass + " minimumPlongeur";
                        }
                    }
                    return cssClass;
                }
            }));
        }
    });

}

From source file:com.asptt.plongee.resa.ui.web.wicket.page.inscription.DesinscriptionFilleulPage.java

public void desinscrire(AjaxRequestTarget target, Plongee plongee, Adherent filleul) {

    //final Plongee plongee = iModel.getObject();
    try {/*from   ww  w .j  av  a  2 s.c o  m*/
        //On considere que les Filleuls etants des externes
        //ne sont donc pas des encadrants
        // Dons pas de test sur l'apppartenance  l'encadrement
        //S'il y a des personnes en liste d'attente => mail aux ADMIN
        if (getResaSession().getPlongeeService().rechercherListeAttente(plongee).size() > 0) {
            getResaSession().getPlongeeService().deInscrireAdherent(plongee, filleul,
                    PlongeeMail.MAIL_PLACES_LIBRES);

        } else {
            getResaSession().getPlongeeService().deInscrireAdherent(plongee, filleul, PlongeeMail.PAS_DE_MAIL);
        }
        setResponsePage(new InscriptionConfirmationPlongeePage(plongee));
    } catch (TechnicalException e) {
        e.printStackTrace();
        error(e.getKey());
    } catch (ResaException e) {
        String libRetour = "";
        if (e.getKey().startsWith(CatalogueMessages.DESINSCRIPTION_IMPOSSIBLE)) {
            String nbHeure = e.getKey().substring(23);
            IModel<Adherent> model = new Model<Adherent>(parrain);
            StringResourceModel srm = new StringResourceModel(CatalogueMessages.DESINSCRIPTION_IMPOSSIBLE, this,
                    model, new Object[] { new PropertyModel<Adherent>(model, "prenom"), nbHeure });
            libRetour = srm.getString();
        }
        error(libRetour);
    } finally {
        target.addComponent(feedback);
    }
}

From source file:com.asptt.plongee.resa.ui.web.wicket.page.secretariat.DesInscriptionPlongeePage.java

public void deInscrire(AjaxRequestTarget target, Plongee plongee, Adherent plongeur) {

    try {/*  ww w  . j av a2s .co m*/

        //SI c'est un encadrant il faut verifier s'il en reste assez
        //et sinon envoyer un mail 
        if (!plongeur.isEncadrent()) {
            //Ce n'est pas un encadrant : on desinscrit

            //S'il y a des personnes en liste d'attente => mail aux ADMIN
            if (getResaSession().getPlongeeService().rechercherListeAttente(plongee).size() > 0) {
                getResaSession().getPlongeeService().deInscrireAdherent(plongee, plongeur,
                        PlongeeMail.MAIL_PLACES_LIBRES);

            } else {
                getResaSession().getPlongeeService().deInscrireAdherent(plongee, plongeur,
                        PlongeeMail.PAS_DE_MAIL);
            }
        } else {
            //C'est un encadrant et qu'il en reste assez
            if (getResaSession().getPlongeeService().isEnoughEncadrant(plongee)) {

                //S'il y a des personnes en liste d'attente => mail
                if (getResaSession().getPlongeeService().rechercherListeAttente(plongee).size() > 0) {
                    getResaSession().getPlongeeService().deInscrireAdherent(plongee, plongeur,
                            PlongeeMail.MAIL_PLACES_LIBRES);

                } else {
                    getResaSession().getPlongeeService().deInscrireAdherent(plongee, plongeur,
                            PlongeeMail.PAS_DE_MAIL);
                }
            } else {
                // Plus assez d'encadrants
                getResaSession().getPlongeeService().deInscrireAdherent(plongee, plongeur,
                        PlongeeMail.MAIL_PLUS_ASSEZ_ENCADRANT);
            }
        }
        modalPlongees.close(target);
        //setResponsePage(new InscriptionConfirmationPlongeePage(plongee));
    } catch (TechnicalException e) {
        e.printStackTrace();
        error(e.getKey());
    } catch (ResaException e) {
        String libRetour = "";
        if (e.getKey().startsWith(CatalogueMessages.DESINSCRIPTION_IMPOSSIBLE)) {
            String nbHeure = e.getKey().substring(23);
            IModel<Adherent> model = new Model<Adherent>(plongeur);
            StringResourceModel srm = new StringResourceModel(CatalogueMessages.DESINSCRIPTION_IMPOSSIBLE, this,
                    model, new Object[] { new PropertyModel<Adherent>(model, "prenom"), nbHeure });
            libRetour = srm.getString();
        }
        error(libRetour);
    } finally {
        target.addComponent(feedback);
    }
}

From source file:com.asptt.plongee.resa.wicket.page.AccueilPage.java

public AccueilPage() {

    //        // add the clock component
    //        Clock clock = new Clock("clock", TimeZone.getTimeZone("Europe/Paris"));
    //        add(clock);
    ///*from w  ww.j  a  va2 s . c  o m*/
    //        // add the ajax behavior which will keep updating the component every 5
    //        // seconds
    //        clock.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(20)));

    setPageTitle("Accueil");
    Adherent adh = ResaSession.get().getAdherent();

    // Si l'adhrent est identifi mais qu'il n'a pas chang son password (password = licence)
    if (ResaSession.get().getAdherent().getNumeroLicense()
            .equalsIgnoreCase(ResaSession.get().getAdherent().getPassword())) {
        setResponsePage(ModifPasswordPage.class);
    }

    IModel<Adherent> model = new Model<Adherent>(adh);
    add(new Label("hello", new StringResourceModel(CatalogueMessages.ACCUEIL_BIENVENUE, this, model,
            new Object[] { new PropertyModel<Adherent>(model, "prenom"), calculerDateCourante() })));

    try {
        List<Message> messages = ResaSession.get().getAdherentService().rechercherMessage();
        List<Message> msgSepares = new ArrayList();
        Message ligne = new Message();
        ligne.setLibelle(" ");

        if (!messages.isEmpty()) {
            for (Message msg : messages) {
                msgSepares.add(msg);
                msgSepares.add(ligne);
            }
            int ledernier = msgSepares.size();
            msgSepares.remove(ledernier - 1);
        }

        MessageDataProvider pDataProvider = new MessageDataProvider(msgSepares);

        add(new DataView<Message>("listmessages", pDataProvider) {
            @Override
            protected void populateItem(final Item<Message> item) {
                final Message message = item.getModelObject();
                item.add(new Label("libelle", message.getLibelle()));

                item.add(new AttributeModifier("class", true, new AbstractReadOnlyModel<String>() {
                    @Override
                    public String getObject() {
                        String cssClass;
                        if (item.getIndex() % 2 == 1) {
                            cssClass = "even";
                        } else {
                            cssClass = "odd";
                        }
                        return cssClass;
                    }
                }));
            }
        });
        //gestion du message pour le certificat medical perim
        String msgCertificat = "";
        try {
            ResaSession.get().getCheckCM(null);
        } catch (ResaException e) {
            boolean continuer = true;
            if (continuer && e.getKey().equalsIgnoreCase(CatalogueMessages.CM_PERIME)) {
                StringResourceModel srm = new StringResourceModel(CatalogueMessages.CM_PERIME, this, null);
                msgCertificat = srm.getString();
                continuer = false;
            }
            if (continuer && e.getKey().substring(0, 13).equalsIgnoreCase(CatalogueMessages.CM_A_RENOUVELER)) {
                String nbJour = e.getKey().substring(14);
                StringResourceModel srm = new StringResourceModel(CatalogueMessages.CM_A_RENOUVELER, this,
                        model, new Object[] { new PropertyModel<Adherent>(model, "prenom"), nbJour });
                msgCertificat = srm.getString();
                continuer = false;
            }
            if (continuer && e.getKey().equalsIgnoreCase(CatalogueMessages.ADHERENT_NULL)) {
                StringResourceModel srm = new StringResourceModel(CatalogueMessages.ADHERENT_NULL, this, null);
                msgCertificat = srm.getString();
            }
        }
        add(new Label("certificat", msgCertificat));

        //gestion du message pour le cotisation non renouvelle
        try {
            ResaSession.get().getAdherentService().checkAnneeCotisation(ResaSession.get().getAdherent());
        } catch (ResaException e) {
            PageParameters pp = new PageParameters();
            StringResourceModel msgCotisation = new StringResourceModel(
                    CatalogueMessages.ACCUEIL_COTISATION_PERIME, this, new Model<Adherent>(adh));
            pp.add("cotisation", msgCotisation.getString());
            setResponsePage(new LoginPage(pp));
        }

    } catch (TechnicalException e) {
        e.printStackTrace();
        ErreurTechniquePage etp = new ErreurTechniquePage(e);
        setResponsePage(etp);
    }

}

From source file:com.asptt.plongee.resa.wicket.page.inscription.DesinscriptionFilleulPage.java

private void init() {
    try {/*from w  w w  . j  a v a  2 s . co m*/
        plongeesDesFilleuls = ResaSession.get().getPlongeeService().rechercherPlongeesFilleulInscrit(parrain,
                Parameters.getInt("desincription.nb.heure"));
    } catch (TechnicalException e) {
        e.printStackTrace();
        ErreurTechniquePage etp = new ErreurTechniquePage(e);
        setResponsePage(etp);
    }

    PlongeeFilleulDataProvider pDataProvider = new PlongeeFilleulDataProvider(plongeesDesFilleuls);

    add(new DataView<InscriptionFilleul>("simple", pDataProvider) {

        private static final long serialVersionUID = 2877768852318892774L;

        @Override
        protected void populateItem(final Item<InscriptionFilleul> item) {
            final InscriptionFilleul inscription = item.getModelObject();
            final Plongee plongee = inscription.getPlongeeInscrit();
            final Adherent filleul = inscription.getFilleul();
            String nomDP = "Aucun";
            if (null != plongee.getDp()) {
                nomDP = plongee.getDp().getNom();
            }
            //preparation du message de confirmation
            IModel<Plongee> model = new Model<Plongee>(plongee);
            StringResourceModel srm = new StringResourceModel(
                    CatalogueMessages.DESINSCRIPTION_FILLEUL_CONFIRMATION, this, model,
                    new Object[] { ResaUtil.getHeurePlongee(plongee.getDatePlongee()),
                            ResaUtil.getDateString(plongee.getDatePlongee()), filleul.getNom(),
                            filleul.getPrenom() });

            item.add(new ConfirmAjaxLink("select", srm.getString()) {
                private static final long serialVersionUID = 1771547719792642196L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    desinscrire(target, plongee, filleul);
                }
            });

            String nomFilleul = filleul.getNom();
            String prenomFilleul = filleul.getPrenom();

            item.add(new Label("nom", nomFilleul));
            item.add(new Label("prenom", prenomFilleul));
            item.add(new Label("date", ResaUtil.getJourDatePlongee(plongee.getDatePlongee())));
            item.add(new Label("heure", ResaUtil.getHeurePlongee(plongee.getDatePlongee())));
            item.add(new Label("typePlongee", plongee.getTypePlongee().getText()));

            item.add(new AttributeModifier("class", true, new AbstractReadOnlyModel<String>() {
                @Override
                public String getObject() {
                    String cssClass;
                    if (item.getIndex() % 2 == 1) {
                        cssClass = "even";
                    } else {
                        cssClass = "odd";
                    }
                    boolean isInscrit = false;
                    for (Adherent adherent : plongee.getParticipants()) {
                        if (adherent.getNumeroLicense().equals(parrain.getNumeroLicense())) {
                            cssClass = cssClass + " inscrit";
                            isInscrit = true;
                        }
                    }
                    if (!plongee.isNbMiniAtteint(Parameters.getInt("nb.plongeur.mini"))) {
                        if (isInscrit) {
                            cssClass = cssClass + "MinimumPlongeur";
                        } else {
                            cssClass = cssClass + " minimumPlongeur";
                        }
                    }
                    return cssClass;
                }
            }));
        }
    });

}

From source file:com.asptt.plongee.resa.wicket.page.inscription.DesinscriptionFilleulPage.java

public void desinscrire(AjaxRequestTarget target, Plongee plongee, Adherent filleul) {
    //final Plongee plongee = iModel.getObject();
    try {//from w  w  w  . j a  va 2  s .  c o m
        //On considere que les Filleuls etants des externes
        //ne sont donc pas des encadrants
        //Donc pas de test sur l'apppartenance  l'encadrement
        //S'il y a des personnes en liste d'attente => mail aux ADMIN
        if (ResaSession.get().getPlongeeService().rechercherListeAttente(plongee).size() > 0) {
            ResaSession.get().getPlongeeService().deInscrireAdherent(plongee, filleul,
                    PlongeeMail.MAIL_PLACES_LIBRES);
        } else {
            ResaSession.get().getPlongeeService().deInscrireAdherent(plongee, filleul, PlongeeMail.PAS_DE_MAIL);
        }
        setResponsePage(new ListeInscritsPlongeePage(plongee));
    } catch (TechnicalException e) {
        e.printStackTrace();
        error(e.getKey());
    } catch (ResaException e) {
        String libRetour = "";
        if (e.getKey().startsWith(CatalogueMessages.DESINSCRIPTION_IMPOSSIBLE)) {
            String nbHeure = e.getKey().substring(23);
            IModel<Adherent> model = new Model<Adherent>(parrain);
            StringResourceModel srm = new StringResourceModel(CatalogueMessages.DESINSCRIPTION_IMPOSSIBLE, this,
                    model, new Object[] { new PropertyModel<Adherent>(model, "prenom"), nbHeure });
            libRetour = srm.getString();
        }
        error(libRetour);
    } finally {
        target.addComponent(feedback);
    }
}