Search in sources :

Example 1 with IndicatorAjaxSubmitLink

use of org.apache.syncope.client.console.wicket.ajax.markup.html.IndicatorAjaxSubmitLink in project syncope by apache.

the class AbstractMultiPanel method getPlusFragment.

private Fragment getPlusFragment(final IModel<List<INNER>> model, final String label) {
    final IndicatorAjaxSubmitLink plus = new IndicatorAjaxSubmitLink("add") {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
            // Add current component
            model.getObject().add(newModelObject());
            if (model.getObject().size() == 1) {
                form.addOrReplace(getDataFragment());
            }
            target.add(container);
        }

        @Override
        protected void onError(final AjaxRequestTarget target, final Form<?> form) {
            SyncopeConsoleSession.get().error(getString(Constants.OPERATION_ERROR));
            super.onError(target, form);
            ((BasePage) getPage()).getNotificationPanel().refresh(target);
        }
    };
    final Fragment fragment = new Fragment("panelPlus", "fragmentPlus", AbstractMultiPanel.this);
    fragment.addOrReplace(plus);
    fragment.setRenderBodyOnly(true);
    return fragment;
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Form(org.apache.wicket.markup.html.form.Form) IndicatorAjaxSubmitLink(org.apache.syncope.client.console.wicket.ajax.markup.html.IndicatorAjaxSubmitLink) Fragment(org.apache.wicket.markup.html.panel.Fragment)

Aggregations

IndicatorAjaxSubmitLink (org.apache.syncope.client.console.wicket.ajax.markup.html.IndicatorAjaxSubmitLink)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 Form (org.apache.wicket.markup.html.form.Form)1 Fragment (org.apache.wicket.markup.html.panel.Fragment)1