private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
return new SyncTaskModalPage(window, taskTO, pageRef);
}
});
window.show(target);
}
}, ActionLink.ActionType.EDIT, TASKS);
panel.add(new ActionLink() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target) {
window.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
return new UserTemplateModalPage(pageRef, window, taskTO);
}
});
window.show(target);
}
}, ActionLink.ActionType.USER_TEMPLATE, TASKS);
panel.add(new ActionLink() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target) {
window.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
return new RoleTemplateModalPage(pageRef, window, taskTO);
}
});
window.show(target);
}
}, ActionLink.ActionType.ROLE_TEMPLATE, TASKS);
panel.add(new ActionLink() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target) {
try {
restClient.startExecution(taskTO.getId(), false);
getSession().info(getString(Constants.OPERATION_SUCCEEDED));
} catch (SyncopeClientCompositeErrorException scce) {
error(scce.getMessage());
}
target.add(container);
target.add(getPage().get(Constants.FEEDBACK));
}
}, ActionLink.ActionType.EXECUTE, TASKS);
panel.add(new ActionLink() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target) {
try {
restClient.startExecution(taskTO.getId(), true);
getSession().info(getString(Constants.OPERATION_SUCCEEDED));
} catch (SyncopeClientCompositeErrorException scce) {
error(scce.getMessage());
}
target.add(container);
target.add(getPage().get(Constants.FEEDBACK));
}
}, ActionLink.ActionType.DRYRUN, TASKS);
panel.add(new ActionLink() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target) {
try {
restClient.delete(taskTO.getId(), SyncTaskTO.class);
info(getString(Constants.OPERATION_SUCCEEDED));
} catch (SyncopeClientCompositeErrorException scce) {
error(scce.getMessage());
}
target.add(container);
target.add(getPage().get(Constants.FEEDBACK));
}
}, ActionLink.ActionType.DELETE, TASKS);
return panel;
}
@Override
public Component getHeader(String componentId) {
final ActionLinksPanel panel = new ActionLinksPanel(componentId, new Model(), pageRef);
panel.add(new ActionLink() {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target) {
if (target != null) {
target.add(table);
}
}
}, ActionLink.ActionType.RELOAD, TASKS, "list");
return panel;
}
});
table = Tasks.updateTaskTable(
columns,
new TasksProvider<SyncTaskTO>(restClient, paginatorRows, getId(), SyncTaskTO.class),
container,
0,
pageRef,
restClient);
container.add(table);
Form paginatorForm = new Form("PaginatorForm");
final DropDownChoice rowsChooser = new DropDownChoice("rowsChooser", new PropertyModel(this, "paginatorRows"),
prefMan.getPaginatorChoices());
rowsChooser.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
private static final long serialVersionUID = -1107858522700306810L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {
prefMan.set(getWebRequest(), (WebResponse) getResponse(), Constants.PREF_SYNC_TASKS_PAGINATOR_ROWS,
String.valueOf(paginatorRows));
table = Tasks.updateTaskTable(
columns,
new TasksProvider<SyncTaskTO>(restClient, paginatorRows, getId(), SyncTaskTO.class),
container,
table == null ? 0 : (int) table.getCurrentPage(),
pageRef,
restClient);
target.add(container);
}
});
paginatorForm.add(rowsChooser);
add(paginatorForm);
// create new user
AjaxLink createLink = new ClearIndicatingAjaxLink("createLink", pageRef) {
private static final long serialVersionUID = -7978723352517770644L;
@Override
protected void onClickInternal(final AjaxRequestTarget target) {
window.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
return new SyncTaskModalPage(window, new SyncTaskTO(), pageRef);
}
});
window.show(target);
}