use of org.apache.syncope.client.console.panels.AjaxDataTablePanel in project syncope by apache.
the class AjaxFallbackDataTable method newRowItem.
@Override
protected Item<T> newRowItem(final String id, final int index, final IModel<T> model) {
final OddEvenItem<T> item = new OddEvenItem<>(id, index, model);
if (togglePanel != null) {
final ActionsPanel<T> actions = getActions(model);
if (actions != null && !actions.isEmpty()) {
item.add(new AttributeModifier("style", "cursor: pointer;"));
item.add(new AjaxEventBehavior(Constants.ON_CLICK) {
private static final long serialVersionUID = 1L;
@Override
protected String findIndicatorId() {
return StringUtils.EMPTY;
}
@Override
protected void onEvent(final AjaxRequestTarget target) {
final String lastFocussedElementId = target.getLastFocusedElementId();
if (lastFocussedElementId == null) {
togglePanel.toggleWithContent(target, getActions(model), model.getObject());
} else {
final AjaxDataTablePanel<?, ?> parent = findParent(AjaxDataTablePanel.class);
final Model<Boolean> isCheck = Model.<Boolean>of(Boolean.FALSE);
parent.visitChildren(CheckGroupSelector.class, (selector, ivisit) -> {
if (selector.getMarkupId().equalsIgnoreCase(lastFocussedElementId)) {
isCheck.setObject(Boolean.TRUE);
ivisit.stop();
}
});
if (!isCheck.getObject()) {
parent.visitChildren(Check.class, (check, ivisit) -> {
if (check.getMarkupId().equalsIgnoreCase(lastFocussedElementId)) {
isCheck.setObject(Boolean.TRUE);
ivisit.stop();
}
});
}
if (!isCheck.getObject()) {
togglePanel.toggleWithContent(target, getActions(model), model.getObject());
}
}
}
});
}
}
return item;
}
Aggregations