use of org.apache.wicket.markup.html.list.LoopItem in project wicket-dashboard by decebals.
the class DashboardPanel method addColumnsPanel.
private void addColumnsPanel() {
final int columnCount = getDashboard().getColumnCount();
Loop columnsView = new Loop("columns", columnCount) {
private static final long serialVersionUID = 1L;
@Override
protected void onBeforeRender() {
if (!hasBeenRendered()) {
columnPanels = new ArrayList<DashboardColumnPanel>();
}
super.onBeforeRender();
}
@Override
protected void populateItem(LoopItem item) {
float columnPanelWidth = 100f / columnCount;
DashboardColumnPanel columnPanel = new DashboardColumnPanel("column", getModel(), item.getIndex());
columnPanel.setRenderBodyOnly(true);
columnPanel.getColumnContainer().add(AttributeModifier.replace("style", "width: " + columnPanelWidth + "%;"));
item.add(columnPanel);
columnPanels.add(columnPanel);
}
};
add(columnsView);
}
use of org.apache.wicket.markup.html.list.LoopItem in project midpoint by Evolveum.
the class NavigatorPanel method initNavigation.
private void initNavigation() {
IModel<Integer> model = new AbstractReadOnlyModel<Integer>() {
@Override
public Integer getObject() {
int count = (int) pageable.getPageCount();
if (count < PAGING_SIZE) {
return count;
}
return PAGING_SIZE;
}
};
Loop navigation = new Loop(ID_NAVIGATION, model) {
@Override
protected void populateItem(final LoopItem item) {
final NavigatorPageLink pageLink = new NavigatorPageLink(ID_PAGE_LINK, computePageNumber(item.getIndex())) {
@Override
public void onClick(AjaxRequestTarget target) {
pageLinkPerformed(target, getPageNumber());
}
};
item.add(pageLink);
item.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return pageable.getCurrentPage() == pageLink.getPageNumber() ? "active" : "";
}
}));
}
};
navigation.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return BooleanUtils.isTrue(showPageListingModel.getObject());
}
});
add(navigation);
}
Aggregations