use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class PageSizePopover method initLayout.
protected void initLayout() {
Button popButton = new Button(ID_POP_BUTTON);
popButton.setOutputMarkupId(true);
add(popButton);
WebMarkupContainer popover = new WebMarkupContainer(ID_POPOVER);
popover.setOutputMarkupId(true);
add(popover);
Form form = new Form(ID_FORM);
popover.add(form);
AjaxSubmitButton button = new AjaxSubmitButton(ID_BUTTON) {
@Override
protected void onError(AjaxRequestTarget target, Form<?> form) {
super.onError(target, form);
target.add(getPageBase().getFeedbackPanel());
}
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
super.onSubmit(target, form);
pageSizeChanged(target);
}
};
form.add(button);
TextField input = new TextField(ID_INPUT, createInputModel());
input.add(new RangeValidator(5, 100));
input.setLabel(createStringResource("PageSizePopover.title"));
input.add(new SearchFormEnterBehavior(button));
input.setType(Integer.class);
form.add(input);
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class LinkColumn method populateItem.
@Override
public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId, final IModel<T> rowModel) {
IModel model = createLinkModel(rowModel);
cellItem.add(new LinkPanel(componentId, model) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
LinkColumn.this.onClick(target, rowModel);
}
@Override
public boolean isEnabled() {
return LinkColumn.this.isEnabled(rowModel);
}
});
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class ObjectLinkColumn method populateItem.
@Override
public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId, final IModel<T> rowModel) {
IModel<ObjectType> superModel = createLinkModel(rowModel);
final ObjectType targetObjectType = superModel.getObject();
IModel<String> nameModel = new PropertyModel<String>(superModel, FocusType.F_NAME.getLocalPart() + ".orig");
cellItem.add(new LinkPanel(componentId, nameModel) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
ObjectLinkColumn.this.onClick(target, rowModel, targetObjectType);
}
@Override
public boolean isEnabled() {
return ObjectLinkColumn.this.isEnabled(rowModel);
}
});
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class ObjectNameColumn method populateItem.
@Override
public void populateItem(final Item<ICellPopulator<SelectableBean<O>>> cellItem, String componentId, final IModel<SelectableBean<O>> rowModel) {
IModel<String> labelModel = new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
SelectableBean<O> selectableBean = rowModel.getObject();
O value = selectableBean.getValue();
if (value == null) {
OperationResult result = selectableBean.getResult();
OperationResultStatusPresentationProperties props = OperationResultStatusPresentationProperties.parseOperationalResultStatus(result.getStatus());
return cellItem.getString(props.getStatusLabelKey());
} else {
String name = WebComponentUtil.getName(value);
if (selectableBean.getResult() != null) {
StringBuilder complexName = new StringBuilder();
complexName.append(name);
complexName.append(" (");
complexName.append(selectableBean.getResult().getStatus());
complexName.append(")");
return complexName.toString();
}
return name;
}
}
};
if (isClickable(rowModel)) {
// beware: rowModel is very probably resolved at this moment; but it seems to cause no problems
cellItem.add(new LinkPanel(componentId, labelModel) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
SelectableBean<O> selectableBean = rowModel.getObject();
O value = selectableBean.getValue();
if (value == null) {
OperationResult result = selectableBean.getResult();
throw new RestartResponseException(new PageOperationResult(result));
} else {
if (selectableBean.getResult() != null) {
throw new RestartResponseException(new PageOperationResult(selectableBean.getResult()));
} else {
ObjectNameColumn.this.onClick(target, rowModel);
}
}
}
});
} else {
cellItem.add(new Label(componentId, labelModel));
}
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class NavigatorPanel method initFirst.
private void initFirst() {
WebMarkupContainer first = new WebMarkupContainer(ID_FIRST);
first.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return isFirstEnabled() ? "" : "disabled";
}
}));
add(first);
AjaxLink firstLink = new AjaxLink(ID_FIRST_LINK) {
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));
}
@Override
public void onClick(AjaxRequestTarget target) {
firstPerformed(target);
}
};
firstLink.add(new VisibleEnableBehaviour() {
@Override
public boolean isEnabled() {
return BooleanUtils.isTrue(showPageListingModel.getObject()) && isFirstEnabled();
}
});
first.add(firstLink);
}
Aggregations