List of usage examples for org.apache.wicket.extensions.ajax.markup.html IndicatingAjaxLink IndicatingAjaxLink
public IndicatingAjaxLink(final String id)
From source file:at.molindo.esi4j.example.web.HomePage.java
License:Apache License
public HomePage() { add(new UrlSubmissionForm("urlForm")); _searchModel = new AbstractReadOnlyModel<Search>() { private final Search _search = new Search(); @Override//ww w . j a va 2 s . co m public Search getObject() { return _search; } }; _searchResponseModel = new LoadableDetachableModel<ListenableActionFuture<SearchResponseWrapper>>() { @Override protected ListenableActionFuture<SearchResponseWrapper> load() { Search search = _searchModel.getObject(); return _searchService.search(search.getQuery(), search.getCategories()); } }; IModel<List<SearchHitWrapper>> articlesModel = new AbstractReadOnlyModel<List<SearchHitWrapper>>() { @Override public List<SearchHitWrapper> getObject() { return _searchResponseModel.getObject().actionGet().getSearchHits(); } }; IModel<List<? extends TermsFacet.Entry>> facetsModel = new AbstractReadOnlyModel<List<? extends TermsFacet.Entry>>() { @Override public List<? extends TermsFacet.Entry> getObject() { Facets facets = _searchResponseModel.getObject().actionGet().getSearchResponse().getFacets(); if (facets == null) { return Collections.emptyList(); } TermsFacet facet = (TermsFacet) facets.facet("categories"); if (facet == null) { return Collections.emptyList(); } return facet.getEntries(); } }; add(new TextField<String>("search", new PropertyModel<String>(_searchModel, "query")) .add(new OnChangeUpdateSearchBehavior())); // category select add(_facetsContainer = new CheckGroup<String>("facetsContainer")); _facetsContainer.setOutputMarkupId(true).setRenderBodyOnly(false); _facetsContainer.add(new ListView<TermsFacet.Entry>("categoryFacets", facetsModel) { @Override protected IModel<TermsFacet.Entry> getListItemModel( IModel<? extends List<TermsFacet.Entry>> listViewModel, int index) { return new CompoundPropertyModel<TermsFacet.Entry>(super.getListItemModel(listViewModel, index)); } @Override protected void populateItem(final ListItem<Entry> item) { CheckBox box; item.add(box = new CheckBox("check", new IModel<Boolean>() { @Override public Boolean getObject() { return _searchModel.getObject().getCategories().contains(item.getModelObject().getTerm()); } @Override public void setObject(Boolean checked) { List<String> categories = _searchModel.getObject().getCategories(); String category = item.getModelObject().getTerm().string(); if (Boolean.TRUE.equals(checked)) { categories.add(category); } else { categories.remove(category); } } @Override public void detach() { } })); box.add(new OnChangeUpdateSearchBehavior()); item.add(new SimpleFormComponentLabel("term", box.setLabel(new PropertyModel<String>(item.getModel(), "term")))); item.add(new Label("count")); } }); // search results add(_container = new WebMarkupContainer("container")); _container.setOutputMarkupId(true); _container.add(new Label("query", _searchModel.getObject().getQuery())); _container.add(new ListView<SearchHitWrapper>("result", articlesModel) { @Override protected IModel<SearchHitWrapper> getListItemModel( IModel<? extends List<SearchHitWrapper>> listViewModel, int index) { return new CompoundPropertyModel<SearchHitWrapper>(super.getListItemModel(listViewModel, index)); } @Override protected void populateItem(final ListItem<SearchHitWrapper> item) { item.add(new Label("object.subject")); item.add(new Label("object.date")); item.add(new Label("object.body", new AbstractReadOnlyModel<String>() { @Override public String getObject() { SearchHitWrapper wrapper = item.getModelObject(); HighlightField field = wrapper.getSearchHit().getHighlightFields().get("body"); if (field == null) { return wrapper.getObject(Article.class).getBody(); } Object[] fragments = field.getFragments(); if (fragments == null) { return wrapper.getObject(Article.class).getBody(); } return StringUtils.join(" ... ", fragments); } })); item.add(new ExternalLink("link", new PropertyModel<String>(item.getModel(), "object.url"))); item.add(new ListView<String>("categories", new PropertyModel<List<String>>(item.getModel(), "object.categories")) { @Override protected void populateItem(ListItem<String> item) { item.add(new Label("name", item.getModel())); } }); } }); add(new IndicatingAjaxLink<Void>("rebuild") { @Override public void onClick(AjaxRequestTarget target) { _searchService.rebuild(); updateSearch(target); } }); add(new IndicatingAjaxLink<Void>("delete") { @Override public void onClick(AjaxRequestTarget target) { _articleService.deleteArticles(); _searchService.refresh(); updateSearch(target); } }); }
From source file:au.org.theark.core.web.component.panel.collapsiblepanel.CollapsiblePanel.java
License:Open Source License
/** * Construct the panel/*from ww w .j a v a 2 s. c om*/ * * @param id * Panel ID * @param titleModel * Model used to get the panel title * @param defaultOpen * Is the default state open */ public CollapsiblePanel(String id, IModel<String> titleModel, boolean defaultOpen) { super(id); this.visible = defaultOpen; innerPanel = getInnerPanel("innerPanel"); innerPanel.setVisible(visible); innerPanel.setOutputMarkupId(true); innerPanel.setOutputMarkupPlaceholderTag(true); add(innerPanel); final Image showHideImage = new Image("showHideIcon") { private static final long serialVersionUID = 8638737301579767296L; @Override public ResourceReference getImageResourceReference() { return visible ? open : closed; } }; showHideImage.setOutputMarkupId(true); IndicatingAjaxLink<String> showHideLink = new IndicatingAjaxLink<String>("showHideLink") { private static final long serialVersionUID = -1929927616508773911L; @Override public void onClick(AjaxRequestTarget target) { visible = !visible; innerPanel.setVisible(visible); target.add(innerPanel); target.add(showHideImage); } }; showHideLink.add(showHideImage); add(new Label("titlePanel", titleModel)); add(showHideLink); }
From source file:ca.travelagency.invoice.items.ItemRowPanel.java
License:Apache License
private IndicatingAjaxLink<Void> makeMoveLink(final String id, final ItemsPanel itemsPanel) { IndicatingAjaxLink<Void> link = new IndicatingAjaxLink<Void>(id) { private static final long serialVersionUID = 1L; @Override//from w w w .ja v a 2 s . c o m public void onClick(AjaxRequestTarget target) { if (MOVE_UP.equals(id)) { itemsPanel.moveUp(target, getInvoiceItem()); } else { itemsPanel.moveDown(target, getInvoiceItem()); } } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); attributes.getAjaxCallListeners().add(new BlockUIDecorator()); } }; ContextRelativeResource contextRelativeResource = new ContextRelativeResource( "images/" + (MOVE_UP.equals(id) ? "move_up.png" : "move_down.png")); link.add(new Image(MOVE_LABEL, contextRelativeResource)); return link; }
From source file:com.asptt.plongee.resa.model.AdherentDataView.java
@Override protected void populateItem(final Item item) { final Adherent adherent = (Adherent) item.getModelObject(); item.add(new IndicatingAjaxLink("select") { @Override/*w w w .ja v a 2 s .co m*/ public void onClick(AjaxRequestTarget target) { GererAdherents.replaceModalWindowModif(target, item.getModel()); GererAdherents.getModalModif().show(target); } }); item.add(new IndicatingAjaxLink("suppAdh") { @Override public void onClick(AjaxRequestTarget target) { GererAdherents.replaceModalWindowSupp(target, item.getModel()); GererAdherents.getModalSupp().show(target); } }); item.add(new IndicatingAjaxLink("pwdAdh") { @Override public void onClick(AjaxRequestTarget target) { GererAdherents.replaceModalWindowPwd(target, item.getModel()); GererAdherents.getModalPwd().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)); //add openPdf resouceLink with webResource pdf for visu Certificat mdical item.add(new UtilsFSpdf().createWebResourcePdf(adherent, null)); 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; } })); }
From source file:com.asptt.plongee.resa.model.ExterneDataView.java
@Override protected void populateItem(final Item item) { final Adherent externe = (Adherent) item.getModelObject(); item.add(new IndicatingAjaxLink("select") { @Override//from ww w.ja va2 s . c o m public void onClick(AjaxRequestTarget target) { GererExternes.replaceModalWindowModif(target, item.getModel()); GererExternes.getModalModif().show(target); } }); item.add(new IndicatingAjaxLink("suppAdh") { @Override public void onClick(AjaxRequestTarget target) { GererExternes.replaceModalWindowSupp(target, item.getModel()); GererExternes.getModalSupp().show(target); } }); item.add(new Label("license", externe.getNumeroLicense())); item.add(new Label("nom", externe.getNom())); item.add(new Label("prenom", externe.getPrenom())); // Ds que le plongeur est encadrant, on affiche son niveau d'encadrement String niveauAffiche = externe.getPrerogative(); item.add(new Label("niveau", niveauAffiche)); 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; } })); }
From source file:com.asptt.plongee.resa.ui.web.wicket.page.admin.GererAdherents.java
@SuppressWarnings("serial") public GererAdherents() { setPageTitle("Gerer les adherents"); setOutputMarkupId(true);//w ww .j a v a 2 s . c om 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);//from w w w. j a v a2 s .co m 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 w w w . jav a 2s.c om*/ 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.InscriptionFilleulPlongeePage.java
public InscriptionFilleulPlongeePage(Adherent parrain) { super();// www. j a va 2 s . com 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.InscriptionExterieurPlongeePage.java
public InscriptionExterieurPlongeePage() { super();/*w ww. j a v a2 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); }