use of org.apache.wicket.markup.repeater.OddEvenItem in project wicket by apache.
the class TableTreePage method createTree.
@Override
protected AbstractTree<Foo> createTree(FooProvider provider, IModel<Set<Foo>> state) {
List<IColumn<Foo, String>> columns = createColumns();
final TableTree<Foo, String> tree = new TableTree<Foo, String>("tree", columns, provider, Integer.MAX_VALUE, state) {
private static final long serialVersionUID = 1L;
@Override
protected Component newContentComponent(String id, IModel<Foo> model) {
return TableTreePage.this.newContentComponent(id, model);
}
@Override
protected Item<Foo> newRowItem(String id, int index, IModel<Foo> model) {
return new OddEvenItem<>(id, index, model);
}
};
tree.getTable().addTopToolbar(new HeadersToolbar<>(tree.getTable(), null));
tree.getTable().addBottomToolbar(new NoRecordsToolbar(tree.getTable()));
return tree;
}
use of org.apache.wicket.markup.repeater.OddEvenItem in project wicket by apache.
the class EnhancedPageView method newTree.
private AbstractTree<TreeNode> newTree() {
TreeProvider provider = new TreeProvider();
IModel<Set<TreeNode>> expandStateModel = new LoadableDetachableModel<Set<TreeNode>>() {
private static final long serialVersionUID = 1L;
@Override
protected Set<TreeNode> load() {
return expandState;
}
};
AbstractTree<TreeNode> tree = new DefaultTableTree<TreeNode, Void>("tree", visibleColumns, provider, Integer.MAX_VALUE, expandStateModel) {
private static final long serialVersionUID = 1L;
@Override
protected Item<TreeNode> newRowItem(String id, int index, IModel<TreeNode> model) {
return new OddEvenItem<>(id, index, model);
}
};
tree.setOutputMarkupId(true);
return tree;
}
use of org.apache.wicket.markup.repeater.OddEvenItem 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