final CheckGroup<String> successGroup = new CheckGroup<String>(
"successGroup",
selected);
successGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
private static final long serialVersionUID = -151291731388673682L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {
final Set<String> toBeRemoved = new HashSet<String>();
final Set<String> toBeAdded = new HashSet<String>();
for (String event : getEvents(eventCategoryTO)) {
final String eventString = LoggerEventUtils.buildEvent(
eventCategoryTO.getType(),
eventCategoryTO.getCategory(),
eventCategoryTO.getSubcategory(),
event,
AuditElements.Result.SUCCESS);
if (successGroup.getModelObject().contains(eventString)) {
toBeAdded.add(eventString);
} else {
toBeRemoved.add(eventString);
}
}
send(EventSelectionPanel.this.getPage(), Broadcast.BREADTH,
new SelectedEventsPanel.EventSelectionChanged(target, toBeAdded, toBeRemoved));
}
});
successGroup.setVisible(!events.isEmpty());
add(successGroup);
add(new Label("successLabel", new ResourceModel("Success", "Success"))).setVisible(!events.isEmpty());
final CheckGroupSelector successSelector = new CheckGroupSelector("successSelector", successGroup);
successSelector.setVisible(!events.isEmpty());
add(successSelector);
final ListView<String> categoryView = new AltListView<String>("categoryView", events) {
private static final long serialVersionUID = 4949588177564901031L;
@Override
protected void populateItem(final ListItem<String> item) {
final String subcategory = item.getModelObject();
item.add(new Label("subcategory", new ResourceModel(subcategory, subcategory)));
}
};
add(categoryView);
final ListView<String> successView = new AltListView<String>("successView", events) {
private static final long serialVersionUID = 4949588177564901031L;
@Override
protected void populateItem(final ListItem<String> item) {
final String event = item.getModelObject();
final Check<String> successCheck = new Check<String>("successCheck",
new Model<String>(LoggerEventUtils.buildEvent(
eventCategoryTO.getType(),
eventCategoryTO.getCategory(),
eventCategoryTO.getSubcategory(),
event,
AuditElements.Result.SUCCESS)),
successGroup);
item.add(successCheck);
}
};
successGroup.add(successView);
final CheckGroup<String> failureGroup = new CheckGroup<String>(
"failureGroup",
selected);
failureGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
private static final long serialVersionUID = -151291731388673682L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {