001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.wicket.markup; 018 019 020/** 021 * Any list of MarkupElements. May be the content of complete markup file or just a portion of it. 022 * 023 * @see Markup 024 * @see MarkupFragment 025 * @see MarkupElement 026 * 027 * @author Juergen Donnerstag 028 */ 029public interface IMarkupFragment extends Iterable<MarkupElement> 030{ 031 /** 032 * Get the MarkupElement at the index provided. 033 * 034 * @param index 035 * Index into markup list 036 * @return Markup element 037 * @throws IndexOutOfBoundsException 038 * if the index is out of range (<tt>index < 0 || index >= size()</tt>) 039 */ 040 MarkupElement get(final int index); 041 042 /** 043 * Get the underlying markup resource stream, which might contain more than just the markup 044 * portion represented by the IMarkupFragment. 045 * 046 * @return The underlying markup resource stream 047 */ 048 MarkupResourceStream getMarkupResourceStream(); 049 050 /** 051 * The number of markup elements. 052 * 053 * @return Number of markup elements 054 */ 055 int size(); 056 057 /** 058 * Finds a markup fragment that spans a tag 059 * 060 * @param wicketId 061 * the wicket:id attribute in the tag 062 * @return the markup fragment that spans the complete found tag 063 */ 064 IMarkupFragment find(final String wicketId); 065 066 /** 067 * 068 * @param markupOnly 069 * True if only the markup shall be returned 070 * @return markup string 071 */ 072 String toString(final boolean markupOnly); 073}