List of usage examples for org.apache.wicket.markup.html.list ListItem getDefaultModel
IModel<?> getDefaultModel();
From source file:com.mycompany.CheckGroupPage.java
License:Apache License
/** * Constructor//from w w w .j a va2 s. c om */ public CheckGroupPage() { final CheckGroup<Person> group = new CheckGroup<Person>("group", new ArrayList<Person>()); group.setRenderBodyOnly(false); group.setOutputMarkupId(true); Form<?> form = new Form("form") { @Override protected void onSubmit() { info("selected person(s): " + group.getDefaultModelObjectAsString()); } }; form.add(new AjaxSubmitLink("testtest") { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { List personsList = getPersons(); Collections.shuffle(personsList); target.add(group.replace(persons.setList(personsList))); } }); add(form); form.add(group); group.add(new CheckGroupSelector("groupselector")); persons = new ListView<Person>("persons", getPersons()) { /** * @see * org.apache.wicket.markup.html.list.ListView#populateItem(org.apache.wicket.markup.html.list.ListItem) */ @Override protected void populateItem(ListItem<Person> item) { item.add(new Check<Person>("checkbox", item.getModel())); item.add(new Label("name", new PropertyModel<String>(item.getDefaultModel(), "name"))); item.add(new Label("lastName", new PropertyModel<String>(item.getDefaultModel(), "lastName"))); } }; group.add(new AjaxSubmitLink("linkSubmiter") { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { List personsList = getPersons(); Collections.shuffle(personsList); target.add(group.replace(persons.setList(personsList))); } }); persons.setReuseItems(true); persons.setOutputMarkupId(true); group.add(persons); add(new FeedbackPanel("feedback")); }
From source file:de.alpharogroup.wicket.components.form.checkbox.CheckGroupSelectorPanel.java
License:Apache License
/** * Factory method for creating the new {@link ListView} for the choices. This method is invoked * in the constructor from the derived classes and can be overridden so users can provide their * own version of the new {@link ListView} for the choices. * * @param id//from www. ja va2 s. co m * the id * @param model * the model * @return the new {@link ListView} for the choices. */ protected ListView<T> newChoices(final String id, final IModel<CheckboxModelBean<T>> model) { final ListView<T> choices = new ListView<T>("choices", model.getObject().getChoices()) { /** The serialVersionUID. */ private static final long serialVersionUID = 1L; /** * {@inheritDoc} */ @Override protected void populateItem(final ListItem<T> item) { item.add(new Check<>("checkbox", item.getModel())); item.add(new Label("label", new PropertyModel<String>(item.getDefaultModel(), model.getObject().getLabelPropertyExpression()))); } }; choices.setReuseItems(true); return choices; }
From source file:org.thlim.widgets.multiselection.MultiBoxesSelection.java
License:Apache License
public MultiBoxesSelection(String id, final IModel<? extends List<? extends T>> labelsModel) { super(id);/* w w w. ja va2 s . c o m*/ this.labelsModel = labelsModel; add(container.setOutputMarkupId(true).add()); @SuppressWarnings("unchecked") ListView<T> tile = new ListView<T>("selectionBox", labelsModel) { protected void populateItem(ListItem listItem) { listItem.add(new Label("selectionLabel", listItem.getDefaultModel()).setOutputMarkupId(true)); } }; container.add(tile); container.add(behavior); behavior.setMillisDelay(1000); add(selections); }