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);
}
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);
}
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;
}
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;
}
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);
}
}
});
}
Aggregations