use of org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior in project midpoint by Evolveum.
the class ACAttributeValuePanel method initLayout.
private void initLayout(Form form, boolean ignoreMandatoryAttributes) {
ACValueConstructionDto dto = getModel().getObject();
PrismPropertyDefinition definition = dto.getAttribute().getDefinition();
InputPanel input = createTypedInputComponent(ID_INPUT, definition);
for (FormComponent comp : input.getFormComponents()) {
comp.setLabel(new PropertyModel<>(dto.getAttribute(), ACAttributeDto.F_NAME));
if (!ignoreMandatoryAttributes) {
comp.setRequired(definition.getMinOccurs() > 0);
}
comp.add(new AjaxFormComponentUpdatingBehavior("blur") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
}
});
}
add(input);
AjaxLink<Void> addLink = new AjaxLink<Void>(ID_ADD) {
@Override
public void onClick(AjaxRequestTarget target) {
addPerformed(target);
}
};
add(addLink);
addLink.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return isAddVisible();
}
});
AjaxLink<Void> removeLink = new AjaxLink<Void>(ID_REMOVE) {
@Override
public void onClick(AjaxRequestTarget target) {
removePerformed(target);
}
};
add(removeLink);
removeLink.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return isRemoveVisible();
}
});
}
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