Example usage for org.apache.wicket.markup.repeater RepeatingView addOrReplace

List of usage examples for org.apache.wicket.markup.repeater RepeatingView addOrReplace

Introduction

In this page you can find the example usage for org.apache.wicket.markup.repeater RepeatingView addOrReplace.

Prototype

public MarkupContainer addOrReplace(final Component... children) 

Source Link

Document

Replaces a child component of this container with another or just adds it in case no child with the same id existed yet.

Usage

From source file:com.premiumminds.wicket.crudifier.view.CrudifierView.java

License:Open Source License

@Override
protected void onConfigure() {
    RepeatingView view = new RepeatingView("control");
    if (null != getModelObject()) {
        for (final String property : getPropertiesByOrder(getModelObject().getClass())) {
            WebMarkupContainer control = new WebMarkupContainer(view.newChildId());
            view.addOrReplace(control);

            control.addOrReplace(new Label("label",
                    new StringResourceModel("controls." + property + ".label", this, getModel(), property)));
            control.addOrReplace(/* w  w  w  . j  a va  2  s  .  c  om*/
                    new LabelProperty("input", new PropertyModel<Object>(getModel(), property), renderers) {
                        private static final long serialVersionUID = 8561120757563362569L;

                        @Override
                        protected String getResourceString(String key, String defaultValue) {
                            return getLocalizer().getStringIgnoreSettings("controls." + property + "." + key,
                                    CrudifierView.this, null, defaultValue);
                        }
                    });
        }
    }
    addOrReplace(view);
}

From source file:org.xaloon.wicket.component.page.AbstractWebPage.java

License:Apache License

public void initHTMLHead(String prefix) {
    add(new Label("title", prefix + getString("title")));
    add(new MetaTagWebContainer("keywords", new Model<String>(getDefaultString("keywords"))));
    add(new MetaTagWebContainer("description", new Model<String>(getDefaultString("description"))));
    RepeatingView repeating = new RepeatingView("meta");
    for (Component metaTag : newTagList()) {
        WebMarkupContainer wmc = new WebMarkupContainer(repeating.newChildId());
        repeating.addOrReplace(wmc);
        wmc.add(metaTag);//from  w  w  w .  j a v a 2  s .  c  o  m
    }
    add(repeating);
}