Search in sources :

Example 11 with AjaxFormComponentUpdatingBehavior

use of org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior in project midpoint by Evolveum.

the class PageAssignmentsList method initLayout.

public void initLayout() {
    setOutputMarkupId(true);
    Form mainForm = new Form(ID_FORM);
    mainForm.setOutputMarkupId(true);
    add(mainForm);
    AssignmentTablePanel panel = new AssignmentTablePanel<UserType>(ID_ASSIGNMENT_TABLE_PANEL, createStringResource("FocusType.assignment"), assignmentsModel, PageAssignmentsList.this) {

        @Override
        protected List<InlineMenuItem> createAssignmentMenu() {
            List<InlineMenuItem> items = new ArrayList<>();
            InlineMenuItem item = new InlineMenuItem(createStringResource("AssignmentTablePanel.menu.unassign"), new InlineMenuItemAction() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    deleteAssignmentPerformed(target);
                }
            });
            items.add(item);
            return items;
        }
    };
    mainForm.add(panel);
    WebMarkupContainer targetUserPanel = new TargetUserSelectorComponent(ID_TARGET_USER_PANEL, PageAssignmentsList.this);
    targetUserPanel.setOutputMarkupId(true);
    mainForm.add(targetUserPanel);
    TextArea descriptionInput = new TextArea<String>(ID_DESCRIPTION, descriptionModel);
    descriptionInput.add(new AjaxFormComponentUpdatingBehavior("blur") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            getSessionStorage().getRoleCatalog().setRequestDescription(getDescriptionComponent().getValue());
        }
    });
    mainForm.add(descriptionInput);
    AjaxButton back = new AjaxButton(ID_BACK, createStringResource("PageAssignmentDetails.backButton")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            redirectBack();
        }
    };
    mainForm.add(back);
    AjaxSubmitButton requestAssignments = new AjaxSubmitButton(ID_REQUEST_BUTTON, createStringResource("PageAssignmentsList.requestButton")) {

        @Override
        protected void onError(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
            target.add(getFeedbackPanel());
        }

        @Override
        protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
            if (getSessionStorage().getRoleCatalog().getTargetUserList() == null || getSessionStorage().getRoleCatalog().getTargetUserList().size() <= 1) {
                onSingleUserRequestPerformed(target);
            } else {
                onMultiUserRequestPerformed(target);
            }
        }
    };
    requestAssignments.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return getSessionStorage().getRoleCatalog().isMultiUserRequest() || areConflictsResolved();
        }
    });
    mainForm.add(requestAssignments);
    AjaxSubmitButton resolveAssignments = new AjaxSubmitButton(ID_RESOLVE_CONFLICTS_BUTTON, createStringResource("PageAssignmentsList.resolveConflicts")) {

        @Override
        protected void onError(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
            target.add(getFeedbackPanel());
        }

        @Override
        protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
            PageAssignmentsList.this.navigateToNext(PageAssignmentConflicts.class);
        }
    };
    resolveAssignments.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !getSessionStorage().getRoleCatalog().isMultiUserRequest() && getSessionStorage().getRoleCatalog().getConflictsList() != null && getSessionStorage().getRoleCatalog().getConflictsList().size() > 0;
        }
    });
    mainForm.add(resolveAssignments);
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) Form(com.evolveum.midpoint.web.component.form.Form) TextArea(org.apache.wicket.markup.html.form.TextArea) TargetUserSelectorComponent(com.evolveum.midpoint.web.component.assignment.TargetUserSelectorComponent) AssignmentTablePanel(com.evolveum.midpoint.web.component.assignment.AssignmentTablePanel) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 12 with AjaxFormComponentUpdatingBehavior

use of org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior in project midpoint by Evolveum.

the class PageDebugView method addOrReplaceEditor.

private void addOrReplaceEditor() {
    editor = new AceEditor("aceEditor", new PropertyModel<String>(model, ObjectViewDto.F_XML));
    editor.setModeForDataLanguage(dataLanguage);
    editor.add(new AjaxFormComponentUpdatingBehavior("blur") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
        }
    });
    mainForm.addOrReplace(editor);
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) PropertyModel(org.apache.wicket.model.PropertyModel) AceEditor(com.evolveum.midpoint.web.component.AceEditor)

Example 13 with AjaxFormComponentUpdatingBehavior

use of org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior in project ocvn by devgateway.

the class CheckBoxPickerBootstrapFormComponent method inputField.

@Override
protected BootstrapCheckBoxPicker inputField(final String id, final IModel<Boolean> model) {
    config = new BootstrapCheckBoxPickerConfig().withOnClass("btn-info").withOffClass("btn-warning").withOnIcon(FontAwesomeIconType.thumbs_up).withOffIcon(FontAwesomeIconType.thumbs_down).withReverse(true).withStyle(ButtonGroup.Size.Small);
    final BootstrapCheckBoxPicker checkBoxPicker = new BootstrapCheckBoxPicker("field", initFieldModel(), config);
    checkBoxPicker.add(new AjaxFormComponentUpdatingBehavior("change") {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(final AjaxRequestTarget target) {
            CheckBoxPickerBootstrapFormComponent.this.onUpdate(target);
        }
    });
    return checkBoxPicker;
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) BootstrapCheckBoxPickerConfig(de.agilecoders.wicket.extensions.markup.html.bootstrap.form.checkbox.bootstrapcheckbox.BootstrapCheckBoxPickerConfig) BootstrapCheckBoxPicker(de.agilecoders.wicket.extensions.markup.html.bootstrap.form.checkbox.bootstrapcheckbox.BootstrapCheckBoxPicker)

Example 14 with AjaxFormComponentUpdatingBehavior

use of org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior in project ocvn by devgateway.

the class CheckBoxToggleBootstrapFormComponent method inputField.

@Override
protected BootstrapToggle inputField(final String id, final IModel<Boolean> model) {
    config = new BootstrapToggleConfig();
    config.withOnStyle(BootstrapToggleConfig.Style.info).withOffStyle(BootstrapToggleConfig.Style.warning).withStyle("customCssClass");
    final BootstrapToggle checkBoxToggle = new BootstrapToggle("field", initFieldModel(), config) {

        private static final long serialVersionUID = 1L;

        @Override
        protected CheckBox newCheckBox(final String id, final IModel<Boolean> model) {
            wrappedCheckbox = super.newCheckBox(id, model);
            wrappedCheckbox.add(new AjaxFormComponentUpdatingBehavior("change") {

                private static final long serialVersionUID = 1L;

                @Override
                protected void onUpdate(final AjaxRequestTarget target) {
                    CheckBoxToggleBootstrapFormComponent.this.onUpdate(target);
                }
            });
            return wrappedCheckbox;
        }
    };
    return checkBoxToggle;
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IModel(org.apache.wicket.model.IModel) BootstrapToggleConfig(de.agilecoders.wicket.extensions.markup.html.bootstrap.form.checkbox.bootstraptoggle.BootstrapToggleConfig) BootstrapToggle(de.agilecoders.wicket.extensions.markup.html.bootstrap.form.checkbox.bootstraptoggle.BootstrapToggle)

Example 15 with AjaxFormComponentUpdatingBehavior

use of org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior in project gitblit by gitblit.

the class BooleanChoiceOption method setup.

private void setup() {
    add(checkbox);
    add(choice.setMarkupId("choice").setEnabled(choice.getChoices().size() > 0));
    choice.setEnabled(checkbox.getModelObject());
    checkbox.add(new AjaxFormComponentUpdatingBehavior("onchange") {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            choice.setEnabled(checkbox.getModelObject());
            target.addComponent(choice);
            if (!choice.isEnabled()) {
                choice.setModelObject(null);
            }
        }
    });
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget)

Aggregations

AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)32 AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)32 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)17 TextField (org.apache.wicket.markup.html.form.TextField)17 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)16 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)13 Label (org.apache.wicket.markup.html.basic.Label)12 ListItem (org.apache.wicket.markup.html.list.ListItem)9 ListView (org.apache.wicket.markup.html.list.ListView)9 List (java.util.List)8 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)8 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)7 ArrayList (java.util.ArrayList)7 FeedbackPanel (org.apache.wicket.markup.html.panel.FeedbackPanel)7 ComponentFeedbackMessageFilter (org.apache.wicket.feedback.ComponentFeedbackMessageFilter)6 Form (org.apache.wicket.markup.html.form.Form)5 IModel (org.apache.wicket.model.IModel)5 AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)4 AutoCompleteTextField (org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField)4 DropDownChoice (org.apache.wicket.markup.html.form.DropDownChoice)4