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:com.asptt.plongee.resa.wicket.page.admin.adherent.CreerAdherent.java

public CreerAdherent() {
    setPageTitle("Creer adherent");
    // Constructeur du formulaire et du feedback panel pour renvoyer des messages sur la page
    feedback.setOutputMarkupId(true);//from   w ww  .ja  va 2  s.c o  m
    add(feedback);

    modalDuplicateLicense = new ModalWindow("modalDuplicateLicense");
    modalDuplicateLicense.setTitle("Reinitialisation adherent inactif");
    modalDuplicateLicense.setResizable(false);
    modalDuplicateLicense.setInitialWidth(30);
    modalDuplicateLicense.setInitialHeight(15);
    modalDuplicateLicense.setWidthUnit("em");
    modalDuplicateLicense.setHeightUnit("em");
    modalDuplicateLicense.setCssClassName(ModalWindow.CSS_CLASS_BLUE);
    add(modalDuplicateLicense);

    add(new CreerAdherentForm("creerAdherentForm"));

}

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

public GererPlongeeAOuvrirTwo(final Plongee plongee) {
    setPageTitle("Ouvrir plongee");
    final FeedbackPanel feedback = new FeedbackPanel("feedback");
    feedback.setOutputMarkupId(true);//from  w w w  .j a  va  2 s  . c  om
    add(feedback);
    modalPlongee = new ModalWindow("modalPlongee");
    modalPlongee.setTitle("This is modal window with panel content.");
    modalPlongee.setCookieName("modal-plongee");
    add(modalPlongee);

    CompoundPropertyModel<Plongee> modelPlongee = new CompoundPropertyModel<Plongee>(plongee);
    // Liste des DPs
    List<Adherent> dps;
    dps = ResaSession.get().getAdherentService().rechercherDPsNonInscrits(
            ResaSession.get().getAdherentService().rechercherAdherentsActifs(), plongee);
    //Suppression des adherents dj inscrits  la plonge de la liste des DPs
    dps.removeAll(plongee.getParticipants());
    // Init ChoiceRender des DPs
    IChoiceRenderer<Adherent> rendDp = new ChoiceRenderer<Adherent>("nom", "nom");
    // Init de la palettes des DPs
    final Palette<Adherent> palDp = new Palette<Adherent>("paletteDps",
            new ListModel<Adherent>(new ArrayList<Adherent>()), new CollectionModel<Adherent>(dps), rendDp, 10,
            false) {
    };
    //List des Pilotes
    List<Adherent> pilotes = ResaSession.get().getAdherentService().rechercherPilotesNonInscrits(
            ResaSession.get().getAdherentService().rechercherAdherentsActifs(), plongee);
    //Suppression des adherents dj inscrits  la plonge de la liste des Pilotes
    pilotes.removeAll(plongee.getParticipants());
    // Init ChoiceRender des Pilotes
    IChoiceRenderer<Adherent> rendPilote = new ChoiceRenderer<Adherent>("nom", "nom");
    // Init de la palettes des Pilotes
    final Palette<Adherent> palPilote = new Palette<Adherent>("palettePilotes",
            new ListModel<Adherent>(new ArrayList<Adherent>()), new CollectionModel<Adherent>(pilotes),
            rendPilote, 10, false) {
    };
    //Init de la Forme
    final Form<Plongee> form = new Form<Plongee>("form") {
        private static final long serialVersionUID = 4611593854191923422L;

    };
    //Dfinition du model de la form == plongee
    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
    dateReservation = new TextField<Date>("dateReservation");
    dateReservation.setOutputMarkupId(true);
    form.add(dateReservation.setEnabled(false));
    //ajout du warning
    warning = new TextArea<String>("warning");
    warning.setOutputMarkupId(true);
    form.add(warning.setEnabled(false));

    // Ajout des palettes
    form.add(palDp);
    form.add(palPilote);
    // Ajout du lien pour modifier les caracteristiques de la plonge
    form.add(new IndicatingAjaxLink("change") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            replaceModalWindow(target, form.getModel());
            modalPlongee.show(target);
        }
    });
    // Ajout du bouton submit
    IndicatingAjaxButton b_valider = new IndicatingAjaxButton("validDpPilote") {
        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            IModel<?> modelDps = palDp.getDefaultModel();
            List<Adherent> dps = (List<Adherent>) modelDps.getObject();

            IModel<?> modelPilotes = palPilote.getDefaultModel();
            List<Adherent> pilotes = (List<Adherent>) modelPilotes.getObject();

            if (dps.size() != 1 || pilotes.size() != 1) {
                error("Un DP et un pilote doivent tre selectionns");
            } else {
                /*
                 * Impossible de gerer les doublons avec un HashSet Alors on le
                 * fait ' la main'
                 */
                List<Adherent> l_dpPilote = new ArrayList<Adherent>();
                l_dpPilote.add(dps.get(0));
                if (!dps.get(0).getNumeroLicense().equalsIgnoreCase(pilotes.get(0).getNumeroLicense())) {
                    l_dpPilote.add(pilotes.get(0));
                }
                // Inscription du DP et Pilote
                for (Adherent adh : l_dpPilote) {
                    try {
                        ResaSession.get().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", l_dpPilote);
                setResponsePage(new ListeInscritsPlongeePage(plongee));
            }
        }//fin du onSubmit()

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            target.addComponent(feedback);
        }
    };
    form.add(new Link("cancel") {
        @Override
        public void onClick() {
            setResponsePage(GererPlongeeAOuvrirOne.class);
        }
    });
    //add(new Button("cancel", new ResourceModel("button.cancel")));

    form.add(b_valider);

    add(form);
}

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

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

    setPageTitle("Consulter les plong\u00e9es");
    this.adh = ResaSession.get().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 va 2s.c o m

    try {
        List<Plongee> plongees = ResaSession.get().getPlongeeService().rechercherPlongeeProchainJour(adh,
                ActionRecherche.CONSULTATION);

        PlongeeDataProvider pDataProvider = new PlongeeDataProvider(plongees);

        add(new DataView<Plongee>("simple", pDataProvider) {
            @Override
            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);
                    }
                });
                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 Label("dp", nomDP));
                item.add(new Label("niveauMini", plongee.getNiveauMinimum()));
                // Places restantes
                item.add(new Label("placesRestantes",
                        ResaSession.get().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.wicket.page.inscription.DeInscriptionPlongeePage.java

public DeInscriptionPlongeePage() {

    this.adh = ResaSession.get().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);// w w  w .jav  a  2 s .co m
    add(feedback);

    // Initialisation de la fentre modal de confirmation d'annulation d'un encadrant
    add(modalConfirmDesInscription = new ModalWindow("modalConfirmDesInscription"));
    modalConfirmDesInscription.setTitle("Confirmation de desinscription");
    modalConfirmDesInscription.setResizable(false);
    modalConfirmDesInscription.setInitialWidth(28);
    modalConfirmDesInscription.setInitialHeight(10);
    modalConfirmDesInscription.setWidthUnit("em");
    modalConfirmDesInscription.setHeightUnit("em");
    modalConfirmDesInscription.setCssClassName(ModalWindow.CSS_CLASS_BLUE);

    // Initialisation de la fentre modal de confirmation d'annulation d'un encadrant
    add(modalConfirmDesInscriptionEncadrant = new ModalWindow("modalConfirmDeInscriptionEncadrant"));
    modalConfirmDesInscriptionEncadrant.setTitle("Confirmation de desinscription d'un encadrant");
    modalConfirmDesInscriptionEncadrant.setResizable(false);
    modalConfirmDesInscriptionEncadrant.setInitialWidth(28);
    modalConfirmDesInscriptionEncadrant.setInitialHeight(11);
    modalConfirmDesInscriptionEncadrant.setWidthUnit("em");
    modalConfirmDesInscriptionEncadrant.setHeightUnit("em");
    modalConfirmDesInscriptionEncadrant.setCssClassName(ModalWindow.CSS_CLASS_BLUE);
    init();
}

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

public DesInscriptionPlongeePage() {
    super();//  w w  w  . jav a  2s  .  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.setResizable(true);
    //      modalPlongees.setUseInitialHeight(false);
    modalPlongees.setInitialHeight(45);
    modalPlongees.setInitialWidth(750);
    modalPlongees.setWidthUnit("px");
    modalPlongees.setHeightUnit("px");
    add(modalPlongees);

}

From source file:com.comcast.cdn.traffic_control.traffic_monitor.wicket.components.CacheListPanel.java

License:Apache License

public CacheListPanel(final String id, final Behavior updater, final Component[] updateList) {
    super(id);//  w w w  . j  a va  2s .  co  m

    final ModalWindow modal1;
    add(modal1 = new ModalWindow("modal1"));
    modal1.setInitialWidth(1000);
    //      modal1.setCookieName("modal-1");
    modal1.setPageCreator(new ModalWindow.PageCreator() {
        private static final long serialVersionUID = 1L;

        public Page createPage() {
            return new CacheDetailsPage(hostname);
        }
    });

    this.updateList = updateList;
    final WebMarkupContainer container = new WebMarkupContainer("listpanel");
    container.setOutputMarkupId(true);
    add(container);
    servers = createServerListView(updater, modal1);
    servers.setOutputMarkupId(true);
    container.setOutputMarkupId(true);
    container.add(servers);

    add(new AbstractAjaxTimerBehavior(Duration.seconds(1)) {
        private static final long serialVersionUID = 1L;
        int serverCount = 0;

        @Override
        protected final void onTimer(final AjaxRequestTarget target) {
            //            target.add(getComponent());
            final int size = CacheState.getCacheStates().size();
            if (serverCount != size) {
                serverCount = size;
                servers.setList(getServerList());
                target.add(container);
                if (updateList != null) {
                    for (Component c : updateList) {
                        target.add(c);
                    }
                }
                //               target.add(graph);
            }
        }
    });
}

From source file:com.comcast.cdn.traffic_control.traffic_monitor.wicket.components.DsListPanel.java

License:Apache License

public DsListPanel(final String id, final Behavior updater, final Component[] updateList) {
    super(id);/*  ww  w .  jav a 2s .c o  m*/

    final ModalWindow modal1;
    add(modal1 = new ModalWindow("modal2"));
    modal1.setInitialWidth(1000);
    //      modal1.setCookieName("modal-1");
    modal1.setPageCreator(new ModalWindow.PageCreator() {
        private static final long serialVersionUID = 1L;

        public Page createPage() {
            return new DsDetailsPage(dsId);
        }
    });

    this.updateList = updateList;
    final WebMarkupContainer container = new WebMarkupContainer("listpanel");
    container.setOutputMarkupId(true);
    add(container);
    servers = createDsListView(updater, modal1);
    servers.setOutputMarkupId(true);
    container.setOutputMarkupId(true);
    container.add(servers);

    add(new AbstractAjaxTimerBehavior(Duration.seconds(1)) {
        private static final long serialVersionUID = 1L;
        int serverCount = 0;

        @Override
        protected final void onTimer(final AjaxRequestTarget target) {
            final int size = DsState.getDsStates().size();
            if (serverCount != size) {
                serverCount = size;
                servers.setList(getDsList());
                target.add(container);
                if (updateList != null) {
                    for (Component c : updateList) {
                        target.add(c);
                    }
                }
            }
        }
    });
}

From source file:com.cubeia.backoffice.web.user.UserList.java

License:Open Source License

/**
* Constructor that is invoked when page is invoked without a session.
* 
* @param parameters//from ww w .j  a v  a  2 s. c o  m
*            Page parameters
*/
public UserList(final PageParameters parameters) {
    final Form<?> searchForm = new Form<UserList>("searchForm", new CompoundPropertyModel<UserList>(this));
    final TextField<String> idField = new TextField<String>("userId");
    searchForm.add(idField);
    final TextField<String> userNameField = new TextField<String>("name");
    searchForm.add(userNameField);
    searchForm.add(new Button("clearForm") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onSubmit() {
            super.onSubmit();
            idField.clearInput();
            userNameField.clearInput();
        }
    });
    add(searchForm);
    add(new FeedbackPanel("feedback"));

    final UsersDataProvider dataProvider = new UsersDataProvider();
    List<IColumn<User, String>> columns = new ArrayList<IColumn<User, String>>();

    columns.add(new AbstractColumn<User, String>(Model.of("User Id")) {
        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<User>> item, String componentId, IModel<User> model) {
            Long userId = model.getObject().getUserId();
            LabelLinkPanel panel = new LabelLinkPanel(componentId, "" + userId, UserSummary.class,
                    params(UserSummary.PARAM_USER_ID, userId));
            item.add(panel);
        }

        @Override
        public boolean isSortable() {
            return true;
        }

        @Override
        public String getSortProperty() {
            return UserOrder.ID.name();
        }
    });
    columns.add(new PropertyColumn<User, String>(Model.of("XId"), "externalUserId"));
    columns.add(
            new PropertyColumn<User, String>(Model.of("User name"), UserOrder.USER_NAME.name(), "userName"));
    columns.add(new PropertyColumn<User, String>(Model.of("Status"), UserOrder.STATUS.name(), "status"));
    //        columns.add(new PropertyColumn<User,String>(Model.of("First name"), "userInformation.firstName"));
    //        columns.add(new PropertyColumn<User,String>(Model.of("Last name"), "userInformation.lastName"));
    //        columns.add(new PropertyColumn<User,String>(Model.of("Country"), UserOrder.COUNTRY.name(), "userInformation.country"));
    columns.add(new PropertyColumn<User, String>(Model.of("Ext. Username"), "attributes.externalUsername"));
    columns.add(new PropertyColumn<User, String>(Model.of("Screename"), "attributes.screenname"));

    AjaxFallbackDefaultDataTable<User, String> userTable = new AjaxFallbackDefaultDataTable<User, String>(
            "userTable", columns, dataProvider, 20);
    add(userTable);

    final ModalWindow modal = new ModalWindow("modal");
    modal.setContent(new UserReportPanel(modal.getContentId(), modal));
    modal.setTitle("Generate report");
    modal.setCookieName("modal");
    modal.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    modal.setInitialWidth(265);
    modal.setInitialHeight(200);

    add(modal);
    add(new AjaxLink<Void>("showReportPanel") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            List<User> users = getUserList(getUserId(), getName(), 0, Integer.MAX_VALUE,
                    dataProvider.getSort().getProperty(), dataProvider.getSort().isAscending()).getUsers();
            HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();
            request.getSession().setAttribute(ReportServlet.REPORTS_COLLECTION_DATA_SOURCE, users);
            modal.show(target);
        }
    });
}

From source file:com.cubeia.games.poker.admin.wicket.pages.user.UserList.java

License:Open Source License

/**
* Constructor that is invoked when page is invoked without a session.
* 
* @param parameters/*w  w w .j a  va 2  s .  c om*/
*            Page parameters
*/
public UserList(final PageParameters parameters) {
    super(parameters);
    final Form<?> searchForm = new Form<UserList>("searchForm", new CompoundPropertyModel<UserList>(this));
    final TextField<String> idField = new TextField<String>("userId");
    searchForm.add(idField);
    final TextField<String> userNameField = new TextField<String>("name");
    searchForm.add(userNameField);
    searchForm.add(new Button("clearForm") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onSubmit() {
            super.onSubmit();
            idField.clearInput();
            userNameField.clearInput();
        }
    });
    add(searchForm);
    add(new FeedbackPanel("feedback"));

    final UsersDataProvider dataProvider = new UsersDataProvider();
    List<IColumn<User, String>> columns = new ArrayList<IColumn<User, String>>();

    columns.add(new AbstractColumn<User, String>(Model.of("User Id")) {
        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<User>> item, String componentId, IModel<User> model) {
            Long userId = model.getObject().getUserId();
            LabelLinkPanel panel = new LabelLinkPanel(componentId, "" + userId, UserSummary.class,
                    params(UserSummary.PARAM_USER_ID, userId));
            item.add(panel);
        }

        @Override
        public boolean isSortable() {
            return true;
        }

        @Override
        public String getSortProperty() {
            return UserOrder.ID.name();
        }
    });
    columns.add(new PropertyColumn<User, String>(Model.of("XId"), "externalUserId"));
    columns.add(
            new PropertyColumn<User, String>(Model.of("User name"), UserOrder.USER_NAME.name(), "userName"));
    columns.add(new PropertyColumn<User, String>(Model.of("Status"), UserOrder.STATUS.name(), "status"));
    //        columns.add(new PropertyColumn<User,String>(Model.of("First name"), "userInformation.firstName"));
    //        columns.add(new PropertyColumn<User,String>(Model.of("Last name"), "userInformation.lastName"));
    //        columns.add(new PropertyColumn<User,String>(Model.of("Country"), UserOrder.COUNTRY.name(), "userInformation.country"));
    columns.add(new PropertyColumn<User, String>(Model.of("Ext. Username"), "attributes.externalUsername"));
    columns.add(new PropertyColumn<User, String>(Model.of("Screename"), "attributes.screenname"));

    AjaxFallbackDefaultDataTable<User, String> userTable = new AjaxFallbackDefaultDataTable<User, String>(
            "userTable", columns, dataProvider, 20);
    add(userTable);

    final ModalWindow modal = new ModalWindow("modal");
    modal.setContent(new UserReportPanel(modal.getContentId(), modal));
    modal.setTitle("Generate report");
    modal.setCookieName("modal");
    modal.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    modal.setInitialWidth(265);
    modal.setInitialHeight(200);

    add(modal);
    add(new AjaxLink<Void>("showReportPanel") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            List<User> users = getUserList(getUserId(), getName(), 0, Integer.MAX_VALUE,
                    dataProvider.getSort().getProperty(), dataProvider.getSort().isAscending()).getUsers();
            HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();
            request.getSession().setAttribute(ReportServlet.REPORTS_COLLECTION_DATA_SOURCE, users);
            modal.show(target);
        }
    });
}

From source file:com.doculibre.constellio.wicket.components.holders.ModalLinkHolder.java

License:Open Source License

private void initComponents(IModel labelModel) {
    link = newLink(LINK_ID);//from  w w  w. j  av  a  2s  .  com
    label = newLabel(LABEL_ID, labelModel);

    add(link);
    link.add(label);

    IModel titleModel = getTitleModel();
    if (titleModel != null) {
        link.add(new AttributeModifier("title", true, titleModel));
    }

    modalWindow = new ModalWindow("modal");
    modalWindow.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    add(modalWindow);
}