⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 repeatingview.java

📁 Wicket一个开发Java Web应用程序框架。它使得开发web应用程序变得容易而轻松。 Wicket利用一个POJO data beans组件使得它可以与任何持久层技术相结合。
💻 JAVA
字号:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements.  See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License.  You may obtain a copy of the License at * *      http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.apache.wicket.markup.repeater;import java.util.Iterator;import org.apache.wicket.Component;import org.apache.wicket.model.IModel;/** * <p> * A repeater view that renders all of its children, using its body markup, in the order they were * added. *  * </p> * Example: * <p> * <u>Java:</u> *  * <pre> * RepeatingView view = new RepeatingView(&quot;repeater&quot;); * view.add(new Label(&quot;1&quot;, &quot;hello&quot;)); * view.add(new Label(&quot;2&quot;, &quot;goodbye&quot;)); * view.add(new Label(&quot;3&quot;, &quot;good morning&quot;)); * </pre> *  * </p> * <p> * <u>Markup:</u> *  * <pre> *  &lt;ul&gt;&lt;li wicket:id=&quot;repeater&quot;&gt;&lt;/li&gt;&lt;/ul&gt; * </pre> *  * </p> * <p> * <u>Yields:</u> *  * <pre> *  &lt;ul&gt;&lt;li&gt;hello&lt;/li&gt;&lt;li&gt;goodbye&lt;/li&gt;&lt;li&gt;good morning&lt;/li&gt;&lt;/ul&gt; * </pre> *  * To expand a bit: the repeater itself produces no markup, instead every direct child inherits the * entire markup of the repeater. In the example above reeaters's markup is: *  * <pre> *  &lt;li wicket:id=&quot;repeater&quot;&gt;&lt;/li&gt; * </pre> *  * and so this is the markup that is available to the direct children - the Label components. So as * each label renders it produces a line of the output that has the <code>li</code>tag. *  *  * @author Igor Vaynberg ( ivaynberg ) *  */public class RepeatingView extends AbstractRepeater{	/**	 * 	 */	private static final long serialVersionUID = 1L;	/** Counter used for generating unique child component ids. */	private long childIdCounter = 0;	/** @see Component#Component(String) */	public RepeatingView(String id)	{		super(id);	}	/** @see Component#Component(String, IModel) */	public RepeatingView(String id, IModel model)	{		super(id, model);	}	/**	 * Generates a unique id string. This makes it easy to add items to be rendered w/out having to	 * worry about generating unique id strings in your code.	 * 	 * @return unique child id	 */	public String newChildId()	{		childIdCounter++;		if (childIdCounter == Long.MAX_VALUE)		{			// mmm yeah...like this will ever happen			throw new RuntimeException("generateChildId() out of space.");		}		// We prepend the id's with the text 'id' so they will generate valid		// markup id's if needed.		return String.valueOf(childIdCounter);	}	/**	 * @see org.apache.wicket.markup.repeater.AbstractRepeater#renderIterator()	 */	protected Iterator renderIterator()	{		return iterator();	}	/**	 * @see org.apache.wicket.markup.repeater.AbstractRepeater#onPopulate()	 */	protected void onPopulate()	{		// noop - population of this repeater is manual	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -