List of usage examples for org.apache.wicket.markup.html.basic Label setOutputMarkupId
public final Component setOutputMarkupId(final boolean output)
From source file:au.org.theark.lims.web.component.inventory.panel.box.display.GridBoxPanel.java
License:Open Source License
/** * Creates the table data that represents the cells of the InvBox in question * @param invBox//from ww w. ja v a2 s . c om * @param invCellList * @return */ @SuppressWarnings({ "unchecked" }) private Loop createMainGrid(final InvBox invBox, final List<InvCell> invCellList) { String colRowNoType = ""; if (invBox.getId() != null) { colRowNoType = invBox.getRownotype().getName(); } else { // handle for null invBox (eg when backend list of cells corrupted) return new Loop("rows", 1) { private static final long serialVersionUID = 1L; @Override protected void populateItem(LoopItem item) { item.add(new Loop("cols", 1) { private static final long serialVersionUID = 1L; @Override protected void populateItem(LoopItem item) { item.add(new EmptyPanel("cell")); } }.setVisible(false)); } @Override public boolean isVisible() { return false; } }; } final String rowNoType = colRowNoType; final int noOfCols = invBox.getNoofcol(); // Outer Loop instance, using a PropertyModel to bind the Loop iteration to invBox "noofrow" value Loop loop = new Loop("rows", new PropertyModel(invBox, "noofrow")) { private static final long serialVersionUID = 1L; public void populateItem(LoopItem item) { final int row = item.getIndex(); // Create the row number/label String label = new String(); if (rowNoType.equalsIgnoreCase("ALPHABET")) { char character = (char) (row + 65); label = new Character(character).toString(); } else { label = new Integer(row + 1).toString(); } Label rowLabel = new Label("rowNo", new Model(label)); rowLabel.add(new Behavior() { private static final long serialVersionUID = 1L; @Override public void onComponentTag(Component component, ComponentTag tag) { super.onComponentTag(component, tag); tag.put("style", "background: none repeat scroll 0 0 #FFFFFF; color: black; font-weight: bold; padding: 1px;"); }; }); rowLabel.setOutputMarkupId(true); item.add(rowLabel); // We create an inner Loop instance and uses PropertyModel to bind the Loop iteration to invBox "noofcol" value item.add(new Loop("cols", new PropertyModel(invBox, "noofcol")) { private static final long serialVersionUID = 1L; public void populateItem(LoopItem item) { final int col = item.getIndex(); final int index = (row * noOfCols) + col; InvCell invCell = invCellList.get(index); GridCellContentPanel gridCellContentPanel; // add the gridCell if (allocating) { gridCellContentPanel = new GridCellContentPanel("cell", limsVo, invCell, modalWindow, true); } else { gridCellContentPanel = new GridCellContentPanel("cell", limsVo, invCell, modalWindow, false); } gridCellContentPanel.setOutputMarkupId(true); gridCellContentPanel.setMarkupId("invCell" + invCell.getId().toString()); item.add(gridCellContentPanel); } }); } }; return loop; }
From source file:by.parfen.disptaxi.webapp.etc.AutoComplitePage.java
License:Apache License
/** * Constructor.//from w ww.j a va 2 s .c o m */ public AutoComplitePage() { Injector.get().inject(this); sampleEvent = new SampleEvent(); // selectedCity = cityService.get(15L); sampleEvent.setCityById(60L); streetsList = sampleEvent.getStreets(); // pointsList = sampleEvent.getPointsList(); final FeedbackPanel feedback = new FeedbackPanel("feedback"); feedback.setOutputMarkupId(true); add(feedback); Form<Void> form = new Form<Void>("form"); add(form); final AutoCompleteTextField<String> field = new AutoCompleteTextField<String>("acStreet", new Model<String>("")) { @Override protected Iterator<String> getChoices(String input) { if (Strings.isEmpty(input)) { List<String> emptyList = Collections.emptyList(); return emptyList.iterator(); } List<String> choices = new ArrayList<String>(MAX_AUTO_COMPLETE_ELEMENTS); for (final Street streetItem : streetsList) { final String streetName = streetItem.getName(); if (streetName.toUpperCase().startsWith(input.toUpperCase())) { choices.add(streetName); if (choices.size() == MAX_AUTO_COMPLETE_ELEMENTS) { break; } } } return choices.iterator(); } }; final AutoCompleteTextField<String> fieldPoint = new AutoCompleteTextField<String>("acPoint", new Model<String>("")) { @Override protected Iterator<String> getChoices(String input) { if (Strings.isEmpty(input)) { List<String> emptyList = Collections.emptyList(); return emptyList.iterator(); } List<String> choices = new ArrayList<String>(MAX_AUTO_COMPLETE_ELEMENTS); for (final Point pointItem : sampleEvent.getPointsList()) { final String pointName = pointItem.getName(); if (pointName.toUpperCase().startsWith(input.toUpperCase())) { choices.add(pointName); if (choices.size() == MAX_AUTO_COMPLETE_ELEMENTS) { break; } } } return choices.iterator(); } }; final ItemPanel itemPanel = new ItemPanel("itemPanel"); add(itemPanel); add(new Link<Void>("linkItemInfo") { @Override public void onClick() { info("onSubmit"); info(itemPanel.getItemInfo()); } }); final Label label = new Label("label", form.getDefaultModel()) { @Override public void onEvent(IEvent<?> event) { Object payload = event.getPayload(); if (payload instanceof SampleEvent) { SampleEvent sampelEvent = (SampleEvent) payload; setDefaultModel(Model .of(sampelEvent.getSelectedStreetName() + ", " + sampelEvent.getSelectedPointName())); sampelEvent.getTarget().add(this); } } }; label.setOutputMarkupId(true); add(label); form.add(field); form.add(fieldPoint); field.add(new AjaxFormSubmitBehavior(form, "onchange") { @Override protected void onSubmit(AjaxRequestTarget target) { sampleEvent.setTarget(target); sampleEvent.setSelectedStreetName(field.getDefaultModelObjectAsString()); sampleEvent.setSelectedPointName(""); send(getPage(), Broadcast.BREADTH, sampleEvent); } @Override protected void onError(AjaxRequestTarget target) { } }); fieldPoint.add(new AjaxFormSubmitBehavior(form, "onchange") { @Override protected void onSubmit(AjaxRequestTarget target) { sampleEvent.setTarget(target); sampleEvent.setSelectedPointName(fieldPoint.getDefaultModelObjectAsString()); send(getPage(), Broadcast.BREADTH, sampleEvent); } @Override protected void onError(AjaxRequestTarget target) { } }); }
From source file:by.parfen.disptaxi.webapp.etc.ChoicePage.java
License:Apache License
/** * Constructor./* w w w .j av a2 s. c om*/ */ public ChoicePage() { final City city = cityService.get(15L); List<Street> streetsList; streetsList = streetService.getAllByCity(city); for (Street streetItem : streetsList) { List<Point> pointsList = pointService.getAllByStreet(streetItem); List<String> pointNames = new ArrayList<String>(); for (Point pointItem : pointsList) { pointNames.add(pointItem.getName()); } pointsMap.put(streetItem.getName(), pointNames); } // pointsMap.put("", Arrays.asList("12", "22", "34")); // pointsMap.put("", Arrays.asList("2", "4", "45", "13", "78")); // pointsMap.put("", Arrays.asList("10", "12", "22", "4", "6")); IModel<List<? extends String>> makeChoices = new AbstractReadOnlyModel<List<? extends String>>() { @Override public List<String> getObject() { return new ArrayList<String>(pointsMap.keySet()); } }; IModel<List<? extends String>> modelChoices = new AbstractReadOnlyModel<List<? extends String>>() { @Override public List<String> getObject() { List<String> points = pointsMap.get(selectedStreetName); if (points == null) { points = Collections.emptyList(); } return points; } }; Form<Void> form = new Form<Void>("form"); add(form); final DropDownChoice<String> streets = new DropDownChoice<String>("streets", new PropertyModel<String>(this, "selectedStreetName"), makeChoices); final DropDownChoice<String> points = new DropDownChoice<String>("points", new Model<String>(), modelChoices); points.setOutputMarkupId(true); form.add(streets); form.add(points); final FeedbackPanel feedback = new FeedbackPanel("feedback"); feedback.setOutputMarkupId(true); add(feedback); form.add(new AjaxButton("go") { @Override protected void onAfterSubmit(AjaxRequestTarget target, Form<?> form) { super.onAfterSubmit(target, form); info(" : " + streets.getModelObject() + " " + points.getModelObject()); target.add(feedback); } }); streets.add(new AjaxFormComponentUpdatingBehavior("change") { @Override protected void onUpdate(AjaxRequestTarget target) { target.add(points); } }); Form<Void> ajaxForm = new Form<Void>("ajaxForm"); add(ajaxForm); final AutoCompleteTextField<String> field = new AutoCompleteTextField<String>("ac", new Model<String>("")) { @Override protected Iterator<String> getChoices(String input) { if (Strings.isEmpty(input)) { List<String> emptyList = Collections.emptyList(); return emptyList.iterator(); } List<String> choices = new ArrayList<String>(10); List<Street> streetsList = streetService.getAllByCity(city); for (final Street streetItem : streetsList) { final String streetName = streetItem.getName(); if (streetName.toUpperCase().startsWith(input.toUpperCase())) { choices.add(streetName); if (choices.size() == 10) { break; } } } return choices.iterator(); } }; ajaxForm.add(field); final Label label = new Label("selectedValue", field.getDefaultModel()); label.setOutputMarkupId(true); ajaxForm.add(label); field.add(new AjaxFormSubmitBehavior(ajaxForm, "onchange") { @Override protected void onSubmit(AjaxRequestTarget target) { target.add(label); List<Street> streetList = streetService.getAllByCityAndName(city, label.getDefaultModelObjectAsString()); if (streetList.size() == 1) { setSelectedStreet(streetList.get(0)); } } @Override protected void onError(AjaxRequestTarget target) { } }); }
From source file:com.asptt.plongee.resa.wicket.page.admin.palanque.PalanqueForm.java
@SuppressWarnings("serial") public PalanqueForm(String id, NavigationOriginePage originePage, final Palanque palanqueUpdate, Date dateMin, Date dateMax, final FeedbackPanel feedback) { super(id);/*from ww w . j ava 2 s. c o m*/ feedback.setOutputMarkupId(true); dateMini = dateMin; dateMaxi = dateMax; origPage = originePage; //Rcupration de la fiche de securite dans la session fs = ResaSession.get().getFicheSecurite(); //init de la palanque if (null == palanqueUpdate) { this.palanque = new Palanque(); this.palanque.setDatePlongee(fs.getDatePlongee()); this.palanque.setNumero(fs.getNbPalanques() + 1); } else { this.palanque = palanqueUpdate; //methode pour initialiser les ChoiceRenderPlongeur de la palanque initPalanque(palanqueUpdate); } //initialisation des plongeurs inscrire pour ne pas allez la chercher chaque fois // listPlongeursAInscrireForpalanque = ResaSession.get().getPlongeeService().initListPlongeursAInscrire(fs); listPlongeursAInscrireForpalanque = ResaSession.get().getListPlongeursAInscrire(); //sauvegarde de la palanque en cas d'annulation de modification //TODO - se servir de l'implementation de la methode clone final Palanque palanqueSAV = new Palanque(palanque); //sauvegarde des plongeursAInscrire en cas d'annulation de modification final List<ChoiceRenderPlongeur> plongeursAInscrireSAV = new ArrayList<ChoiceRenderPlongeur>(); if (null != ResaSession.get().getListPlongeursAInscrire()) { plongeursAInscrireSAV.addAll(ResaSession.get().getListPlongeursAInscrire()); } final CompoundPropertyModel<Palanque> modelPalanque = new CompoundPropertyModel<Palanque>(palanque); setModel(modelPalanque); add(new Label("messageNumPalanque", new StringResourceModel( CatalogueMessages.SAISIE_PALANQUE_MSG_NUM_PALANQUE, this, new Model<Palanque>(palanque)))); // Ajout de la checkbox Bapteme AjaxCheckBox checkBox = new AjaxCheckBox("bapteme", new PropertyModel(modelPalanque, "isBapteme")) { @Override protected void onUpdate(AjaxRequestTarget target) { // getIsBapteme = this.getModelObject(); // logger.info("value of getIsBapteme = "+this.getModelObject().toString()); // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }; add(checkBox); //----------------------Le Choix des plongeurs ------------------------ final IModel<ChoiceRenderPlongeur> ddcModel = new PropertyModel<ChoiceRenderPlongeur>(this, "selectedPlongeur"); final DropDownChoice ddc = new DropDownChoice<ChoiceRenderPlongeur>("listPlongeurs", // new PropertyModel(this, "selectedPlongeur"), ddcModel, listPlongeursAInscrireForpalanque, new PlongeurChoiceRenderer("value", "key")) { @Override protected boolean wantOnSelectionChangedNotifications() { return true; } @Override protected void onSelectionChanged(ChoiceRenderPlongeur newSelection) { setSelectedPlongeur(ddcModel.getObject()); } }; ddc.add(new AjaxFormComponentUpdatingBehavior("onchange") { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { } }); ddc.setOutputMarkupId(true); add(ddc); //--------------GUIGE----------------------- final Label labelGuide = new Label("nomGuide", new PropertyModel(modelPalanque, "nomCompletGuide")); labelGuide.setOutputMarkupId(true); add(labelGuide); add(new IndicatingAjaxLink("valideGuide") { @Override public void onClick(AjaxRequestTarget target) { target.addComponent(feedback); if (getGuide() != null) { //on a dja un guide de saisi, donc erreur et on fait rien error("Le guide dj t saisi : " + getGuide().getValue() + " Impossible d'en saisir un autre"); } else if (null == getSelectedPlongeur()) { error("Vous devez d'abord slectionner un plongeur"); } else { setGuide(getSelectedPlongeur()); suppEntreeListPlongeursAInscrire(getGuide()); setSelectedPlongeur(null); target.addComponent(labelGuide); target.addComponent(ddc); } } }); final MarkupContainer containAptGuide = new WebMarkupContainer("containGuide"); Label labelAptGuide = new Label("labelAptGuide", Model.of(new String("aptitude"))); labelAptGuide.setOutputMarkupId(true); containAptGuide.add(labelAptGuide); TextField<String> valueAptPlongeur = new TextField<String>("aptitudePlongeur"); valueAptPlongeur.setOutputMarkupId(true); containAptGuide.add(valueAptPlongeur); containAptGuide.add(new AjaxButton("validAptGuide") { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { Palanque pp = (Palanque) form.getModelObject(); if (null != pp.getAptitudePlongeur()) { ChoiceRenderPlongeur oldGuide = getSelectedPlongeur(); Adherent adh = ResaSession.get().getAdherentService() .rechercherAdherentParIdentifiantTous(getGuide().getKey()); String key = adh.getNumeroLicense(); String value = adh.getNom() + " " + adh.getPrenom() + " " + pp.getAptitudePlongeur(); ChoiceRenderPlongeur newGuide = new ChoiceRenderPlongeur(key, value); //on met le plongeur modifi comme guide setGuide(newGuide); //On supprime "ancien" et "nouveau" plongeur des plongeurs inscrire listPlongeursAInscrireForpalanque.remove(oldGuide); listPlongeursAInscrireForpalanque.remove(newGuide); //On redonne le choix dans la selection du plongeur setSelectedPlongeur(null); // on remet aptitudePlongeur null pour la prochaine fois pp.setAptitudePlongeur(null); } containAptGuide.setVisible(!containAptGuide.isVisible()); target.addComponent(labelGuide); target.addComponent(containAptGuide); target.addComponent(ddc); } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { target.addComponent(feedback); } }); containAptGuide.setVisible(false); containAptGuide.setOutputMarkupId(true); containAptGuide.setOutputMarkupPlaceholderTag(true); add(containAptGuide); add(new IndicatingAjaxLink("modifierGuide") { @Override public void onClick(AjaxRequestTarget target) { target.addComponent(feedback); if (getGuide() == null) { error("Le guide n'est pas saisi "); } else { containAptGuide.setVisible(!containAptGuide.isVisible()); target.addComponent(labelGuide); target.addComponent(containAptGuide); target.addComponent(ddc); } } }); add(new IndicatingAjaxLink("annulerGuide") { @Override public void onClick(AjaxRequestTarget target) { target.addComponent(feedback); if (getGuide() == null) { error("Le guide n'est pas saisi "); } else { addEntreeListPlongeursAInscrire(getGuide()); setGuide(null); setSelectedPlongeur(null); target.addComponent(labelGuide); target.addComponent(ddc); } } }); //--------------PLONGEUR1----------------------- final Label labelPlongeur1 = new Label("nomPlongeur1", new PropertyModel(modelPalanque, "nomCompletPlongeur1")); labelPlongeur1.setOutputMarkupId(true); add(labelPlongeur1); add(new IndicatingAjaxLink("validePlongeur1") { @Override public void onClick(AjaxRequestTarget target) { target.addComponent(feedback); if (getPlongeur1() != null) { //on a dja un Plongeur1 de saisi, donc erreur et on fait rien error("Le Plongeur1 dj t saisi : " + getPlongeur1().getValue() + " Impossible d'en saisir un autre"); } else if (null == getSelectedPlongeur()) { error("Vous devez d'abord slectionner un plongeur"); } else { setPlongeur1(getSelectedPlongeur()); suppEntreeListPlongeursAInscrire(getPlongeur1()); setSelectedPlongeur(null); target.addComponent(labelPlongeur1); target.addComponent(ddc); } } }); final MarkupContainer containAptPlongeur1 = new WebMarkupContainer("containPlongeur1"); Label labelAptPlongeur1 = new Label("labelAptPlongeur1", Model.of(new String("aptitude"))); labelAptPlongeur1.setOutputMarkupId(true); containAptPlongeur1.add(labelAptPlongeur1); TextField<String> valueAptPlongeur1 = new TextField<String>("aptitudePlongeur"); valueAptPlongeur1.setOutputMarkupId(true); containAptPlongeur1.add(valueAptPlongeur1); containAptPlongeur1.add(new AjaxButton("validAptPlongeur1") { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { Palanque pp = (Palanque) form.getModelObject(); if (null != pp.getAptitudePlongeur()) { ChoiceRenderPlongeur oldPlongeur1 = getSelectedPlongeur(); Adherent adh = ResaSession.get().getAdherentService() .rechercherAdherentParIdentifiantTous(getPlongeur1().getKey()); String key = adh.getNumeroLicense(); String value = adh.getNom() + " " + adh.getPrenom() + " " + pp.getAptitudePlongeur(); ChoiceRenderPlongeur newPlongeur1 = new ChoiceRenderPlongeur(key, value); //on met le plongeur modifi setPlongeur1(newPlongeur1); //On supprime "ancien" et "nouveau" plongeur des plongeurs inscrire listPlongeursAInscrireForpalanque.remove(oldPlongeur1); listPlongeursAInscrireForpalanque.remove(newPlongeur1); //On redonne le choix dans la selection du plongeur setSelectedPlongeur(null); // on remet aptitudePlongeur null pour la prochaine fois pp.setAptitudePlongeur(null); } containAptPlongeur1.setVisible(!containAptPlongeur1.isVisible()); target.addComponent(labelPlongeur1); target.addComponent(containAptPlongeur1); target.addComponent(ddc); } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { target.addComponent(feedback); } }); containAptPlongeur1.setVisible(false); containAptPlongeur1.setOutputMarkupId(true); containAptPlongeur1.setOutputMarkupPlaceholderTag(true); add(containAptPlongeur1); add(new IndicatingAjaxLink("modifierPlongeur1") { @Override public void onClick(AjaxRequestTarget target) { target.addComponent(feedback); if (getPlongeur1() == null) { error("Le plongeur1 n'est pas saisi "); } else { containAptPlongeur1.setVisible(!containAptPlongeur1.isVisible()); target.addComponent(labelPlongeur1); target.addComponent(containAptPlongeur1); target.addComponent(ddc); } } }); add(new IndicatingAjaxLink("annulerPlongeur1") { @Override public void onClick(AjaxRequestTarget target) { target.addComponent(feedback); if (getPlongeur1() == null) { error("Le Plongeur1 n'est pas saisi "); } else { addEntreeListPlongeursAInscrire(getPlongeur1()); setPlongeur1(null); setSelectedPlongeur(null); target.addComponent(labelPlongeur1); target.addComponent(ddc); } } }); //--------------PLONGEUR2----------------------- final Label labelPlongeur2 = new Label("nomPlongeur2", new PropertyModel(modelPalanque, "nomCompletPlongeur2")); labelPlongeur2.setOutputMarkupId(true); add(labelPlongeur2); add(new IndicatingAjaxLink("validePlongeur2") { @Override public void onClick(AjaxRequestTarget target) { target.addComponent(feedback); if (getPlongeur2() != null) { //on a dja un Plongeur2 de saisi, donc erreur et on fait rien error("Le Plongeur2 dj t saisi : " + getPlongeur2().getValue() + " Impossible d'en saisir un autre"); } else if (null == getSelectedPlongeur()) { error("Vous devez d'abord slectionner un plongeur"); } else { setPlongeur2(getSelectedPlongeur()); suppEntreeListPlongeursAInscrire(getPlongeur2()); setSelectedPlongeur(null); target.addComponent(labelPlongeur2); target.addComponent(ddc); } } }); final MarkupContainer containAptPlongeur2 = new WebMarkupContainer("containPlongeur2"); Label labelAptPlongeur2 = new Label("labelAptPlongeur2", Model.of(new String("aptitude"))); labelAptPlongeur2.setOutputMarkupId(true); containAptPlongeur2.add(labelAptPlongeur2); TextField<String> valueAptPlongeur2 = new TextField<String>("aptitudePlongeur"); valueAptPlongeur2.setOutputMarkupId(true); containAptPlongeur2.add(valueAptPlongeur2); containAptPlongeur2.add(new AjaxButton("validAptPlongeur2") { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { Palanque pp = (Palanque) form.getModelObject(); if (null != pp.getAptitudePlongeur()) { ChoiceRenderPlongeur oldPlongeur2 = getSelectedPlongeur(); Adherent adh = ResaSession.get().getAdherentService() .rechercherAdherentParIdentifiantTous(getPlongeur2().getKey()); String key = adh.getNumeroLicense(); String value = adh.getNom() + " " + adh.getPrenom() + " " + pp.getAptitudePlongeur(); ChoiceRenderPlongeur newPlongeur2 = new ChoiceRenderPlongeur(key, value); //on met le plongeur modifi setPlongeur2(newPlongeur2); //On supprime "ancien" et "nouveau" plongeur des plongeurs inscrire listPlongeursAInscrireForpalanque.remove(oldPlongeur2); listPlongeursAInscrireForpalanque.remove(newPlongeur2); //On redonne le choix dans la selection du plongeur setSelectedPlongeur(null); // on remet aptitudePlongeur null pour la prochaine fois pp.setAptitudePlongeur(null); } containAptPlongeur2.setVisible(!containAptPlongeur2.isVisible()); target.addComponent(labelPlongeur2); target.addComponent(containAptPlongeur2); target.addComponent(ddc); } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { target.addComponent(feedback); } }); containAptPlongeur2.setVisible(false); containAptPlongeur2.setOutputMarkupId(true); containAptPlongeur2.setOutputMarkupPlaceholderTag(true); add(containAptPlongeur2); add(new IndicatingAjaxLink("modifierPlongeur2") { @Override public void onClick(AjaxRequestTarget target) { target.addComponent(feedback); if (getPlongeur2() == null) { error("Le plongeur2 n'est pas saisi "); } else { containAptPlongeur2.setVisible(!containAptPlongeur2.isVisible()); target.addComponent(labelPlongeur2); target.addComponent(containAptPlongeur2); target.addComponent(ddc); } } }); add(new IndicatingAjaxLink("annulerPlongeur2") { @Override public void onClick(AjaxRequestTarget target) { target.addComponent(feedback); if (getPlongeur2() == null) { error("Le Plongeur2 n'est pas saisi "); } else { addEntreeListPlongeursAInscrire(getPlongeur2()); setPlongeur2(null); setSelectedPlongeur(null); target.addComponent(labelPlongeur2); target.addComponent(ddc); } } }); //--------------PLONGEUR3----------------------- final Label labelPlongeur3 = new Label("nomPlongeur3", new PropertyModel(modelPalanque, "nomCompletPlongeur3")); labelPlongeur3.setOutputMarkupId(true); add(labelPlongeur3); add(new IndicatingAjaxLink("validePlongeur3") { @Override public void onClick(AjaxRequestTarget target) { target.addComponent(feedback); if (getPlongeur3() != null) { //on a dja un Plongeur3 de saisi, donc erreur et on fait rien error("Le Plongeur3 dj t saisi : " + getPlongeur3().getValue() + " Impossible d'en saisir un autre"); } else if (null == getSelectedPlongeur()) { error("Vous devez d'abord slectionner un plongeur"); } else { setPlongeur3(getSelectedPlongeur()); suppEntreeListPlongeursAInscrire(getPlongeur3()); setSelectedPlongeur(null); target.addComponent(labelPlongeur3); target.addComponent(ddc); } } }); final MarkupContainer containAptPlongeur3 = new WebMarkupContainer("containPlongeur3"); Label labelAptPlongeur3 = new Label("labelAptPlongeur3", Model.of(new String("aptitude"))); labelAptPlongeur3.setOutputMarkupId(true); containAptPlongeur3.add(labelAptPlongeur3); TextField<String> valueAptPlongeur3 = new TextField<String>("aptitudePlongeur"); valueAptPlongeur3.setOutputMarkupId(true); containAptPlongeur3.add(valueAptPlongeur3); containAptPlongeur3.add(new AjaxButton("validAptPlongeur3") { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { Palanque pp = (Palanque) form.getModelObject(); if (null != pp.getAptitudePlongeur()) { ChoiceRenderPlongeur oldPlongeur3 = getSelectedPlongeur(); Adherent adh = ResaSession.get().getAdherentService() .rechercherAdherentParIdentifiantTous(getPlongeur3().getKey()); String key = adh.getNumeroLicense(); String value = adh.getNom() + " " + adh.getPrenom() + " " + pp.getAptitudePlongeur(); ChoiceRenderPlongeur newPlongeur3 = new ChoiceRenderPlongeur(key, value); //on met le plongeur modifi setPlongeur3(newPlongeur3); //On supprime "ancien" et "nouveau" plongeur des plongeurs inscrire listPlongeursAInscrireForpalanque.remove(oldPlongeur3); listPlongeursAInscrireForpalanque.remove(newPlongeur3); //On redonne le choix dans la selection du plongeur setSelectedPlongeur(null); // on remet aptitudePlongeur null pour la prochaine fois pp.setAptitudePlongeur(null); } containAptPlongeur3.setVisible(!containAptPlongeur3.isVisible()); target.addComponent(labelPlongeur3); target.addComponent(containAptPlongeur3); target.addComponent(ddc); } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { target.addComponent(feedback); } }); containAptPlongeur3.setVisible(false); containAptPlongeur3.setOutputMarkupId(true); containAptPlongeur3.setOutputMarkupPlaceholderTag(true); add(containAptPlongeur3); add(new IndicatingAjaxLink("modifierPlongeur3") { @Override public void onClick(AjaxRequestTarget target) { target.addComponent(feedback); if (getPlongeur3() == null) { error("Le plongeur3 n'est pas saisi "); } else { containAptPlongeur3.setVisible(!containAptPlongeur3.isVisible()); target.addComponent(labelPlongeur3); target.addComponent(containAptPlongeur3); target.addComponent(ddc); } } }); add(new IndicatingAjaxLink("annulerPlongeur3") { @Override public void onClick(AjaxRequestTarget target) { target.addComponent(feedback); if (getPlongeur3() == null) { error("Le Plongeur3 n'est pas saisi "); } else { addEntreeListPlongeursAInscrire(getPlongeur3()); setPlongeur3(null); setSelectedPlongeur(null); target.addComponent(labelPlongeur3); target.addComponent(ddc); } } }); //--------------PLONGEUR4----------------------- final Label labelPlongeur4 = new Label("nomPlongeur4", new PropertyModel(modelPalanque, "nomCompletPlongeur4")); labelPlongeur4.setOutputMarkupId(true); add(labelPlongeur4); add(new IndicatingAjaxLink("validePlongeur4") { @Override public void onClick(AjaxRequestTarget target) { target.addComponent(feedback); if (getPlongeur4() != null) { //on a dja un Plongeur4 de saisi, donc erreur et on fait rien error("Le Plongeur4 dj t saisi : " + getPlongeur4().getValue() + " Impossible d'en saisir un autre"); } else if (null == getSelectedPlongeur()) { error("Vous devez d'abord slectionner un plongeur"); } else { setPlongeur4(getSelectedPlongeur()); suppEntreeListPlongeursAInscrire(getPlongeur4()); setSelectedPlongeur(null); target.addComponent(labelPlongeur4); target.addComponent(ddc); } } }); final MarkupContainer containAptPlongeur4 = new WebMarkupContainer("containPlongeur4"); Label labelAptPlongeur4 = new Label("labelAptPlongeur4", Model.of(new String("aptitude"))); labelAptPlongeur4.setOutputMarkupId(true); containAptPlongeur4.add(labelAptPlongeur4); TextField<String> valueAptPlongeur4 = new TextField<String>("aptitudePlongeur"); valueAptPlongeur4.setOutputMarkupId(true); containAptPlongeur4.add(valueAptPlongeur4); containAptPlongeur4.add(new AjaxButton("validAptPlongeur4") { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { Palanque pp = (Palanque) form.getModelObject(); if (null != pp.getAptitudePlongeur()) { ChoiceRenderPlongeur oldPlongeur4 = getSelectedPlongeur(); Adherent adh = ResaSession.get().getAdherentService() .rechercherAdherentParIdentifiantTous(getPlongeur4().getKey()); String key = adh.getNumeroLicense(); String value = adh.getNom() + " " + adh.getPrenom() + " " + pp.getAptitudePlongeur(); ChoiceRenderPlongeur newPlongeur4 = new ChoiceRenderPlongeur(key, value); //on met le plongeur modifi comme guide setPlongeur4(newPlongeur4); //On supprime "ancien" et "nouveau" plongeur des plongeurs inscrire listPlongeursAInscrireForpalanque.remove(oldPlongeur4); listPlongeursAInscrireForpalanque.remove(newPlongeur4); //On redonne le choix dans la selection du plongeur setSelectedPlongeur(null); // on remet aptitudePlongeur null pour la prochaine fois pp.setAptitudePlongeur(null); } containAptPlongeur4.setVisible(!containAptPlongeur4.isVisible()); target.addComponent(labelPlongeur4); target.addComponent(containAptPlongeur4); target.addComponent(ddc); } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { target.addComponent(feedback); } }); containAptPlongeur4.setVisible(false); containAptPlongeur4.setOutputMarkupId(true); containAptPlongeur4.setOutputMarkupPlaceholderTag(true); add(containAptPlongeur4); add(new IndicatingAjaxLink("modifierPlongeur4") { @Override public void onClick(AjaxRequestTarget target) { target.addComponent(feedback); if (getPlongeur4() == null) { error("Le plongeur4 n'est pas saisi "); } else { containAptPlongeur4.setVisible(!containAptPlongeur4.isVisible()); target.addComponent(labelPlongeur4); target.addComponent(containAptPlongeur4); target.addComponent(ddc); } } }); add(new IndicatingAjaxLink("annulerPlongeur4") { @Override public void onClick(AjaxRequestTarget target) { target.addComponent(feedback); if (getPlongeur4() == null) { error("Le Plongeur4 n'est pas saisi "); } else { addEntreeListPlongeursAInscrire(getPlongeur4()); setPlongeur4(null); setSelectedPlongeur(null); target.addComponent(labelPlongeur4); target.addComponent(ddc); } } }); //-----------------Profondeur Maxi-------------------------- TextField pMaxPrevu = new TextField<Integer>("profondeurMaxPrevue", Integer.class); pMaxPrevu.add(new MaximumValidator<Integer>(60)); pMaxPrevu.add(new MinimumValidator<Integer>(0)); add(pMaxPrevu); TextField pMaxRea = new TextField<Integer>("profondeurMaxRea", Integer.class); pMaxRea.add(new MaximumValidator<Integer>(60)); pMaxRea.add(new MinimumValidator<Integer>(0)); add(pMaxRea); //-----------------Dure de la plonge-------------------------- TextField dureePrevu = new TextField<Integer>("dureeTotalePrevue", Integer.class); add(dureePrevu); TextField dureeRea = new TextField<Integer>("dureeTotaleRea", Integer.class); add(dureeRea); //-----------------Paliers-------------------------- TextField palier3 = new TextField<Integer>("palier3m", Integer.class); palier3.add(new MinimumValidator<Integer>(0)); add(palier3); TextField palier6 = new TextField<Integer>("palier6m", Integer.class); palier6.add(new MinimumValidator<Integer>(0)); add(palier6); TextField palier9 = new TextField<Integer>("palier9m", Integer.class); palier9.add(new MinimumValidator<Integer>(0)); add(palier9); TextField palierP = new TextField<Integer>("palierProfond", Integer.class); palierP.add(new MinimumValidator<Integer>(0)); add(palierP); //-----------------Heure de sortie TextField heureSortie = new TextField<Integer>("hhSortie", Integer.class); heureSortie.add(new MaximumValidator<Integer>(24)); heureSortie.add(new MinimumValidator<Integer>(0)); add(heureSortie); TextField minuteSortie = new TextField<Integer>("mnSortie", Integer.class); minuteSortie.add(new MaximumValidator<Integer>(60)); minuteSortie.add(new MinimumValidator<Integer>(0)); add(minuteSortie); //------------------- Validation de la palanquee AjaxButton b_validerPalanque = new AjaxButton("validerPalanque") { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { Palanque palanqueForm = (Palanque) form.getModelObject(); boolean formatAptitude = true; if (palanqueForm.getListPlongeursPalanque().size() > 0) { for (ChoiceRenderPlongeur crp : palanqueForm.getListPlongeursPalanque()) { if (crp.getValue().contains("/")) { formatAptitude = false; } else { error("Vrifier les aptitudes des plongeurs"); } } } if (formatAptitude) { if (palanqueForm.getListPlongeursPalanque().size() > 0) { //init de l'heure de sortie avec les champs palanqueForm.setHeureSortie(palanqueForm.getHhSortie(), palanqueForm.getMnSortie()); //suppression des plongeurs de la palanque dans les plongeurs inscrire suppPlongeursAInscrire(palanqueForm.getListPlongeursPalanque()); fs.getPalanques().remove(palanque); fs.getPalanques().add(palanqueForm); if (palanqueForm.getIsBapteme()) { // c'est un Bapteme on remet le guide dans la liste des plongeurs inscrire // pour pouvoir le re-inscrire sur une autre palanque if (!listPlongeursAInscrireForpalanque.contains(getGuide())) { listPlongeursAInscrireForpalanque.add(getGuide()); } } //mise jour des plongeurs inscrire en session ResaSession.get().setListPlongeursAInscrire(listPlongeursAInscrireForpalanque); //Retour sur la feuille de saisie pour d'autres palanques eventuelles setResponsePage(new SaisieFicheSecurite(origPage, dateMini, dateMaxi)); } else { error("Cette palanque ne contient aucun plongeur !"); } } } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { target.addComponent(feedback); } }; b_validerPalanque.setOutputMarkupId(true); add(b_validerPalanque); // bouton retour saisie Fiche de securite en reprennant les sauvegardes add(new Link("cancel") { @Override public void onClick() { for (Palanque ps : fs.getPalanques()) { if (ps.getNumero() == palanqueSAV.getNumero()) { fs.getPalanques().set(fs.getPalanques().indexOf(ps), palanqueSAV); break; } } ResaSession.get().setListPlongeursAInscrire(plongeursAInscrireSAV); setResponsePage(new SaisieFicheSecurite(origPage, dateMini, dateMaxi)); } }); }
From source file:com.axway.ats.testexplorer.pages.machines.MachinesPage.java
License:Apache License
public MachinesPage(PageParameters parameters) { super(parameters); machines = getMachines();/* w w w . j av a2s . c o m*/ Label noMachinesLabel = new Label("noMachinesLabel", "There are no machines in database '" + getTESession().getDbName() + "'"); noMachinesLabel.setOutputMarkupId(true); Form<Object> machinesForm = getMachinesForm(noMachinesLabel); add(machinesForm); machineInfoDialog = new WebMarkupContainer("machineInfoDialog"); machineInfoDialog.setVisible(false); machineInfoDialogTitle = new Label("machineInfoDialogTitle", ""); machineInfoDialog.add(machineInfoDialogTitle); machineInfoText = new TextArea<String>("machineInformationText", new Model<String>("")); machineInfoDialog.add(machineInfoText); machineInfoDialog.add(getMachineInfoDialogSaveButton()); machineInfoDialog.add(getMachineInfoDialogCancelButton()); machineInfoDialogForm = new Form<Object>("machineInfoDialogForm"); machineInfoDialogForm.setOutputMarkupId(true); machineInfoDialogForm.add(machineInfoDialog); add(machineInfoDialogForm); }
From source file:com.axway.ats.testexplorer.pages.reports.compare.ComparePage.java
License:Apache License
public ComparePage(PageParameters parameters) { super(parameters); Label noRunsLabel = new Label("noRunsLabel", "No selected runs"); noRunsLabel.setOutputMarkupId(true); Label noTestcasesLabel = new Label("noTestcasesLabel", "No selected testcases"); noTestcasesLabel.setOutputMarkupId(true); Form<Object> itemsToCompareDialog = getItemsToCompareForm(noRunsLabel, noTestcasesLabel); add(itemsToCompareDialog);/*from www.j av a2 s . co m*/ noTestcasesLabel.setVisible(getTESession().getCompareContainer().getTestcases().size() == 0); }
From source file:com.axway.ats.testexplorer.pages.testcase.statistics.BaseStatisticsPanel.java
License:Apache License
public void rememberMachineAliasLabel(Label machineAliasLabel) { machineAliasLabel.setOutputMarkupId(true); globalMachineAliasLabels.add(machineAliasLabel); }
From source file:com.axway.ats.testexplorer.pages.testcase.statistics.DataPanel.java
License:Apache License
/** * Display the collected//from w w w . java 2s .c o m * @param statsForm */ public void displayStatisticDescriptions(Form<Object> statsForm) { boolean isDataPanelVisible = machineDescriptions.size() > 0; List<List<StatisticsTableCell>> rows = new ArrayList<List<StatisticsTableCell>>(); List<StatisticsTableCell> columns = new ArrayList<StatisticsTableCell>(); // add machine columns columns.add(new StatisticsTableCell("<img class=\"arrowUD\" src=\"images/up.png\">", false)); columns.add(new StatisticsTableCell(this.name, false)); for (MachineDescription machine : machineDescriptions) { String machineName = machine.getMachineAlias(); if (SQLServerDbReadAccess.MACHINE_NAME_FOR_ATS_AGENTS.equals(machineName)) { machineName = ""; } StatisticsTableCell cell = new StatisticsTableCell( "<b style=\"padding: 0 5px;\">" + machineName + "</b>", false, "centeredLabel"); cell.cssClass = "fixTableColumn"; columns.add(cell); } rows.add(columns); // add empty row columns = new ArrayList<StatisticsTableCell>(); for (int i = 0; i < 2 + machineDescriptions.size(); i++) { columns.add(NBSP_EMPTY_CELL); } rows.add(columns); final Set<Integer> hiddenRowIndexes = new HashSet<Integer>(); for (StatisticContainer statContainer : statContainers.values()) { List<DbStatisticDescription> statDescriptions = sortQueueItems(statContainer.getStatDescriptions()); String lastStatParent = ""; for (DbStatisticDescription statDescription : statDescriptions) { String statisticLabel = "<span class=\"statName\">" + statDescription.name + "</span><span class=\"statUnit\">(" + statDescription.unit + ")</span>"; // add parent table line if needed String statParent = statDescription.parentName; if (!StringUtils.isNullOrEmpty(statParent) && !statParent.equals(StatisticsPanel.SYSTEM_STATISTIC_CONTAINER) && !lastStatParent.equals(statParent)) { columns = new ArrayList<StatisticsTableCell>(); columns.add(NBSP_EMPTY_CELL); if (statParent.startsWith(PROCESS_STAT_PREFIX)) { // only Process parent element can hide its children (it is not a good idea to hide the User actions behind queue names) columns.add(new StatisticsTableCell( "<a href=\"#\" onclick=\"showHiddenStatChildren(this);return false;\">" + statParent + "</a>", false, "parentStatTd")); } else { columns.add(new StatisticsTableCell(statParent, false, "parentStatTd")); } for (int i = 0; i < machineDescriptions.size(); i++) { columns.add(NBSP_EMPTY_CELL); } rows.add(columns); } lastStatParent = statParent; columns = new ArrayList<StatisticsTableCell>(); columns.add(new StatisticsTableCell(true)); StatisticsTableCell statName = new StatisticsTableCell(statisticLabel, true); statName.title = statDescription.params; columns.add(statName); for (MachineDescription machine : machineDescriptions) { Model<Boolean> selectionModel = machine.getStatDescriptionSelectionModel(statDescription); // selectionModel.getObject() should sometimes return // NULL - when comparing with other testcases if (selectionModel != null && selectionModel.getObject() != null) { columns.add(new StatisticsTableCell(selectionModel)); } else { columns.add(EMPTY_CELL); } } // hide only the Process child elements if (!StringUtils.isNullOrEmpty(lastStatParent) && lastStatParent.startsWith(PROCESS_STAT_PREFIX)) { // add current row number as a child row which must be hidden hiddenRowIndexes.add(rows.size()); } rows.add(columns); } } statisticsUIContainer = new ListView<List<StatisticsTableCell>>(uiPrefix + "StatsRows", rows) { private static final long serialVersionUID = 1L; @Override protected void populateItem(ListItem<List<StatisticsTableCell>> item) { // table TR if (item.getIndex() == 0) { item.add(AttributeModifier.replace("class", "statisticsHeaderRow")); item.add(AttributeModifier.replace("onclick", "showOrHideTableRows('" + uiPrefix + "StatsTable',1,true);")); } else if (item.getIndex() > 3) { // skip the machines,label and // measurement rows item.add(AttributeModifier.replace("class", "statisticRow")); } if (hiddenRowIndexes.contains(item.getIndex())) { item.add(new AttributeAppender("class", new Model<String>("hiddenStatRow"), " ")); } item.add(new ListView<StatisticsTableCell>(uiPrefix + "StatsColumns", item.getModelObject()) { private static final long serialVersionUID = 1L; @Override protected void populateItem(ListItem<StatisticsTableCell> item) { // table TD if (item.getIndex() > 0) { // skip the first (CheckBox) // column item.add(AttributeModifier.replace("class", "statisticColumn")); } StatisticsTableCell cell = item.getModelObject(); CheckBox checkBox = new CheckBox("checkbox", cell.checkboxModel); if (cell.isCheckbox) { if (item.getIndex() == 0) { // this is the first/main CheckBox // binding onclick function which will (un)select all the CheckBoxes on that row // and will change the line color if it is selected or not checkBox.add(AttributeModifier.replace("onclick", "selectAllCheckboxes(this,'" + uiPrefix + "StatsTable');")); checkBox.add(AttributeModifier.replace("class", "allMachinesCheckbox")); } else { // binding onclick function which will (un)select the main/first CheckBox on that row // when all the CheckBoxes are selected or some are unselected. // Also the row/cell color will be changed. checkBox.add(AttributeModifier.replace("onclick", "unselectMainTrCheckbox(this,'" + uiPrefix + "StatsTable');")); checkBox.add(AttributeModifier.replace("class", "machineCheckbox")); item.add(AttributeModifier.replace("class", "statisticColumnWithCheckboxOnly")); } } else { checkBox.setVisible(false); } item.add(checkBox); Label label = new Label("label", cell.labelText); label.setEscapeModelStrings(false).setVisible(!cell.isCheckbox && !cell.isInputText); if (cell.isCheckboxLabel) { // binding JavaScript function which will click on the first/main CheckBox of this statistic label.add(AttributeModifier.replace("onclick", "clickSelectAllCheckbox(this);")); label.add(AttributeModifier.replace("class", "checkboxLabel noselection")); if (cell.title != null && !cell.title.isEmpty()) { String title = cell.title; int readingStartIndex = cell.title.indexOf(PARAMS_READING_UNIQUENESS_MAKRER); if (readingStartIndex > 0) { title = cell.title.substring(0, readingStartIndex) + cell.title.substring(cell.title.indexOf("_", readingStartIndex + 1)); } label.add(AttributeModifier.replace("title", title.replace("_", ", ").trim())); } } else if (label.isVisible() && cell.cssClass != null) { label.add(AttributeModifier.replace("class", cell.cssClass)); } item.add(label); Label machineAliasLabel = new Label("inputText", cell.getMachineLabelModel()); machineAliasLabel.setVisible(cell.isInputText); if (cell.getMachineLabelModel() != null && cell.getMachineLabelModel().getObject() != null) { machineAliasLabel.setOutputMarkupId(true); machineAliasLabel.add( AttributeModifier.replace("title", cell.getMachineLabelModel().getObject())); globalPanel.rememberMachineAliasLabel(machineAliasLabel); } item.add(machineAliasLabel); } }); } }; statisticsUIContainer.setVisible(isDataPanelVisible); statsForm.add(statisticsUIContainer); }
From source file:com.comcast.cdn.traffic_control.traffic_monitor.Index.java
License:Apache License
public Index() { final Behavior updater = new MultiUpdatingTimerBehavior(Duration.seconds(1));//AjaxSelfUpdatingTimerBehavior final Model<Integer> serverListSize = getServerListSizeModel(); final Label servers_count = new Label("servers_count", serverListSize); servers_count.setOutputMarkupId(true); add(servers_count);/*from w ww . j a v a 2s. com*/ final Label servers_down = new Label("servers_down", getServersDownModel()); servers_down.add(updater); add(servers_down); final Label totalBandwidth = new Label("totalBandwidth", getCacheStateSumModel("kbps")); totalBandwidth.add(updater); add(totalBandwidth); final Label totalBandwidthAvailable = new Label("totalBandwidthAvailable", getCacheStateSumModel("maxKbps")); totalBandwidthAvailable.add(updater); add(totalBandwidthAvailable); add(new Label("version", new Model<String>(getVersionStr()))); final Label source = new Label("source", getSourceModel()); source.add(updater); add(source); final Component[] updateList = new Component[] { servers_count }; //graph, final Label servers_available = new Label("servers_available", getServersAvailableModel()); servers_available.add(updater); add(servers_available); add(new CacheListPanel("serverList", updater, updateList)); add(new EventLogPanel("eventLog")); add(new DsListPanel("dsList", updater, updateList)); add(getTabbedPanel(updater)); }
From source file:com.conwax.ajax.examples.AjaxFallbackLinkPage.java
License:Apache License
public AjaxFallbackLinkPage() { super();// w ww . j ava 2 s. co m final Label label = new Label("label", new PropertyModel<Integer>(this, "counter")); label.setOutputMarkupId(true); add(label); add(new AjaxFallbackLink<Void>("link") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { counter++; if (null != target) { target.add(label); } } }); }