当前位置: 首页>>代码示例>>Java>>正文


Java Loop类代码示例

本文整理汇总了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);		
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:37,代码来源:WidgetTabs.java

示例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);
	}
}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:33,代码来源:DashboardPanel.java

示例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);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:47,代码来源:NavigatorPanel.java

示例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);
}
 
开发者ID:Evolveum,项目名称:gizmo-v3,代码行数:47,代码来源:NavigatorPanel.java

示例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);
}
 
开发者ID:Evolveum,项目名称:gizmo-v3,代码行数:53,代码来源:SummaryPanel.java


注:本文中的org.apache.wicket.markup.html.list.Loop类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。