Search in sources :

Example 1 with AjaxButton

use of org.apache.wicket.ajax.markup.html.form.AjaxButton in project midpoint by Evolveum.

the class MultipleAssignmentSelectorPanel method initLayout.

private void initLayout(Class<H> targetFocusClass, PageBase page) {
    IModel<List<AssignmentEditorDto>> availableAssignmentModel = createAvailableAssignmentModel();
    final MultipleAssignmentSelector availableAssignmentsPanel = new MultipleAssignmentSelector<F, H>(ID_AVAILABLE_ASSIGNMENTS, availableAssignmentModel, targetFocusClass, type, focus, getFilterModel(true), page);
    final MultipleAssignmentSelector currentAssignmentsPanel = new MultipleAssignmentSelector<F, H>(ID_CURRENT_ASSIGNMENTS, assignmentsModel, targetFocusClass, type, null, getFilterModel(true), page) {

        @Override
        protected List<AssignmentEditorDto> getListProviderDataList() {
            return assignmentsModel.getObject();
        }
    };
    currentAssignmentsPanel.setFilterButtonVisibility(false);
    AjaxButton add = new AjaxButton(ID_BUTTON_ADD) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form form) {
            addToAssignmentsModel(target, availableAssignmentsPanel, currentAssignmentsPanel);
        }
    };
    AjaxButton remove = new AjaxButton(ID_BUTTON_REMOVE) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form form) {
            deleteFromAssignmentsModel(target, currentAssignmentsPanel, availableAssignmentsPanel);
        }
    };
    remove.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_UNASSIGN_ACTION_URL);
        }
    });
    AjaxLink<String> buttonReset = new AjaxLink<String>(ID_BUTTON_RESET) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            reset(currentAssignmentsPanel);
            target.add(currentAssignmentsPanel);
        }
    };
    buttonReset.setBody(createStringResource("MultipleAssignmentSelector.reset"));
    Form<?> form = new Form<Void>(ID_FORM);
    form.add(createTenantContainer());
    form.add(createOrgContainer());
    form.add(availableAssignmentsPanel);
    form.add(currentAssignmentsPanel);
    form.add(buttonReset);
    form.add(add);
    form.add(remove);
    add(form);
}
Also used : Form(com.evolveum.midpoint.web.component.form.Form) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(org.apache.wicket.ajax.markup.html.form.AjaxButton) ArrayList(java.util.ArrayList) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink)

Example 2 with AjaxButton

use of org.apache.wicket.ajax.markup.html.form.AjaxButton in project wicket by apache.

the class PanelEdit method createSubmitButton.

private AjaxButton createSubmitButton() {
    AjaxButton submit = new AjaxButton("submit") {

        protected void onSubmit(AjaxRequestTarget target) {
            Component currentcomponent = PanelEdit.this;
            Component newComponent = new Label(currentcomponent.getId()).setOutputMarkupId(true);
            currentcomponent.replaceWith(newComponent);
            target.add(newComponent);
        }
    };
    return submit;
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(org.apache.wicket.ajax.markup.html.form.AjaxButton) Label(org.apache.wicket.markup.html.basic.Label) Component(org.apache.wicket.Component)

Example 3 with AjaxButton

use of org.apache.wicket.ajax.markup.html.form.AjaxButton in project openmeetings by apache.

the class FormSaveRefreshPanel method onInitialize.

@Override
protected void onInitialize() {
    add(feedback.setOutputMarkupId(true));
    // add a save button that can be used to submit the form via ajax
    add(new AjaxButton("ajax-save-button", form) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            // repaint the feedback panel so that it is hidden
            target.add(feedback);
            onSaveSubmit(target, form);
        }

        @Override
        protected void onError(AjaxRequestTarget target) {
            // repaint the feedback panel so errors are shown
            target.add(feedback);
            onSaveError(target, form);
        }
    });
    // add a refresh button that can be used to submit the form via ajax
    add(new AjaxButton("ajax-refresh-button", form) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            // repaint the feedback panel so that it is hidden
            target.add(feedback);
            hideNewRecord();
            onRefreshSubmit(target, form);
        }

        @Override
        protected void onError(AjaxRequestTarget target) {
            // repaint the feedback panel so errors are shown
            target.add(feedback);
            hideNewRecord();
            onRefreshError(target, form);
        }
    });
    super.onInitialize();
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(org.apache.wicket.ajax.markup.html.form.AjaxButton)

Example 4 with AjaxButton

use of org.apache.wicket.ajax.markup.html.form.AjaxButton in project openmeetings by apache.

the class AdminSavePanel method onInitialize.

@Override
protected void onInitialize() {
    newRecord.setDefaultModelObject(getString("155"));
    add(newRecord.setVisible(false).setOutputMarkupId(true));
    final AjaxButton newBtn = new AjaxButton("ajax-new-button", form) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            // repaint the feedback panel so that it is hidden
            target.add(feedback);
            newRecord.setVisible(true);
            target.add(newRecord);
            onNewSubmit(target, form);
        }

        @Override
        protected void onError(AjaxRequestTarget target) {
            // repaint the feedback panel so errors are shown
            target.add(feedback);
            onNewError(target, form);
        }
    };
    // add a cancel button that can be used to submit the form via ajax
    final Form<?> cForm = new Form<>("form");
    cForm.setMultiPart(form.isMultiPart());
    add(cForm);
    final ConfirmableAjaxBorder delBtn = new ConfirmableAjaxBorder("ajax-cancel-button", getString("80"), getString("833"), cForm) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onError(AjaxRequestTarget target) {
            // repaint the feedback panel so errors are shown
            target.add(feedback);
            hideNewRecord();
            onDeleteError(target, form);
        }

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            // repaint the feedback panel so that it is hidden
            target.add(feedback);
            hideNewRecord();
            onDeleteSubmit(target, form);
        }
    };
    add(newBtn.setVisible(isNewBtnVisible()), delBtn.setVisible(isDelBtnVisible()));
    super.onInitialize();
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(org.apache.wicket.ajax.markup.html.form.AjaxButton) Form(org.apache.wicket.markup.html.form.Form) ConfirmableAjaxBorder(org.apache.openmeetings.web.common.ConfirmableAjaxBorder)

Example 5 with AjaxButton

use of org.apache.wicket.ajax.markup.html.form.AjaxButton in project sandbox by irof.

the class StatefulPage method onInitialize.

@Override
protected void onInitialize() {
    super.onInitialize();
    add(new Label("code", code));
    add(new Label("instance", this.toString()));
    Form<Void> form = new Form<>("form");
    form.add(new Label("count", count));
    form.add(new AjaxButton("ajaxButton") {

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            Integer prev = count.getObject();
            count.setObject(prev + 1);
            target.add(form);
        }
    });
    form.add(new Button("button") {

        @Override
        public void onSubmit() {
            setResponsePage(StatefulPage.class);
        }
    });
    form.setOutputMarkupId(true);
    add(form);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(org.apache.wicket.ajax.markup.html.form.AjaxButton) Form(org.apache.wicket.markup.html.form.Form) Button(org.apache.wicket.markup.html.form.Button) AjaxButton(org.apache.wicket.ajax.markup.html.form.AjaxButton) Label(org.apache.wicket.markup.html.basic.Label)

Aggregations

AjaxButton (org.apache.wicket.ajax.markup.html.form.AjaxButton)13 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)12 Form (org.apache.wicket.markup.html.form.Form)10 Label (org.apache.wicket.markup.html.basic.Label)5 ArrayList (java.util.ArrayList)3 UserModel (com.gitblit.models.UserModel)2 RepositoryException (javax.jcr.RepositoryException)2 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)2 Form (com.evolveum.midpoint.web.component.form.Form)1 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)1 AccessPermission (com.gitblit.Constants.AccessPermission)1 Transport (com.gitblit.Constants.Transport)1 GitBlitException (com.gitblit.GitBlitException)1 RepositoryModel (com.gitblit.models.RepositoryModel)1 TicketModel (com.gitblit.models.TicketModel)1 Change (com.gitblit.models.TicketModel.Change)1 SshKey (com.gitblit.transport.ssh.SshKey)1 BasePage (com.gitblit.wicket.pages.BasePage)1 BooleanOption (com.gitblit.wicket.panels.BooleanOption)1 TextOption (com.gitblit.wicket.panels.TextOption)1