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

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

Introduction

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

Prototype

public final Component setRenderBodyOnly(final boolean renderTag) 

Source Link

Document

If false the component's tag will be printed as well as its body (which is default).

Usage

From source file:com.gitblit.wicket.pages.BasePage.java

License:Apache License

private RepeatingView getBottomScriptContainer() {
    RepeatingView bottomScriptContainer = (RepeatingView) get("bottomScripts");
    if (bottomScriptContainer == null) {
        bottomScriptContainer = new RepeatingView("bottomScripts");
        bottomScriptContainer.setRenderBodyOnly(true);
        add(bottomScriptContainer);//from  w  ww .j a  v a 2  s . c  o  m
    }
    return bottomScriptContainer;
}

From source file:com.swordlord.gozer.components.wicket.action.button.list.GWListFilterToolbar.java

License:Open Source License

/**
 * Constructor//from w w w .  jav a  2s . com
 * 
 * @param table
 *            data table this toolbar will be added to
 * @param form
 *            the filter form
 * @param stateLocator
 *            locator responsible for finding object used to store filter's state
 */
public GWListFilterToolbar(final DataTable<?, String> table, final FilterForm form,
        final IFilterStateLocator stateLocator) {
    super(table);

    add(form);

    if (table == null) {
        throw new IllegalArgumentException("argument [table] cannot be null");
    }
    if (stateLocator == null) {
        throw new IllegalArgumentException("argument [stateLocator] cannot be null");
    }

    // populate the toolbar with components provided by filtered columns

    RepeatingView filters = new RepeatingView("filters");
    filters.setRenderBodyOnly(true);
    form.add(filters);

    Iterator<?> it = table.getColumns().iterator();
    while (it.hasNext()) {
        WebMarkupContainer item = new WebMarkupContainer(filters.newChildId());
        item.setRenderBodyOnly(true);

        IColumn<?, String> col = (IColumn<?, String>) it.next();
        Component filter = null;

        if (col instanceof IFilteredColumn) {
            IFilteredColumn<?, String> filteredCol = (IFilteredColumn<?, String>) col;
            filter = filteredCol.getFilter(FILTER_COMPONENT_ID, form);
        }

        if (filter == null) {
            filter = new NoFilter(FILTER_COMPONENT_ID);
        } else {
            if (!filter.getId().equals(FILTER_COMPONENT_ID)) {
                throw new IllegalStateException(
                        "filter component returned  with an invalid component id. invalid component id ["
                                + filter.getId() + "] required component id [" + FILTER_COMPONENT_ID
                                + "] generating column [" + col.toString() + "] ");
            }
        }

        item.add(filter);

        filters.add(item);
    }

}

From source file:org.sakaiproject.sitestats.tool.wicket.pages.ReportsEditPage.java

License:Educational Community License

@SuppressWarnings("serial")
private void renderWhoUI(Form form) {
    List<String> groups = getGroups();
    final RepeatingView selectOptionsRV = new RepeatingView("selectOptionsRV");
    final Select whoUserIds = new MultipleSelect("reportParams.whoUserIds");

    // who      /* w w w. ja v  a  2 s.  c o m*/
    List<String> whoOptions = new ArrayList<String>();
    whoOptions.add(ReportManager.WHO_ALL);
    whoOptions.add(ReportManager.WHO_ROLE);
    whoOptions.add(ReportManager.WHO_CUSTOM);
    whoOptions.add(ReportManager.WHO_NONE);
    if (groups.size() > 0) {
        whoOptions.add(2, ReportManager.WHO_GROUPS);
    }
    IChoiceRenderer whoChoiceRenderer = new IChoiceRenderer() {
        public Object getDisplayValue(Object object) {
            if (ReportManager.WHO_ALL.equals(object)) {
                return new ResourceModel("report_who_all").getObject();
            }
            if (ReportManager.WHO_ROLE.equals(object)) {
                return new ResourceModel("report_who_role").getObject();
            }
            if (ReportManager.WHO_GROUPS.equals(object)) {
                return new ResourceModel("report_who_group").getObject();
            }
            if (ReportManager.WHO_CUSTOM.equals(object)) {
                return new ResourceModel("report_who_custom").getObject();
            }
            if (ReportManager.WHO_NONE.equals(object)) {
                return new ResourceModel("report_who_none").getObject();
            }
            return object;
        }

        public String getIdValue(Object object, int index) {
            return (String) object;
        }
    };
    final IndicatingAjaxDropDownChoice who = new IndicatingAjaxDropDownChoice("reportParams.who", whoOptions,
            whoChoiceRenderer);
    who.add(new AjaxFormComponentUpdatingBehavior("onchange") {
        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            if (ReportManager.WHO_CUSTOM.equals(getReportParams().getWho())) {
                addUsers(selectOptionsRV);
                whoUserIds.add(new AttributeModifier("style", new Model("width: 300px")));
                who.remove(this);
                whoUserIds.add(new AttributeModifier("onchange", new Model("checkWhoSelection();")));
                target.add(who);
                target.add(whoUserIds);
            }
            target.appendJavaScript("checkWhoSelection();");
        }

        @Override
        public CharSequence getCallbackScript() {
            CharSequence ajaxScript = super.getCallbackScript();
            StringBuilder b = new StringBuilder();
            b.append("checkWhoSelection();");
            b.append("if(jQuery('#who').val() == 'who-custom') {;");
            b.append(ajaxScript);
            b.append("}");
            return b.toString();
        }
    });
    who.setMarkupId("who");
    who.setOutputMarkupId(true);
    form.add(who);

    // users
    selectOptionsRV.setRenderBodyOnly(true);
    selectOptionsRV.setEscapeModelStrings(true);
    whoUserIds.add(selectOptionsRV);
    whoUserIds.add(new AttributeModifier("title", new ResourceModel("report_multiple_sel_instruction")));
    whoUserIds.setOutputMarkupId(true);
    whoUserIds.setOutputMarkupPlaceholderTag(true);
    whoUserIds.setEscapeModelStrings(true);
    form.add(whoUserIds);
    boolean preloadData = ReportManager.WHO_CUSTOM.equals(getReportParams().getWho());
    if (preloadData) {
        addUsers(selectOptionsRV);
    }

    // roles
    List<String> roles = getRoles();
    IChoiceRenderer rolesRenderer = new IChoiceRenderer() {
        public Object getDisplayValue(Object object) {
            return (String) object;
        }

        public String getIdValue(Object object, int index) {
            return (String) object;
        }
    };
    Collections.sort(roles, getChoiceRendererComparator(collator, rolesRenderer));
    DropDownChoice whoRoleId = new DropDownChoice("reportParams.whoRoleId", roles, rolesRenderer);
    whoRoleId.setEnabled(roles.size() > 0);
    if (getReportParams().getWhoRoleId() == null) {
        if (roles.size() > 0) {
            getReportParams().setWhoRoleId(roles.get(0));
        } else {
            getReportParams().setWhoRoleId("");
        }
    }
    form.add(whoRoleId);

    // groups
    WebMarkupContainer whoGroupTr = new WebMarkupContainer("who-groups-tr");
    form.add(whoGroupTr);
    IChoiceRenderer groupsRenderer = new IChoiceRenderer() {
        public Object getDisplayValue(Object object) {
            try {
                return Locator.getFacade().getSiteService().getSite(siteId).getGroup((String) object)
                        .getTitle();
            } catch (IdUnusedException e) {
                return (String) object;
            }
        }

        public String getIdValue(Object object, int index) {
            return (String) object;
        }
    };
    Collections.sort(groups, getChoiceRendererComparator(collator, groupsRenderer));
    DropDownChoice whoGroupId = new DropDownChoice("reportParams.whoGroupId", groups, groupsRenderer);
    if (groups.size() == 0) {
        whoGroupTr.setVisible(false);
    } else {
        if (getReportParams().getWhoGroupId() == null) {
            if (groups.size() > 0) {
                getReportParams().setWhoGroupId(groups.get(0));
            } else {
                getReportParams().setWhoGroupId("");
            }
        }
    }
    whoGroupTr.add(whoGroupId);
}

From source file:org.wicketstuff.jmx.markup.html.AbstractOperationPanel.java

License:Apache License

public AbstractOperationPanel(String id, JmxMBeanWrapper bean, final MBeanOperationInfo operation) {
    super(id);//from  www. j  a va  2 s. co m
    setOutputMarkupId(true);
    this.jmxBean = bean;
    this.operation = operation;

    add(new AttributeModifier("style", true, new Model("float: none;")));
    Form form = new Form("form");
    add(form);

    RepeatingView view = new RepeatingView("parameters");
    form.add(view.setRenderBodyOnly(true));

    Map map = new HashMap();
    MBeanParameterInfo[] params = operation.getSignature();
    for (int i = 0; i < params.length; i++) {
        MBeanParameterInfo param = params[i];
        WebMarkupContainer signature = new WebMarkupContainer(view.newChildId());
        IModel model = new PropertyModel(map, param.getName());
        IModel labelModel = new Model(param.getName());

        signature
                .add(new Label("type", param.getType()).add(new SimpleAttributeModifier("class", "paramType")));
        signature.add(
                new Label("paramName", param.getName()).add(new SimpleAttributeModifier("class", "paramName")));
        EditorPanel panel = new EditorPanel("editor", model, labelModel, JmxUtil.getType(param.getType()),
                false);
        signature.add(panel);
        signature.add(new SimpleAttributeModifier("class", "parameter"));
        signature.add(new WebMarkupContainer("paramSeparator").setVisible(i != params.length - 1));
        view.add(signature);
    }

    // this button processes the result of the invocation and accordingly
    // loads a string resource.
    form.add(new OperationExecuteButton("operationName", form, bean, operation, map) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target, Object result) {
            AbstractOperationPanel.this.onOperationExecute(target, result);
        }
    }.add(new Label("label", operation.getName()).setRenderBodyOnly(true)));
}