Search in sources :

Example 11 with TransparentWebMarkupContainer

use of org.apache.wicket.markup.html.TransparentWebMarkupContainer in project oc-explorer by devgateway.

the class ListViewSectionPanel method onInitialize.

@Override
protected void onInitialize() {
    super.onInitialize();
    setOutputMarkupId(true);
    setOutputMarkupPlaceholderTag(true);
    listWrapper = new TransparentWebMarkupContainer("listWrapper");
    listWrapper.setOutputMarkupId(true);
    add(listWrapper);
    listWrapper.add(new Label("panelTitle", title));
    listView = new ListView<T>("list", getModel()) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(final ListItem<T> item) {
            // we wrap the item model on a compound model so we can use the field ids as property models
            final CompoundPropertyModel<T> compoundPropertyModel = new CompoundPropertyModel<>(item.getModel());
            // we set back the model as the compound model, thus ensures the rest of the items added will benefit
            item.setModel(compoundPropertyModel);
            // we add the rest of the items in the listItem
            populateCompoundListItem(item);
            // we add the remove button
            final BootstrapDeleteButton removeButton = getRemoveChildButton(item.getIndex());
            item.add(removeButton);
        }
    };
    listView.setReuseItems(true);
    listView.setOutputMarkupId(true);
    listWrapper.add(listView);
    final BootstrapAddButton addButton = getAddNewChildButton();
    add(addButton);
}
Also used : CompoundPropertyModel(org.apache.wicket.model.CompoundPropertyModel) BootstrapDeleteButton(org.devgateway.toolkit.forms.wicket.components.form.BootstrapDeleteButton) BootstrapAddButton(org.devgateway.toolkit.forms.wicket.components.form.BootstrapAddButton) TransparentWebMarkupContainer(org.apache.wicket.markup.html.TransparentWebMarkupContainer) Label(org.apache.wicket.markup.html.basic.Label)

Aggregations

TransparentWebMarkupContainer (org.apache.wicket.markup.html.TransparentWebMarkupContainer)11 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)5 Component (org.apache.wicket.Component)3 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)3 Label (org.apache.wicket.markup.html.basic.Label)3 CompoundPropertyModel (org.apache.wicket.model.CompoundPropertyModel)2 BootstrapAddButton (org.devgateway.toolkit.forms.wicket.components.form.BootstrapAddButton)2 BootstrapDeleteButton (org.devgateway.toolkit.forms.wicket.components.form.BootstrapDeleteButton)2 LeftMenuPanel (com.evolveum.midpoint.gui.impl.component.menu.LeftMenuPanel)1 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 MainPopupDialog (com.evolveum.midpoint.web.component.dialog.MainPopupDialog)1 FeedbackAlerts (com.evolveum.midpoint.web.component.message.FeedbackAlerts)1 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)1 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)1 MarkupContainer (org.apache.wicket.MarkupContainer)1 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)1 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)1 ComponentTag (org.apache.wicket.markup.ComponentTag)1 WebComponent (org.apache.wicket.markup.html.WebComponent)1 ExternalImage (org.apache.wicket.markup.html.image.ExternalImage)1