Example usage for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow ModalWindow

List of usage examples for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow ModalWindow

Introduction

In this page you can find the example usage for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow ModalWindow.

Prototype

public ModalWindow(final String id) 

Source Link

Document

Creates a new modal window component.

Usage

From source file:au.org.theark.lims.web.component.subjectlims.lims.biospecimen.form.BiospecimenModalDetailForm.java

License:Open Source License

private void initDeleteModelWindow() {
    answer = new ConfirmationAnswer(false);
    confirmModal = new ModalWindow("modal");
    confirmModal.setCookieName("yesNoPanel");
    if (!isNew()) {
        List<BioTransaction> bioTransactions = iLimsService
                .getAllBiotransactionForBiospecimen(cpModel.getObject().getBiospecimen());
        StringBuffer bioTxID = new StringBuffer();
        for (BioTransaction bioTransaction : bioTransactions) {
            bioTxID.append(bioTransaction.getId()).append(",");
        }//from  w  w  w.  ja  v a 2s  . co m
        bioTxID.deleteCharAt(bioTxID.length() - 1);
        String modelTextReplce1 = modalText.replaceAll("number", Integer.toString(bioTransactions.size()));
        String modeltextReplace2 = modelTextReplce1.replaceAll("txs", bioTxID.toString());
        confirmModal.setContent(
                new YesNoPanel(confirmModal.getContentId(), modeltextReplace2, confirmModal, answer));
        confirmModal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
            private static final long serialVersionUID = 1L;

            public void onClose(AjaxRequestTarget target) {
                if (answer.isAnswer()) {
                    iLimsService.deleteBiospecimen(cpModel.getObject());
                    getSession().getFeedbackMessages().info(me,
                            "Biospecimen " + cpModel.getObject().getBiospecimen().getBiospecimenUid()
                                    + " was deleted successfully");
                } else {
                    EditModeButtonsPanel editModeButtonsPanel = ((EditModeButtonsPanel) buttonsPanelWMC
                            .get("buttonsPanel"));
                    editModeButtonsPanel.setDeleteButtonEnabled(true);
                    target.add(editModeButtonsPanel);
                }
                target.add(feedbackPanel);
            }
        });
    }
}

From source file:au.org.theark.study.web.component.manageuser.form.DetailForm.java

License:Open Source License

@SuppressWarnings("unchecked")
public void initialiseDetailForm() {
    userNameTxtField = new TextField<String>(Constants.USER_NAME);
    userNameTxtField.setOutputMarkupId(true);
    firstNameTxtField = new TextField<String>(Constants.FIRST_NAME);
    lastNameTxtField = new TextField<String>(Constants.LAST_NAME);
    emailTxtField = new TextField<String>(Constants.EMAIL);
    userPasswordField = new PasswordTextField(Constants.PASSWORD);
    confirmPasswordField = new PasswordTextField(Constants.CONFIRM_PASSWORD);
    oldPasswordField = new PasswordTextField(Constants.OLD_PASSWORD);
    groupPasswordContainer = new WebMarkupContainer("groupPasswordContainer");

    IModel<List<ArkUserRole>> iModel = new LoadableDetachableModel() {
        private static final long serialVersionUID = 1L;

        @Override//from w  w  w .j  a  va 2s. c  o m
        protected Object load() {
            return containerForm.getModelObject().getArkUserRoleList();
        }
    };

    ListView listView = new ListView("arkUserRoleList", iModel) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem item) {
            // Each item will be ArkModuleVO use that to build the Module name and the drop down
            ArkUserRole arkUserRole = (ArkUserRole) item.getModelObject();
            ArkModule arkModule = arkUserRole.getArkModule();
            // Acts as the data source for ArkRoles
            ArrayList<ArkRole> arkRoleSourceList = iArkCommonService.getArkRoleLinkedToModule(arkModule);
            if (arkUserRole.getArkUser() == null
                    && arkModule.getName().equalsIgnoreCase(au.org.theark.core.Constants.ARK_MODULE_STUDY)) {
                // If the ArkUserRole is not assigned and the module is Study then set the default Role
                ArkRole arkRole = iArkCommonService
                        .getArkRoleByName(au.org.theark.core.Constants.ARK_STUDY_DEFAULT_ROLE);
                arkUserRole.setArkRole(arkRole);
            }

            PropertyModel arkUserRolePm = new PropertyModel(arkUserRole, "arkRole");
            ChoiceRenderer<ArkRole> defaultChoiceRenderer = new ChoiceRenderer<ArkRole>(Constants.NAME, "id");

            DropDownChoice<ArkRole> ddc = new DropDownChoice<ArkRole>("arkRole", arkUserRolePm,
                    arkRoleSourceList, defaultChoiceRenderer);

            item.add(new Label("moduleName", arkModule.getName()));// arkModule within ArkUserRole
            item.add(ddc);

        }
    };

    listView.setReuseItems(true);
    arkCrudContainerVO.getWmcForarkUserAccountPanel().add(listView);
    confirmationAnswer = new ConfirmationAnswer(false);
    confirmModal = new ModalWindow("modalWindow");
    confirmModal.setCookieName("yesNoPanel");
    confirmModal.setContent(
            new YesNoPanel(confirmModal.getContentId(), modalText, confirmModal, confirmationAnswer));
    confirmModal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
        private static final long serialVersionUID = 1L;

        public void onClose(AjaxRequestTarget target) {
            if (confirmationAnswer.isAnswer()) {
                //Add new roles for module wise to study
                iUserService.updateArkUserRoleListForExsistingUser(containerForm.getModelObject());
                //Up date for all the child studies.
                reNewArkUserRoleForChildStudies(containerForm);
                containerForm.getModelObject().setMode(Constants.MODE_EDIT);
                //onSavePostProcess(target);
                successModal.show(target);
            } else {//if no nothing be done.Just close I guess
            }
        }
    });
    successModal = new ModalWindow("successModalWindow");
    successModal.setCookieName("okPanel");
    successModal.setContent(new SuccessFullySaved(confirmModal.getContentId(),
            "The exsisting user added sucessfully to the Study", successModal));
    initChildStudyPalette();
    attachValidators();
    addDetailFormComponents();

}

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

@SuppressWarnings("serial")
public GererAdherents() {

    setPageTitle("Gerer les adherents");
    setOutputMarkupId(true);//from  w w  w . ja v  a 2  s.c o  m
    modal2 = new ModalWindow("modal2");
    modal2.setTitle("This is modal window with panel content.");
    modal2.setCookieName("modal-adherent");
    add(modal2);

    modalSupp = new ModalWindow("modalSupp");
    modalSupp.setTitle("Confirmation");
    modalSupp.setResizable(false);
    modalSupp.setInitialWidth(30);
    modalSupp.setInitialHeight(15);
    modalSupp.setWidthUnit("em");
    modalSupp.setHeightUnit("em");
    modalSupp.setCssClassName(ModalWindow.CSS_CLASS_BLUE);
    add(modalSupp);

    modalPwd = new ModalWindow("modalPwd");
    modalPwd.setTitle("Confirmation");
    modalPwd.setResizable(false);
    modalPwd.setInitialWidth(30);
    modalPwd.setInitialHeight(15);
    modalPwd.setWidthUnit("em");
    modalPwd.setHeightUnit("em");
    modalPwd.setCssClassName(ModalWindow.CSS_CLASS_BLUE);
    add(modalPwd);

    List<Adherent> adherents = getResaSession().getAdherentService().rechercherAdherentsTous();

    // On construit la liste des adhrents (avec pagination)
    DataView adherentsView = new DataView<Adherent>("simple", new AdherentDataProvider(adherents), 10) {
        protected void populateItem(final Item<Adherent> item) {
            final Adherent adherent = item.getModelObject();

            item.add(new IndicatingAjaxLink("select") {
                @Override
                public void onClick(AjaxRequestTarget target) {
                    replaceModalWindow(target, item.getModel());
                    modal2.show(target);
                }
            });

            item.add(new IndicatingAjaxLink("suppAdh") {
                @Override
                public void onClick(AjaxRequestTarget target) {
                    replaceModalWindowSupp(target, item.getModel());
                    modalSupp.show(target);
                }
            });

            item.add(new IndicatingAjaxLink("pwdAdh") {
                @Override
                public void onClick(AjaxRequestTarget target) {
                    replaceModalWindowPwd(target, item.getModel());
                    modalPwd.show(target);
                }
            });

            item.add(new Label("license", adherent.getNumeroLicense()));
            item.add(new Label("nom", adherent.getNom()));
            item.add(new Label("prenom", adherent.getPrenom()));

            // Ds que le plongeur est encadrant, on affiche son niveau d'encadrement
            String niveauAffiche = adherent.getPrerogative();
            item.add(new Label("niveau", niveauAffiche));
            item.add(new Label("aptitude", adherent.getAptitude()));
            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";
                    }
                    if (!adherent.isActif()) {
                        cssClass = cssClass + " inactif";
                    }
                    return cssClass;
                }
            }));
        }
    };
    adherentsView.setOutputMarkupId(true);
    add(adherentsView);
    add(new PagingNavigator("navigator", adherentsView));

    add(new AdherentForm("form"));

}

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

public GererPlongeeAOuvrirTwo(final Plongee plongee) {
    setPageTitle("Ouvrir plongee");
    modalPlongee = new ModalWindow("modalPlongee");
    modalPlongee.setTitle("This is modal window with panel content.");
    modalPlongee.setCookieName("modal-plongee");
    add(modalPlongee);/*  www  .  j  a va2 s .  c om*/

    CompoundPropertyModel<Plongee> modelPlongee = new CompoundPropertyModel<Plongee>(plongee);

    List<Adherent> dps;
    dps = getResaSession().getAdherentService().rechercherDPsNonInscrits(
            getResaSession().getAdherentService().rechercherAdherentsActifs(), plongee);

    dps.removeAll(plongee.getParticipants());

    IChoiceRenderer<Adherent> rendDp = new ChoiceRenderer<Adherent>("nom", "nom");

    final Palette<Adherent> palDp = new Palette<Adherent>("paletteDps",
            new ListModel<Adherent>(new ArrayList<Adherent>()), new CollectionModel<Adherent>(dps), rendDp, 10,
            false) {
    };

    List<Adherent> pilotes = getResaSession().getAdherentService().rechercherPilotesNonInscrits(
            getResaSession().getAdherentService().rechercherAdherentsActifs(), plongee);

    pilotes.removeAll(plongee.getParticipants());

    IChoiceRenderer<Adherent> rendPilote = new ChoiceRenderer<Adherent>("nom", "nom");

    final Palette<Adherent> palPilote = new Palette<Adherent>("palettePilotes",
            new ListModel<Adherent>(new ArrayList<Adherent>()), new CollectionModel<Adherent>(pilotes),
            rendPilote, 10, false) {
    };

    final Form<Plongee> form = new Form<Plongee>("form") {

        private static final long serialVersionUID = 4611593854191923422L;

        @Override
        protected void onSubmit() {

            IModel<?> modelDps = palDp.getDefaultModel();
            List<Adherent> dps = (List<Adherent>) modelDps.getObject();

            IModel<?> modelPilotes = palPilote.getDefaultModel();
            List<Adherent> pilotes = (List<Adherent>) modelPilotes.getObject();
            /*
             * Impossible de gerer les doublons avec un HashSet Alors on le
             * fait ' la main'
             */
            List<String> idInscrits = new ArrayList<String>();
            for (Adherent adherent : dps) {
                if (!idInscrits.contains(adherent.getNumeroLicense())) {
                    idInscrits.add(adherent.getNumeroLicense());
                }
            }
            for (Adherent adherent : pilotes) {
                if (!idInscrits.contains(adherent.getNumeroLicense())) {
                    idInscrits.add(adherent.getNumeroLicense());
                }
            }
            /*
             * Maintenant qu'on  la liste des id on reconstitue une liste
             * d'adherent
             */
            List<Adherent> adhInscrits = new ArrayList<Adherent>();
            for (String id : idInscrits) {
                adhInscrits.add(getResaSession().getAdherentService().rechercherAdherentParIdentifiant(id));
            }
            /*
             * Reste plus qu'a inscrire...
             */
            for (Adherent adh : adhInscrits) {
                try {
                    getResaSession().getPlongeeService().inscrireAdherent(plongee, adh,
                            PlongeeMail.PAS_DE_MAIL);
                } catch (ResaException e) {
                    e.printStackTrace();
                    ErrorPage ep = new ErrorPage(e);
                    setResponsePage(ep);
                }
            }
            PageParameters param = new PageParameters();
            param.put("plongeeAOuvrir", plongee);
            param.put("inscrits", adhInscrits);
            //setResponsePage(new GererPlongeeAOuvrirThree(plongee));
            setResponsePage(new InscriptionConfirmationPlongeePage(plongee));
        }//fin du onSubmit()
    };

    form.setModel(modelPlongee);
    // Le nombre max. de places, pour info
    maxPlaces = new TextField<Integer>("nbMaxPlaces");
    maxPlaces.setOutputMarkupId(true);
    form.add(maxPlaces.setEnabled(false));
    // Le niveau mini. des plongeurs, pour info
    niveauMinimum = new TextField<Integer>("niveauMinimum");
    niveauMinimum.setOutputMarkupId(true);
    form.add(niveauMinimum.setEnabled(false));

    // La Date de visibilite de la plonge, pour info
    dateVisible = new TextField<Date>("dateVisible");
    dateVisible.setOutputMarkupId(true);
    form.add(dateVisible.setEnabled(false));

    // Ajout des palettes
    form.add(palDp);
    form.add(palPilote);

    add(form);

    form.add(new IndicatingAjaxLink("change") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            replaceModalWindow(target, form.getModel());
            modalPlongee.show(target);
        }
    });

}

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

@SuppressWarnings("serial")
public ConsulterPlongees() {

    setPageTitle("Consulter les plong\u00e9es");
    this.adh = getResaSession().getAdherent();
    add(new Label("message",
            new StringResourceModel(CatalogueMessages.CONSULTER_MSG_ADHERENT, this, new Model<Adherent>(adh))));

    modal2 = new ModalWindow("modal2");
    modal2.setTitle("This is modal window with panel content.");
    modal2.setCookieName("modal-adherent");
    add(modal2);/*from   ww w .  j  a  v  a  2  s .  com*/

    try {
        List<Plongee> plongees = getResaSession().getPlongeeService().rechercherPlongeeProchainJour(adh);

        PlongeeDataProvider pDataProvider = new PlongeeDataProvider(plongees);

        add(new DataView<Plongee>("simple", pDataProvider) {
            protected void populateItem(final Item<Plongee> item) {
                final Plongee plongee = item.getModelObject();
                String nomDP = "Aucun";
                if (null != plongee.getDp()) {
                    nomDP = plongee.getDp().getNom();
                }

                item.add(new IndicatingAjaxLink("select") {
                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        if (adh.isEncadrent() || adh.getRoles().hasRole("SECRETARIAT")) {
                            replaceModalWindowEncadrant(target, item.getModel());
                        } else {
                            replaceModalWindow(target, item.getModel());
                        }
                        modal2.show(target);
                    }
                });

                // 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;
                    }
                }));
            }
        });
    } 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

public DeInscriptionPlongeePage() {

    this.adh = getResaSession().getAdherent();

    setPageTitle("Desinscription plongee");
    add(new Label("message", new StringResourceModel(CatalogueMessages.DESINSCRIPTION_MSG_ADHERENT, this,
            new Model<Adherent>(adh))));

    feedback = new FeedbackPanel("feedback");
    feedback.setOutputMarkupId(true);/*from w  w w  .ja  v  a 2  s . com*/
    add(feedback);

    // Initialisation de la fentre modal de confirmation d'annulation
    add(modalConfirm = new ModalWindow("modalConfirm"));
    //modalConfirm.setPageMapName("modal-2");

    modalConfirm.setTitle("Confirmation");

    modalConfirm.setResizable(false);
    modalConfirm.setInitialWidth(30);
    modalConfirm.setInitialHeight(15);
    modalConfirm.setWidthUnit("em");
    modalConfirm.setHeightUnit("em");

    modalConfirm.setCssClassName(ModalWindow.CSS_CLASS_BLUE);

    init();
}

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

public DesinscriptionFilleulPage() {

    this.parrain = getResaSession().getAdherent();

    setPageTitle("Desinscription Externe plongee");
    add(new Label("message", new StringResourceModel(CatalogueMessages.DESINSCRIPTION_FILLEUL_MSG_ADHERENT,
            this, new Model<Adherent>(parrain))));

    feedback = new FeedbackPanel("feedback");
    feedback.setOutputMarkupId(true);//ww w  .  j a  v a  2 s  .  c o  m
    add(feedback);

    // Initialisation de la fentre modal de confirmation d'annulation
    add(modalConfirm = new ModalWindow("modalConfirm"));
    //modalConfirm.setPageMapName("modal-2");

    modalConfirm.setTitle("Confirmation");

    modalConfirm.setResizable(false);
    modalConfirm.setInitialWidth(30);
    modalConfirm.setInitialHeight(15);
    modalConfirm.setWidthUnit("em");
    modalConfirm.setHeightUnit("em");

    modalConfirm.setCssClassName(ModalWindow.CSS_CLASS_BLUE);

    init();
}

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

public InscriptionFilleulPlongeePage(Adherent parrain) {
    super();// ww w.j  av  a  2s. c om
    this.parrain = parrain;
    add(new ExterieurForm("form"));

    // Lien pour la cration du plongeur extrieur
    modalExterieur = new ModalWindow("modalExterieur");
    modalExterieur.setTitle("This is modal window with panel content.");
    modalExterieur.setCookieName("modal-exterieur");
    add(modalExterieur);

    add(new IndicatingAjaxLink("creerExterieur") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            replaceModalWindow(target);
            modalExterieur.show(target);

        }
    });

    // Lien pour la modification du plongeur extrieur
    modalModifExterne = new ModalWindow("modalModifExterne");
    modalModifExterne.setTitle("This is modal window with panel content.");
    modalModifExterne.setCookieName("modal-modif-externe");
    add(modalModifExterne);
}

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

public DesInscriptionPlongeePage() {
    super();/*from w ww .ja  v  a2  s. c o m*/

    feedback = new FeedbackPanel("feedback");
    feedback.setOutputMarkupId(true);
    add(feedback);

    add(new PlongeurADesinscrireForm("formPlongeurADesinscrire"));

    // Fentre modale de consultation des plonges pour lesquelles
    // le plongeur est inscrit
    modalPlongees = new ModalWindow("modalPlongees");
    modalPlongees.setTitle("Liste des plong\u00e9es pour ce plongeur");
    modalPlongees.setUseInitialHeight(false);
    modalPlongees.setInitialWidth(750);
    modalPlongees.setWidthUnit("px");
    add(modalPlongees);

}

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

public InscriptionExterieurPlongeePage() {
    super();/*from w w w . j  ava2 s  . c  o  m*/
    add(new ExterieurForm("form"));

    // Lien pour la cration du plongeur extrieur
    modalExterieur = new ModalWindow("modalExterieur");
    modalExterieur.setTitle("This is modal window with panel content.");
    modalExterieur.setCookieName("modal-exterieur");
    add(modalExterieur);

    add(new IndicatingAjaxLink("creerExterieur") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            replaceModalWindow(target);
            modalExterieur.show(target);

        }
    });

    // Lien pour la modification du plongeur extrieur
    modalModifExterne = new ModalWindow("modalModifExterne");
    modalModifExterne.setTitle("This is modal window with panel content.");
    modalModifExterne.setCookieName("modal-modif-externe");
    add(modalModifExterne);
}