use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class SingleButtonPanel method initLayout.
private void initLayout() {
AjaxButton button = new AjaxButton(ID_BUTTON, createButtonStringResource(getCaption())) {
@Override
public void onClick(AjaxRequestTarget target) {
clickPerformed(target, SingleButtonPanel.this.getModel());
}
@Override
public boolean isEnabled() {
return SingleButtonPanel.this.isEnabled(SingleButtonPanel.this.getModel());
}
@Override
public boolean isVisible() {
return SingleButtonPanel.this.isVisible(SingleButtonPanel.this.getModel());
}
};
button.add(new AttributeAppender("class", getButtonCssClass()));
add(button);
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class TableConfigurationPanel method initPopoverLayout.
private void initPopoverLayout() {
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) {
target.add(TableConfigurationPanel.this.get(createComponentPath(ID_POPOVER, ID_FORM, "inputFeedback")));
}
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> 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);
input.setOutputMarkupId(true);
FeedbackPanel feedback = new FeedbackPanel("inputFeedback", new ComponentFeedbackMessageFilter(input));
feedback.setOutputMarkupId(true);
form.add(feedback);
form.add(input);
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class InfoBoxPanel method initLayout.
private void initLayout(final IModel<InfoBoxType> model, final Class<? extends IRequestablePage> linkPage) {
WebMarkupContainer infoBox = new WebMarkupContainer(ID_INFO_BOX);
add(infoBox);
infoBox.add(AttributeModifier.append("class", new PropertyModel<String>(model, InfoBoxType.BOX_BACKGROUND_COLOR)));
WebMarkupContainer infoBoxIcon = new WebMarkupContainer(ID_INFO_BOX_ICON);
infoBox.add(infoBoxIcon);
infoBoxIcon.add(AttributeModifier.append("class", new PropertyModel<String>(model, InfoBoxType.ICON_BACKGROUND_COLOR)));
WebMarkupContainer image = new WebMarkupContainer(ID_IMAGE_ID);
image.add(AttributeModifier.append("class", new PropertyModel<String>(model, InfoBoxType.IMAGE_ID)));
infoBoxIcon.add(image);
Label message = new Label(ID_MESSAGE, new PropertyModel<String>(model, InfoBoxType.MESSAGE));
infoBox.add(message);
Label number = new Label(ID_NUMBER, new PropertyModel<String>(model, InfoBoxType.NUMBER));
infoBox.add(number);
WebMarkupContainer progress = new WebMarkupContainer(ID_PROGRESS);
infoBox.add(progress);
progress.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return model.getObject().getProgress() != null;
}
});
ProgressbarPanel progressBar = new ProgressbarPanel(ID_PROGRESS_BAR, new PropertyModel<Integer>(model, InfoBoxType.PROGRESS));
progress.add(progressBar);
Label description = new Label(ID_DESCRIPTION, new PropertyModel<String>(model, InfoBoxType.DESCRIPTION));
infoBox.add(description);
if (linkPage != null) {
add(new AjaxEventBehavior("click") {
private static final long serialVersionUID = 1L;
@Override
protected void onEvent(AjaxRequestTarget target) {
setResponsePage(linkPage);
}
});
}
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class MultiButtonPanel method initLayout.
protected void initLayout() {
RepeatingView buttons = new RepeatingView(ID_BUTTONS);
add(buttons);
for (int id = 0; id < numberOfButtons; id++) {
final int finalId = getButtonId(id);
AjaxButton button = new AjaxButton(String.valueOf(finalId), createStringResource(getCaption(finalId))) {
@Override
public void onClick(AjaxRequestTarget target) {
clickPerformed(finalId, target, MultiButtonPanel.this.getModel());
}
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);
attributes.setEventPropagation(AjaxRequestAttributes.EventPropagation.BUBBLE);
}
@Override
public boolean isEnabled() {
return MultiButtonPanel.this.isButtonEnabled(finalId, MultiButtonPanel.this.getModel());
}
@Override
public boolean isVisible() {
return MultiButtonPanel.this.isButtonVisible(finalId, MultiButtonPanel.this.getModel());
}
};
button.add(new AttributeAppender("class", getButtonCssClass(finalId)));
button.add(new AttributeAppender("title", getButtonTitle(finalId)));
buttons.add(button);
buttons.add(new Label("label" + finalId, " "));
}
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class TablePanel method initLayout.
private void initLayout(List<IColumn<T, String>> columns, ISortableDataProvider provider, long pageSize) {
DataTable<T, String> table = new SelectableDataTable<>(ID_TABLE, columns, provider, (int) pageSize);
table.setOutputMarkupId(true);
TableHeadersToolbar headers = new TableHeadersToolbar(table, provider);
headers.setOutputMarkupId(true);
table.addTopToolbar(headers);
CountToolbar count = new CountToolbar(table) {
@Override
protected void pageSizeChanged(AjaxRequestTarget target) {
PageBase page = (PageBase) getPage();
Integer pageSize = page.getSessionStorage().getUserProfile().getPagingSize(tableId);
setItemsPerPage(pageSize);
target.add(getNavigatorPanel());
target.add(getDataTable());
}
@Override
protected boolean isPageSizePopupVisible() {
return tableId != null;
}
};
addVisibleBehaviour(count, showCount);
table.addBottomToolbar(count);
add(table);
NavigatorPanel nb2 = new NavigatorPanel(ID_PAGING, table, showPagedPagingModel(provider));
addVisibleBehaviour(nb2, showPaging);
add(nb2);
}
Aggregations