本文整理汇总了Java中org.apache.wicket.markup.html.list.Loop类的典型用法代码示例。如果您正苦于以下问题:Java Loop类的具体用法?Java Loop怎么用?Java Loop使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Loop类属于org.apache.wicket.markup.html.list包,在下文中一共展示了Loop类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: WidgetTabs
import org.apache.wicket.markup.html.list.Loop; //导入依赖的package包/类
public WidgetTabs(String id, List<AbstractTab> tabs, int selectedTab) {
super(id, new Model(Integer.valueOf(-1)));
setOutputMarkupId(true);
setVersioned(false);
this.setTabs(tabs);
if(this.tabs == null) {
this.tabs = new ArrayList<AbstractTab>();
}
// tabs
Loop tabLoop = new Loop("tabs", tabs.size()) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(LoopItem item) {
int index = item.getIndex();
AbstractTab tab = ((AbstractTab) WidgetTabs.this.tabs.get(index));
int selected = getSelectedTab();
if(index == selected) {
item.add(new AttributeModifier("class", new Model("tabsel")));
}
final WebMarkupContainer titleLink = newLink("link", index);
titleLink.add(new Label("title", tab.getTitle()));
item.add(titleLink);
}
};
add(tabLoop);
// add ajax behavior
loadSelectedTabBehavior = new LoadSelectedTabBehavior();
add(loadSelectedTabBehavior);
// select initial tab
setSelectedTab(selectedTab, false);
}
示例2: addColumnsPanel
import org.apache.wicket.markup.html.list.Loop; //导入依赖的package包/类
private void addColumnsPanel() {
if (getDashboard() != null) {
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<>();
}
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);
}
}
示例3: initNavigation
import org.apache.wicket.markup.html.list.Loop; //导入依赖的package包/类
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);
}
示例4: initNavigation
import org.apache.wicket.markup.html.list.Loop; //导入依赖的package包/类
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 showPageListing;
}
});
add(navigation);
}
示例5: initPanelLayout
import org.apache.wicket.markup.html.list.Loop; //导入依赖的package包/类
private void initPanelLayout() {
Loop monthRepeater = new Loop(ID_MONTH_REPEATER,
new PropertyModel<Integer>(getModel(), SummaryPanelDto.F_MONTH_COUNT)) {
@Override
protected void populateItem(final LoopItem item) {
Loop dayRepeater = new Loop(ID_DAY_REPEATER, TABLE_DAY_SIZE) {
@Override
protected void populateItem(final LoopItem dayItem) {
final int dayIndex = dayItem.getIndex() - 1;
Label label = new Label(ID_LABEL, createDayModel(item.getIndex(), dayIndex));
label.setRenderBodyOnly(true);
dayItem.add(label);
final SummaryPanelDto dto = getModelObject();
dayItem.add(new CssClassNameModifier(new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
// month year column
if (dayIndex == -1) {
return null;
}
if (dto.isToday(item.getIndex(), dayIndex)) {
return "info";
}
if (!dto.isWithinFilter(item.getIndex(), dayIndex)) {
return "active";
}
if (dto.isWeekend(item.getIndex(), dayIndex)) {
return "success";
}
if (!dto.isFullDayDone(item.getIndex(), dayIndex)) {
return "text-danger";
}
return null;
}
}));
}
};
item.add(dayRepeater);
}
};
add(monthRepeater);
}