List of usage examples for org.apache.wicket MarkupContainer add
public MarkupContainer add(final Component... children)
From source file:au.com.scds.isis.viewer.wicket.ui.components.entity.properties.MyEntityPropertiesForm.java
License:Apache License
private boolean addPropertiesInColumn(MarkupContainer markupContainer, MemberGroupLayoutHint hint, ColumnSpans columnSpans) {/*w w w . j a v a 2s . c o m*/ final int span = hint.from(columnSpans); final EntityModel entityModel = (EntityModel) getModel(); final ObjectAdapter adapter = entityModel.getObject(); final ObjectSpecification objSpec = adapter.getSpecification(); final List<ObjectAssociation> associations = visibleProperties(adapter, objSpec, Where.OBJECT_FORMS); final RepeatingView memberGroupRv = new RepeatingView(ID_MEMBER_GROUP); markupContainer.add(memberGroupRv); Map<String, List<ObjectAssociation>> associationsByGroup = ObjectAssociation.Util .groupByMemberOrderName(associations); final List<String> groupNames = ObjectSpecifications.orderByMemberGroups(objSpec, associationsByGroup.keySet(), hint); //TODO remove System.out.println(">>>" + groupNames.toString()); for (String groupName : groupNames) { final List<ObjectAssociation> associationsInGroup = associationsByGroup.get(groupName); if (associationsInGroup == null) { continue; } final WebMarkupContainer memberGroupRvContainer = new WebMarkupContainer(memberGroupRv.newChildId()); memberGroupRv.add(memberGroupRvContainer); memberGroupRvContainer.add(new Label(ID_MEMBER_GROUP_NAME, groupName)); final List<LinkAndLabel> memberGroupActions = Lists.newArrayList(); final RepeatingView propertyRv = new RepeatingView(ID_PROPERTIES); memberGroupRvContainer.add(propertyRv); @SuppressWarnings("unused") Component component; for (final ObjectAssociation association : associationsInGroup) { final WebMarkupContainer propertyRvContainer = new UiHintPathSignificantWebMarkupContainer( propertyRv.newChildId()); propertyRv.add(propertyRvContainer); addPropertyToForm(entityModel, (OneToOneAssociation) association, propertyRvContainer, memberGroupActions); } final List<LinkAndLabel> actionsPanel = LinkAndLabel.positioned(memberGroupActions, ActionLayout.Position.PANEL); final List<LinkAndLabel> actionsPanelDropDown = LinkAndLabel.positioned(memberGroupActions, ActionLayout.Position.PANEL_DROPDOWN); AdditionalLinksPanel.addAdditionalLinks(memberGroupRvContainer, ID_ASSOCIATED_ACTION_LINKS_PANEL, actionsPanel, AdditionalLinksPanel.Style.INLINE_LIST); AdditionalLinksPanel.addAdditionalLinks(memberGroupRvContainer, ID_ASSOCIATED_ACTION_LINKS_PANEL_DROPDOWN, actionsPanelDropDown, AdditionalLinksPanel.Style.DROPDOWN); } addClassForSpan(markupContainer, span); return !groupNames.isEmpty(); }
From source file:au.com.scds.isis.viewer.wicket.ui.components.entity.properties.MyEntityPropertiesForm.java
License:Apache License
private void addButtons(MarkupContainer markupContainer) { // edit button editButton = new AjaxButtonWithOnError(ID_EDIT_BUTTON, new ResourceModel("editLabel")) { private static final long serialVersionUID = 1L; @Override//from w ww . j a v a2 s .co m public void validate() { // same logic as in cancelButton; should this be factored out? try { getEntityModel().load(ConcurrencyChecking.CHECK); } catch (ConcurrencyException ex) { getMessageBroker().addMessage("Object changed by " + ex.getOid().getVersion().getUser() + ", automatically reloading"); getEntityModel().load(ConcurrencyChecking.NO_CHECK); } super.validate(); } @Override public void onSubmit(final AjaxRequestTarget target, final Form<?> form) { getEntityModel().resetPropertyModels(); toEditMode(target); } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); attributes.getAjaxCallListeners().add(new org.apache.wicket.ajax.attributes.AjaxCallListener() { private static final long serialVersionUID = 1L; @Override public CharSequence getSuccessHandler(Component component) { // scroll to the top of the entity panel return "$('html, body').animate({" + " scrollTop: $('.entityIconAndTitlePanel').offset().top" + " }, 1000);"; } }); } }; editButton.add(new Label("editLabel", editButton.getModel())); markupContainer.add(editButton); // ok button okButton = new AjaxButtonForValidate(ID_OK_BUTTON, new ResourceModel("okLabel")); markupContainer.add(okButton); // cancel button cancelButton = new AjaxButtonForCancel(ID_CANCEL_BUTTON, new ResourceModel("cancelLabel")) { private static final long serialVersionUID = 1L; @Override public void validate() { // same logic as in editButton; should this be factored out? try { getEntityModel().load(ConcurrencyChecking.CHECK); } catch (ConcurrencyException ex) { getMessageBroker().addMessage("Object changed by " + ex.getOid().getVersion().getUser() + ", automatically reloading"); getEntityModel().load(ConcurrencyChecking.NO_CHECK); } super.validate(); } @Override protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) { Session.get().getFeedbackMessages().clear(); getForm().clearInput(); getForm().visitFormComponentsPostOrder(new IVisitor<FormComponent<?>, Void>() { @Override public void component(FormComponent<?> formComponent, IVisit<Void> visit) { if (formComponent instanceof CancelHintRequired) { final CancelHintRequired cancelHintRequired = (CancelHintRequired) formComponent; cancelHintRequired.onCancel(); } } }); try { getEntityModel().resetPropertyModels(); } catch (RuntimeException ex) { throw ex; } toViewMode(target); } }; markupContainer.add(cancelButton); okButton.setOutputMarkupPlaceholderTag(true); editButton.setOutputMarkupPlaceholderTag(true); cancelButton.setOutputMarkupPlaceholderTag(true); // flush any JGrowl messages (typically concurrency exceptions) if they // are added. okButton.add(new JGrowlBehaviour()); editButton.add(new JGrowlBehaviour()); cancelButton.add(new JGrowlBehaviour()); }
From source file:com.apachecon.memories.Thumbs.java
License:Apache License
public Thumbs(String id, int maxElems, int rowElements, IModel<List<UserFile>> model) { super(id, model); RepeatingView repeater = new RepeatingView("items"); int itemCount = 0; for (UserFile file : model.getObject()) { MarkupContainer container = new WebMarkupContainer(repeater.newChildId()); Link link = new BookmarkablePageLink("link", Upload.class); link.add(file.createSmallThumb("thumb")); container.add(link); repeater.add(container);//from w w w. j ava2s . c o m if (++itemCount % rowElements == 0) { container.add(AttributeModifier.append("class", "last")); } if (itemCount == maxElems) { break; } } add(repeater); }
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 w w w. j a v a 2s.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.eltiland.ui.course.components.tree.ELTDefaultAbstractTree.java
License:Apache License
/** * Creates the junction link for given node. Also (optionally) creates the junction image. If * the node is a leaf (it has no children), the created junction link is non-functional. * * @param parent parent component of the link * @param id wicket:id of the component * @param imageId wicket:id of the image. this can be null, in that case image is not created. image * is supposed to be placed on the link (link is parent of image) * @param node tree node for which the link should be created. * @return The link component/*from www. j a v a 2 s.c o m*/ */ protected Component newJunctionLink(final MarkupContainer parent, final String id, final String imageId, final ELTTreeNode node) { final MarkupContainer junctionLink; if (node.isLeaf() == false) { junctionLink = newLink(parent, id, new ILinkCallback() { private static final long serialVersionUID = 1L; public void onClick(final AjaxRequestTarget target) { if (isNodeExpanded(node)) { getTreeState().collapseNode(node); } else { getTreeState().expandNode(node); } onJunctionLinkClicked(target, node); if (target != null) { updateTree(target); } } }); } else { junctionLink = new WebMarkupContainer(id) { private static final long serialVersionUID = 1L; /** * {@inheritDoc} */ @Override protected void onComponentTag(final ComponentTag tag) { super.onComponentTag(tag); tag.put("onclick", "return false"); } }; } if (imageId != null) { junctionLink.add(newJunctionImage(junctionLink, imageId, node)); } return junctionLink; }
From source file:com.eltiland.ui.course.components.tree.ELTTree.java
License:Apache License
/** * Populates the tree item. It creates all necesary components for the tree to work properly. * // w w w. j av a 2s . co m * @param item * @param level */ @Override protected void populateTreeItem(final WebMarkupContainer item, final int level) { final ELTTreeNode node = (ELTTreeNode) item.getDefaultModelObject(); item.add(newIndentation(item, "indent", (ELTTreeNode) item.getDefaultModelObject(), level)); item.add(newJunctionLink(item, "link", "image", node)); MarkupContainer nodeLink = newNodeLink(item, "nodeLink", node); item.add(nodeLink); nodeLink.add(newNodeIcon(nodeLink, "icon", node)); nodeLink.add(new Label("label", new AbstractReadOnlyModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { return renderNode(node); } })); // do distinguish between selected and unselected rows we add an // behavior // that modifies row css class. item.add(new Behavior() { private static final long serialVersionUID = 1L; /** */ @Override public void onComponentTag(final Component component, final ComponentTag tag) { super.onComponentTag(component, tag); if (getTreeState().isNodeSelected(node)) { tag.put("class", "row-selected"); } else { tag.put("class", "row"); } } }); }
From source file:com.evolveum.midpoint.web.component.objectdetails.AbstractObjectTabPanel.java
License:Apache License
protected void addPrismPropertyPanel(MarkupContainer parentComponent, String id, ItemPath propertyPath) { parentComponent.add(new PrismPropertyPanel(id, new PropertyWrapperFromObjectWrapperModel<PolyString, O>(getObjectWrapperModel(), propertyPath), mainForm, pageBase));//from w ww. ja va 2 s . c om }
From source file:com.gitblit.wicket.pages.TicketPage.java
License:Apache License
protected void addUserAttributions(MarkupContainer container, Change entry, int avatarSize) { UserModel commenter = app().users().getUserModel(entry.author); if (commenter == null) { // unknown user container.add(new AvatarImage("changeAvatar", entry.author, entry.author, null, avatarSize, false) .setVisible(avatarSize > 0)); container.add(new Label("changeAuthor", entry.author.toLowerCase())); } else {/*from w w w .java 2 s. co m*/ // known user container.add(new AvatarImage("changeAvatar", commenter.getDisplayName(), commenter.emailAddress, avatarSize > 24 ? "gravatar-round" : null, avatarSize, true).setVisible(avatarSize > 0)); container.add(new LinkPanel("changeAuthor", null, commenter.getDisplayName(), UserPage.class, WicketUtils.newUsernameParameter(commenter.username))); } }
From source file:com.gitblit.wicket.pages.TicketPage.java
License:Apache License
protected void addDateAttributions(MarkupContainer container, Change entry) { container.add(WicketUtils.createDateLabel("changeDate", entry.date, GitBlitWebSession.get().getTimezone(), getTimeUtils(), false));/* w ww. j ava2 s. c om*/ // set the id attribute if (entry.hasComment()) { container.setOutputMarkupId(true); container.add(new AttributeModifier("id", Model.of(entry.getId()))); ExternalLink link = new ExternalLink("changeLink", "#" + entry.getId()); container.add(link); } else { container.add(new Label("changeLink").setVisible(false)); } }
From source file:com.gitblit.wicket.pages.TicketPage.java
License:Apache License
protected void addGitCheckoutInstructions(UserModel user, RepositoryModel repository, MarkupContainer panel) { panel.add(new Label("gitStep1", MessageFormat.format(getString("gb.stepN"), 1))); panel.add(new Label("gitStep2", MessageFormat.format(getString("gb.stepN"), 2))); String ticketBranch = Repository.shortenRefName(PatchsetCommand.getTicketBranch(ticket.number)); String step1 = "git fetch origin"; String step2 = MessageFormat.format( "git checkout {0} && git pull --ff-only\nOR\ngit checkout {0} && git reset --hard origin/{0}", ticketBranch);//from www . ja v a 2s.c om panel.add(new Label("gitPreStep1", step1)); panel.add(new Label("gitPreStep2", step2)); panel.add(createCopyFragment("gitCopyStep1", step1.replace("\n", " && "))); panel.add(createCopyFragment("gitCopyStep2", step2.replace("\n", " && "))); }