Author: jdonnerstag Date: Sun Sep 27 19:21:11 2009 New Revision: 819387 URL: http://svn.apache.org/viewvc?rev=819387&view=rev Log: MarkupFragment: added test cases and fixed some bugs
Added: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/internal/MarkupTagIterator.java wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MarkupFragmentTest.java wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder.html wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder.java wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder2.html wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder2.java wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder2_ExpectedResult.html wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorderPage.html wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorderPage.java wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder_ExpectedResult.html wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPage.html wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPage.java wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPage_ExpectedResult.html wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanel.html wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanel.java wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelPage.html wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelPage.java wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanel_ExpectedResult.html Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/DefaultMarkupCacheKeyProvider.java wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/IMarkupFragment.java wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/Markup.java wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/MarkupFragment.java wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/internal/DirectChildTagIterator.java wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/internal/Enclosure.java wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/panel/Panel.java wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/ComponentResolvers.java wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/WicketMessageResolver.java wicket/trunk/wicket/src/test/java/org/apache/wicket/PageParametersTest.java Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java?rev=819387&r1=819386&r2=819387&view=diff ============================================================================== --- wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java (original) +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java Sun Sep 27 19:21:11 2009 @@ -151,6 +151,45 @@ } /** + * Find a child component. It may have been directly added to the container or to a transparent + * child container. From a user's point of view, it was added to this container. + * + * @param child + * @return The container the child was actually added to. Null if not found. + */ + private MarkupContainer findChild(final Component child) + { + if (get(child.getId()) != null) + { + return this; + } + + MarkupContainer container = (MarkupContainer)visitChildren(MarkupContainer.class, + new IVisitor<MarkupContainer>() + { + public Object component(MarkupContainer container) + { + if (container.isTransparentResolver()) + { + if (container.getId().equals(child.getId())) + { + return container; + } + return IVisitor.CONTINUE_TRAVERSAL; + } + return IVisitor.CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER; + } + }); + + if (container != null) + { + return container; + } + + return null; + } + + /** * Replaces a child component of this container with another or just adds it in case no child * with the same id existed yet. * @@ -426,9 +465,10 @@ IMarkupFragment markup = getMarkup(); if (markup == null) { - throw new MarkupException("Unable to determine Markup for Component: " + toString()); + return null; } - else if (child == null) + + if (child == null) { return markup; } @@ -1033,8 +1073,7 @@ final IDebugSettings debugSettings = Application.get().getDebugSettings(); if (debugSettings.isLinePreciseReportingOnAddComponentEnabled()) { - child.setMetaData(ADDED_AT_KEY, Strings.toString(child, new MarkupException( - "added"))); + child.setMetaData(ADDED_AT_KEY, Strings.toString(child, new MarkupException("added"))); } if (page != null) @@ -1520,7 +1559,7 @@ } else { - if (ComponentResolvers.resolve(getApplication(), this, markupStream, tag)) + if (ComponentResolvers.resolve(this, markupStream, tag)) { return; } Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/DefaultMarkupCacheKeyProvider.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/DefaultMarkupCacheKeyProvider.java?rev=819387&r1=819386&r2=819387&view=diff ============================================================================== --- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/DefaultMarkupCacheKeyProvider.java (original) +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/DefaultMarkupCacheKeyProvider.java Sun Sep 27 19:21:11 2009 @@ -52,7 +52,6 @@ { final String classname = clazz.getName(); final Locale locale = container.getLocale(); - // TODO until now getStyle() == style + variation final String style = container.getStyle() + "_" + container.getVariation(); final String markupType = container.getMarkupType(); Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/IMarkupFragment.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/IMarkupFragment.java?rev=819387&r1=819386&r2=819387&view=diff ============================================================================== --- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/IMarkupFragment.java (original) +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/IMarkupFragment.java Sun Sep 27 19:21:11 2009 @@ -79,4 +79,12 @@ * @return -1, if not found */ IMarkupFragment find(final String path, final String id, final int startIndex); + + /** + * + * @param markupOnly + * True if only the markup shall be returned + * @return markup string + */ + String toString(final boolean markupOnly); } \ No newline at end of file Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/Markup.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/Markup.java?rev=819387&r1=819386&r2=819387&view=diff ============================================================================== --- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/Markup.java (original) +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/Markup.java Sun Sep 27 19:21:11 2009 @@ -376,9 +376,22 @@ @Override public final String toString() { + return toString(false); + } + + /** + * @param markupOnly + * True, if only the markup shall be returned + * @return String + */ + public final String toString(final boolean markupOnly) + { final AppendingStringBuffer buf = new AppendingStringBuffer(400); - buf.append(markupResourceStream.toString()); - buf.append("\n"); + if (markupOnly == false) + { + buf.append(markupResourceStream.toString()); + buf.append("\n"); + } final Iterator<MarkupElement> iter = markupElements.iterator(); while (iter.hasNext()) Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/MarkupFragment.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/MarkupFragment.java?rev=819387&r1=819386&r2=819387&view=diff ============================================================================== --- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/MarkupFragment.java (original) +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/MarkupFragment.java Sun Sep 27 19:21:11 2009 @@ -241,9 +241,20 @@ @Override public String toString() { + return toString(false); + } + + /** + * @see org.apache.wicket.markup.IMarkupFragment#toString(boolean) + */ + public String toString(boolean markupOnly) + { final AppendingStringBuffer buf = new AppendingStringBuffer(400); - buf.append(getRootMarkup().getMarkupResourceStream().toString()); - buf.append("\n"); + if (markupOnly == false) + { + buf.append(getRootMarkup().getMarkupResourceStream().toString()); + buf.append("\n"); + } for (int i = 0; i < size(); i++) { Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/internal/DirectChildTagIterator.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/internal/DirectChildTagIterator.java?rev=819387&r1=819386&r2=819387&view=diff ============================================================================== --- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/internal/DirectChildTagIterator.java (original) +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/internal/DirectChildTagIterator.java Sun Sep 27 19:21:11 2009 @@ -23,14 +23,21 @@ /** * Iterator that iterates over direct child component tags of the given component tag + * + * @author Juergen Donnerstag */ -class DirectChildTagIterator extends ReadOnlyIterator<ComponentTag> +public class DirectChildTagIterator extends ReadOnlyIterator<ComponentTag> { private final MarkupStream markupStream; + private final ComponentTag parent; + private ComponentTag next = null; + private int nextIndex; + private int currentIndex; + private final int originalIndex; /** @@ -39,9 +46,10 @@ * @param markupStream * @param parent */ - public DirectChildTagIterator(MarkupStream markupStream, ComponentTag parent) + public DirectChildTagIterator(final MarkupStream markupStream, final ComponentTag parent) { super(); + this.markupStream = markupStream; this.parent = parent; originalIndex = markupStream.getCurrentIndex(); Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/internal/Enclosure.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/internal/Enclosure.java?rev=819387&r1=819386&r2=819387&view=diff ============================================================================== --- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/internal/Enclosure.java (original) +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/internal/Enclosure.java Sun Sep 27 19:21:11 2009 @@ -97,7 +97,6 @@ { super(id); - if (childId == null) { throw new MarkupException( @@ -240,7 +239,7 @@ protected void executeInsideBufferedZone() { markupStream.setCurrentIndex(tagIndex); - ComponentResolvers.resolve(getApplication(), container, markupStream, tag); + ComponentResolvers.resolve(container, markupStream, tag); } }.execute(); Added: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/internal/MarkupTagIterator.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/internal/MarkupTagIterator.java?rev=819387&view=auto ============================================================================== --- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/internal/MarkupTagIterator.java (added) +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/internal/MarkupTagIterator.java Sun Sep 27 19:21:11 2009 @@ -0,0 +1,213 @@ +/* + * 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.html.internal; + +import java.util.Collections; +import java.util.List; +import java.util.Stack; + +import org.apache.wicket.WicketRuntimeException; +import org.apache.wicket.markup.ComponentTag; +import org.apache.wicket.markup.IMarkupFragment; +import org.apache.wicket.markup.MarkupElement; +import org.apache.wicket.markup.MarkupFragment; +import org.apache.wicket.markup.WicketTag; +import org.apache.wicket.util.collections.ReadOnlyIterator; + +/** + * + * @author Juergen Donnerstag + */ +public class MarkupTagIterator extends ReadOnlyIterator<ComponentTag> +{ + private final IMarkupFragment markup; + + private int nextIndex = -1; + + private ComponentTag next; + + private boolean noSubChilds; + + private boolean openOnly; + + /** <wicket:xxx */ + private boolean wicketTagsOnly; + + private final Stack<ComponentTag> nextStack = new Stack<ComponentTag>();; + + private Stack<ComponentTag> currentStack; + + /** + * Construct. + * + * @param markup + * @param noSubchilds + * @param openOnly + */ + public MarkupTagIterator(final IMarkupFragment markup) + { + super(); + + this.markup = markup; + } + + /** + * + * @param value + * @return this + */ + public MarkupTagIterator setWicketTagsOnly(boolean value) + { + wicketTagsOnly = value; + return this; + } + + /** + * + * @param value + * @return this + */ + public MarkupTagIterator setNoSubChilds(boolean value) + { + noSubChilds = value; + return this; + } + + /** + * + * @param value + * @return this + */ + public MarkupTagIterator setOpenTagOnly(boolean value) + { + openOnly = value; + return this; + } + + /** + * @see java.util.Iterator#hasNext() + */ + public boolean hasNext() + { + return findNext(); + } + + /** + * @see java.util.Iterator#next() + */ + public ComponentTag next() + { + return next; + } + + /** + * @return next wicket tag + */ + public WicketTag nextWicketTag() + { + return (WicketTag)next(); + } + + /** + * Gets currentIndex. + * + * @return currentIndex + */ + public int getIndex() + { + return nextIndex; + } + + /** + * + * @return The parent open tags. + */ + public List<ComponentTag> getStack() + { + return Collections.unmodifiableList(currentStack); + } + + /** + * @return a new markup fragment for the current open tag + */ + public IMarkupFragment getMarkupFragment() + { + if ((next != null) && (next.isOpen() || next.isOpenClose())) + { + return new MarkupFragment(markup, getIndex()); + } + + throw new WicketRuntimeException("Current tag is not an open tag: " + next); + } + + /** + * @return true, if one more tag was found + */ + private boolean findNext() + { + // preset to not-found + next = null; + + currentStack = new Stack<ComponentTag>(); + currentStack.addAll(nextStack); + + for (nextIndex = nextIndex + 1; nextIndex < markup.size(); nextIndex++) + { + final MarkupElement elem = markup.get(nextIndex); + + if (elem instanceof ComponentTag) + { + ComponentTag tag = (ComponentTag)elem; + + if (tag.isOpen()) + { + nextStack.push(tag); + } + else if (tag.isClose()) + { + nextStack.pop(); + } + + if ((openOnly == false) || (tag.isClose() == false)) + { + if ((noSubChilds == false) || (nextStack.size() != 1)) + { + if ((wicketTagsOnly == false) || (tag instanceof WicketTag)) + { + next = tag; + break; + } + } + } + } + } + + return next != null; + } + + /** + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() + { + return "nextIndex=" + nextIndex + "; noSubchilds=" + noSubChilds + "; openOnly=" + + openOnly + "; stack=" + (nextStack != null ? nextStack.size() : "null") + "; next=" + + next; + } +} \ No newline at end of file Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java?rev=819387&r1=819386&r2=819387&view=diff ============================================================================== --- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java (original) +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java Sun Sep 27 19:21:11 2009 @@ -16,15 +16,13 @@ */ package org.apache.wicket.markup.html.panel; +import org.apache.wicket.Component; import org.apache.wicket.MarkupContainer; import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.markup.IMarkupFragment; -import org.apache.wicket.markup.MarkupElement; import org.apache.wicket.markup.MarkupException; -import org.apache.wicket.markup.MarkupFragment; import org.apache.wicket.markup.MarkupNotFoundException; import org.apache.wicket.markup.MarkupStream; -import org.apache.wicket.markup.WicketTag; import org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup; import org.apache.wicket.markup.parser.XmlTag; import org.apache.wicket.model.IModel; @@ -351,88 +349,41 @@ } /** - * @see org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup#getMarkup() + * @see org.apache.wicket.MarkupContainer#getMarkup(org.apache.wicket.Component) */ @Override - public IMarkupFragment getMarkup() + public IMarkupFragment getMarkup(final Component child) { IMarkupFragment markup = null; // Get the markup provider MarkupContainer provider = getMarkupProvider(); - if (provider != null) + if (provider == null) { - markup = findFragmentMarkup(provider); + provider = getParent(); } - if ((markup == null) && (getParent() != null)) - { - markup = findFragmentMarkup(getParent()); - } - - if (markup == null) - { - markup = findFragmentMarkup(this); - } - - return markup; - } - - /** - * Find the fragment markup fragment - * - * @param provider - * @return markup - */ - private IMarkupFragment findFragmentMarkup(final MarkupContainer provider) - { - // Get the markup from the provider - IMarkupFragment markup = provider.getMarkup(); if (provider.hasAssociatedMarkup()) { markup = provider.getAssociatedMarkup(); } - - // Search the relevant fragment tag - if (markup != null) + else { - markup = findFragmentMarkup(markup); + markup = getParent().getMarkup(); } - // If not yet found, try the parent "calling" markup as well. This is relevant e.g. for - // Border and Panel. - if ((markup == null) && provider.hasAssociatedMarkup()) + if (markup == null) { - markup = provider.getParent().getMarkup(provider); - if (markup != null) - { - markup = findFragmentMarkup(markup); - } + return null; } - return markup; - } + markup = markup.find(null, markupId, 0); - /** - * Find the fragment markup fragment - * - * @param markup - * @return Null, if not found - */ - private IMarkupFragment findFragmentMarkup(final IMarkupFragment markup) - { - for (int i = 0; i < markup.size(); i++) + if (child == null) { - MarkupElement elem = markup.get(i); - if (elem instanceof WicketTag) - { - WicketTag tag = (WicketTag)elem; - if (tag.isFragementTag() && tag.getId().equals(markupId)) - { - return new MarkupFragment(markup, i); - } - } + return markup; } - return null; + + return markup.find(null, child.getId(), 0); } } Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/panel/Panel.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/panel/Panel.java?rev=819387&r1=819386&r2=819387&view=diff ============================================================================== --- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/panel/Panel.java (original) +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/panel/Panel.java Sun Sep 27 19:21:11 2009 @@ -21,6 +21,7 @@ import org.apache.wicket.markup.IMarkupFragment; import org.apache.wicket.markup.MarkupException; import org.apache.wicket.markup.MarkupFragment; +import org.apache.wicket.markup.MarkupNotFoundException; import org.apache.wicket.markup.MarkupStream; import org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup; import org.apache.wicket.markup.html.internal.HtmlHeaderContainer; @@ -150,15 +151,15 @@ IMarkupFragment markup = getAssociatedMarkup(); if (markup == null) { - throw new MarkupException("Failed to find markup file associated with panel. Panel: " + - this.toString()); + throw new MarkupNotFoundException( + "Failed to find markup file associated with panel. Panel: " + this.toString()); } // Find <wicket:panel> int index = markup.findComponentIndex(null, "_panel", 0); if (index == -1) { - throw new MarkupException( + throw new MarkupNotFoundException( "Expected to find <wicket:panel> in associated markup file. Markup: " + markup.toString()); } Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/ComponentResolvers.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/ComponentResolvers.java?rev=819387&r1=819386&r2=819387&view=diff ============================================================================== --- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/ComponentResolvers.java (original) +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/ComponentResolvers.java Sun Sep 27 19:21:11 2009 @@ -16,8 +16,6 @@ */ package org.apache.wicket.markup.resolver; -import java.util.Iterator; - import org.apache.wicket.Application; import org.apache.wicket.Component; import org.apache.wicket.MarkupContainer; @@ -33,7 +31,6 @@ { private ComponentResolvers() { - } /** @@ -44,17 +41,15 @@ * component needs to be resolved under normal circumstances. * </p> * - * @param application * @param container * @param markupStream * @param tag - * @return <code>true</code> if a component was resolved using on of tried resolvers, + * @return <code>true</code> if a component was resolved using one of tried resolvers, * <code>false</code> otherwise. */ - public static boolean resolve(final Application application, final MarkupContainer container, - MarkupStream markupStream, ComponentTag tag) + public static boolean resolve(final MarkupContainer container, final MarkupStream markupStream, + final ComponentTag tag) { - // try to resolve using component hierarchy Component cursor = container; @@ -67,17 +62,15 @@ return true; } } - cursor = cursor.findParent(MarkupContainer.class); + cursor = cursor.getParent(); } // fallback to application-level resolvers - Iterator<IComponentResolver> resolvers = application.getPageSettings() - .getComponentResolvers() - .iterator(); - while (resolvers.hasNext()) + for (final IComponentResolver resolver : Application.get() + .getPageSettings() + .getComponentResolvers()) { - IComponentResolver resolver = resolvers.next(); if (resolver.resolve(container, markupStream, tag)) { return true; @@ -86,5 +79,4 @@ return false; } - } Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/WicketMessageResolver.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/WicketMessageResolver.java?rev=819387&r1=819386&r2=819387&view=diff ============================================================================== --- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/WicketMessageResolver.java (original) +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/WicketMessageResolver.java Sun Sep 27 19:21:11 2009 @@ -29,9 +29,9 @@ import org.apache.wicket.markup.IMarkupFragment; import org.apache.wicket.markup.MarkupElement; import org.apache.wicket.markup.MarkupException; -import org.apache.wicket.markup.MarkupFragment; import org.apache.wicket.markup.MarkupStream; import org.apache.wicket.markup.WicketTag; +import org.apache.wicket.markup.html.internal.MarkupTagIterator; import org.apache.wicket.markup.parser.XmlTag; import org.apache.wicket.markup.parser.filter.WicketTagIdentifier; import org.apache.wicket.model.Model; @@ -111,7 +111,6 @@ */ private static final String DEFAULT_VALUE = "DEFAULT_WICKET_MESSAGE_RESOLVER_VALUE"; - /** * Try to resolve the tag, then create a component, add it to the container and render it. * @@ -425,16 +424,14 @@ // Get the parent markup. Make sure that in case of Border and Panel you get the // associated markup IMarkupFragment markup = getParent().getMarkup(null); - for (int i = 0; i < markup.size(); i++) + MarkupTagIterator iter = new MarkupTagIterator(markup).setWicketTagsOnly(true) + .setOpenTagOnly(true); + while (iter.hasNext()) { - MarkupElement elem = markup.get(i); - if (elem instanceof WicketTag) + WicketTag tag = iter.nextWicketTag(); + if (tag.isMessageTag() && key.equals(tag.getAttribute("key"))) { - WicketTag tag = (WicketTag)elem; - if (tag.isMessageTag() && key.equals(tag.getAttribute("key"))) - { - return new MarkupFragment(markup, i); - } + return iter.getMarkupFragment(); } } Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/PageParametersTest.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/PageParametersTest.java?rev=819387&r1=819386&r2=819387&view=diff ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/PageParametersTest.java (original) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/PageParametersTest.java Sun Sep 27 19:21:11 2009 @@ -517,6 +517,8 @@ public static final class SerializableThing implements Serializable { + private static final long serialVersionUID = 1L; + public final String word; public SerializableThing(String word) Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MarkupFragmentTest.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MarkupFragmentTest.java?rev=819387&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MarkupFragmentTest.java (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MarkupFragmentTest.java Sun Sep 27 19:21:11 2009 @@ -0,0 +1,219 @@ +/* + * 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.markupFragments; + +import java.io.IOException; + +import org.apache.wicket.Component; +import org.apache.wicket.MarkupContainer; +import org.apache.wicket.Page; +import org.apache.wicket.WicketTestCase; +import org.apache.wicket.markup.IMarkupFragment; +import org.apache.wicket.markup.html.border.Border; +import org.apache.wicket.markup.html.panel.Fragment; +import org.apache.wicket.markup.html.panel.InlinePanelPage_1; +import org.apache.wicket.markup.html.panel.Panel; +import org.apache.wicket.util.diff.DiffUtil; + +/** + * + */ +public class MarkupFragmentTest extends WicketTestCase +{ + private void compareWithFile(IMarkupFragment markup, String filename) throws IOException + { + String doc = markup.toString(true); + DiffUtil.validatePage(doc, MyPage.class, filename, true); + } + + private void compare(IMarkupFragment markup, String testMarkup) throws IOException + { + testMarkup = testMarkup.replaceAll("\n\r", ""); + testMarkup = testMarkup.replaceAll("\r\n", ""); + + String doc = markup.toString(true); + doc = doc.replaceAll("\n\r", ""); + doc = doc.replaceAll("\r\n", ""); + assertEquals(doc, testMarkup); + } + + /** + * page.getAssociatedMarkup(), page.getMarkup() and page.getMarkup(null) must all return the + * same + * + * @throws Exception + */ + public void testPage() throws Exception + { + IMarkupFragment markup = new MyPage().getAssociatedMarkup(); + compareWithFile(markup, "MyPage_ExpectedResult.html"); + + markup = new MyPage().getMarkup(); + compareWithFile(markup, "MyPage_ExpectedResult.html"); + + markup = new MyPage().getMarkup(null); + compareWithFile(markup, "MyPage_ExpectedResult.html"); + } + + /** + * + * @throws Exception + */ + public void testPanel() throws Exception + { + Page page = new MyPage(); + Panel panel = new MyPanel("panel"); + page.add(panel); + + // Get the associated markup file + IMarkupFragment markup = panel.getAssociatedMarkup(); + compareWithFile(markup, "MyPanel_ExpectedResult.html"); + + // The Page is missing the tag to "call" the panel + assertNull(panel.getMarkup()); + + // Create a Page with proper markup for the panel + page = new MyPanelPage(); + panel = (Panel)page.get("panel"); + + // getMarkup() returns the "calling" tags + markup = panel.getMarkup(); + compare(markup, "<span wicket:id=\"panel\">test</span>"); + + // getMarkup(null) returns the markup which is used to find a child component + markup = panel.getMarkup(null); + compare(markup, "<wicket:panel> <span wicket:id=\"label\">text</span></wicket:panel>"); + } + + /** + * + * @throws Exception + */ + public void testLabel() throws Exception + { + Component label = new MyPage().get("label"); + IMarkupFragment markup = label.getMarkup(); + compare(markup, "<span wicket:id=\"label\">text</span>"); + + label = new MyPanelPage().get("panel:label"); + markup = label.getMarkup(); + compare(markup, "<span wicket:id=\"label\">text</span>"); + } + + /** + * + * @throws Exception + */ + public void testWebMarkupContainer() throws Exception + { + MarkupContainer container = (MarkupContainer)new MyPage().get("container"); + IMarkupFragment markup = container.getMarkup(); + compare(markup, "<span wicket:id=\"container\">text</span>"); + + // The container doesn't have an external markup file + markup = container.getAssociatedMarkup(); + assertNull(markup); + + // Get the markup which is used to search for children. + markup = container.getMarkup(null); + compare(markup, "<span wicket:id=\"container\">text</span>"); + } + + /** + * + * @throws Exception + */ + public void testBorder() throws Exception + { + Page page = new MyBorderPage(); + Border border = (Border)page.get("border"); + + // Get the associated markup file + IMarkupFragment markup = border.getAssociatedMarkup(); + compareWithFile(markup, "MyBorder_ExpectedResult.html"); + + // getMarkup() returns the "calling" tags + markup = border.getMarkup(); + compare(markup, "<span wicket:id=\"border\">test</span>"); + + // getMarkup(null) returns the markup which is used to find a child component + markup = border.getMarkup(null); + compare(markup, "<wicket:border> 111 <wicket:body/> 222</wicket:border>"); + + assertNull(border.getBodyContainer().getAssociatedMarkup()); + + markup = border.getBodyContainer().getMarkup(); + compare(markup, "<wicket:body/>"); + + // getMarkup(null) returns the markup which is used to find a child component + markup = border.getBodyContainer().getMarkup(null); + compare(markup, "<span wicket:id=\"border\">test</span>"); + } + + /** + * + * @throws Exception + */ + public void testBorder2() throws Exception + { + Page page = new MyBorderPage(); + Border border = (Border)page.get("border2"); + + // Get the associated markup file + IMarkupFragment markup = border.getAssociatedMarkup(); + compareWithFile(markup, "MyBorder2_ExpectedResult.html"); + + // getMarkup() returns the "calling" tags + markup = border.getMarkup(); + compare(markup, "<span wicket:id=\"border2\">test</span>"); + + // getMarkup(null) returns the markup which is used to find a child component + markup = border.getMarkup(null); + compare(markup, "<wicket:border> 111 <wicket:body>333</wicket:body> 222</wicket:border>"); + + assertNull(border.getBodyContainer().getAssociatedMarkup()); + + markup = border.getBodyContainer().getMarkup(); + compare(markup, "<wicket:body>333</wicket:body>"); + + // getMarkup(null) returns the markup which is used to find a child component + markup = border.getBodyContainer().getMarkup(null); + compare(markup, "<span wicket:id=\"border2\">test</span>"); + } + + /** + * + * @throws Exception + */ + public void testFragments() throws Exception + { + Page page = new InlinePanelPage_1(); + Fragment fragment = (Fragment)page.get("myPanel1"); + + // Get the associated markup file + IMarkupFragment markup = fragment.getAssociatedMarkup(); + assertNull(markup); + + // getMarkup() returns the "calling" tags + markup = fragment.getMarkup(); + compare(markup, "<span wicket:id=\"myPanel1\">panel</span>"); + + // getMarkup(null) returns the markup which is used to find a child component + markup = fragment.getMarkup(null); + compare(markup, "<wicket:fragment wicket:id=\"frag1\">panel 1</wicket:fragment>"); + } +} Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder.html?rev=819387&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder.html Sun Sep 27 19:21:11 2009 @@ -0,0 +1,19 @@ +<!-- + ==================================================================== + Licensed 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. +--> +<wicket:border> + 111 + <wicket:body/> + 222 +</wicket:border> Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder.java?rev=819387&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder.java (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder.java Sun Sep 27 19:21:11 2009 @@ -0,0 +1,38 @@ +/* + * 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.markupFragments; + +import org.apache.wicket.markup.html.border.Border; + + +/** + * + */ +public class MyBorder extends Border +{ + private static final long serialVersionUID = 1L; + + /** + * Construct. + * + * @param id + */ + public MyBorder(String id) + { + super(id); + } +} Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder2.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder2.html?rev=819387&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder2.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder2.html Sun Sep 27 19:21:11 2009 @@ -0,0 +1,19 @@ +<!-- + ==================================================================== + Licensed 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. +--> +<wicket:border> + 111 + <wicket:body>333</wicket:body> + 222 +</wicket:border> Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder2.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder2.java?rev=819387&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder2.java (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder2.java Sun Sep 27 19:21:11 2009 @@ -0,0 +1,38 @@ +/* + * 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.markupFragments; + +import org.apache.wicket.markup.html.border.Border; + + +/** + * + */ +public class MyBorder2 extends Border +{ + private static final long serialVersionUID = 1L; + + /** + * Construct. + * + * @param id + */ + public MyBorder2(String id) + { + super(id); + } +} Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder2_ExpectedResult.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder2_ExpectedResult.html?rev=819387&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder2_ExpectedResult.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder2_ExpectedResult.html Sun Sep 27 19:21:11 2009 @@ -0,0 +1,19 @@ +<!-- + ==================================================================== + Licensed 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. +--> +<wicket:border> + 111 + <wicket:body>333</wicket:body> + 222 +</wicket:border> Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorderPage.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorderPage.html?rev=819387&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorderPage.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorderPage.html Sun Sep 27 19:21:11 2009 @@ -0,0 +1,20 @@ +<!-- + ==================================================================== + Licensed 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. +--> +<html xmlns:wicket> +<body> + <span wicket:id="border">test</span> + <span wicket:id="border2">test</span> +</body> +</html> Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorderPage.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorderPage.java?rev=819387&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorderPage.java (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorderPage.java Sun Sep 27 19:21:11 2009 @@ -0,0 +1,34 @@ +/* + * 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.markupFragments; + +import org.apache.wicket.markup.html.WebPage; + +/** + * + */ +public class MyBorderPage extends WebPage +{ + /** + * Construct. + */ + public MyBorderPage() + { + add(new MyBorder("border")); + add(new MyBorder2("border2")); + } +} Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder_ExpectedResult.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder_ExpectedResult.html?rev=819387&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder_ExpectedResult.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyBorder_ExpectedResult.html Sun Sep 27 19:21:11 2009 @@ -0,0 +1,19 @@ +<!-- + ==================================================================== + Licensed 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. +--> +<wicket:border> + 111 + <wicket:body/> + 222 +</wicket:border> Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPage.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPage.html?rev=819387&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPage.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPage.html Sun Sep 27 19:21:11 2009 @@ -0,0 +1,20 @@ +<!-- + ==================================================================== + Licensed 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. +--> +<html xmlns:wicket> +<body> + <span wicket:id="label">text</span> + <span wicket:id="container">text</span> +</body> +</html> Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPage.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPage.java?rev=819387&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPage.java (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPage.java Sun Sep 27 19:21:11 2009 @@ -0,0 +1,37 @@ +/* + * 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.markupFragments; + +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.markup.html.basic.Label; + +/** + * + */ +public class MyPage extends WebPage +{ + /** + * Construct. + */ + public MyPage() + { + add(new Label("label")); + + add(new WebMarkupContainer("container")); + } +} Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPage_ExpectedResult.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPage_ExpectedResult.html?rev=819387&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPage_ExpectedResult.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPage_ExpectedResult.html Sun Sep 27 19:21:11 2009 @@ -0,0 +1,20 @@ +<!-- + ==================================================================== + Licensed 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. +--> +<html xmlns:wicket> +<head></head><body> + <span wicket:id="label">text</span> + <span wicket:id="container">text</span> +</body> +</html> Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanel.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanel.html?rev=819387&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanel.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanel.html Sun Sep 27 19:21:11 2009 @@ -0,0 +1,17 @@ +<!-- + ==================================================================== + Licensed 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. +--> +<wicket:panel> + <span wicket:id="label">text</span> +</wicket:panel> Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanel.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanel.java?rev=819387&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanel.java (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanel.java Sun Sep 27 19:21:11 2009 @@ -0,0 +1,41 @@ +/* + * 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.markupFragments; + +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.panel.Panel; + + +/** + * + */ +public class MyPanel extends Panel +{ + private static final long serialVersionUID = 1L; + + /** + * Construct. + * + * @param id + */ + public MyPanel(String id) + { + super(id); + + add(new Label("label")); + } +} Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelPage.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelPage.html?rev=819387&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelPage.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelPage.html Sun Sep 27 19:21:11 2009 @@ -0,0 +1,19 @@ +<!-- + ==================================================================== + Licensed 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. +--> +<html xmlns:wicket> +<body> + <span wicket:id="panel">test</span> +</body> +</html> Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelPage.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelPage.java?rev=819387&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelPage.java (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanelPage.java Sun Sep 27 19:21:11 2009 @@ -0,0 +1,33 @@ +/* + * 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.markupFragments; + +import org.apache.wicket.markup.html.WebPage; + +/** + * + */ +public class MyPanelPage extends WebPage +{ + /** + * Construct. + */ + public MyPanelPage() + { + add(new MyPanel("panel")); + } +} Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanel_ExpectedResult.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanel_ExpectedResult.html?rev=819387&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanel_ExpectedResult.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MyPanel_ExpectedResult.html Sun Sep 27 19:21:11 2009 @@ -0,0 +1,17 @@ +<!-- + ==================================================================== + Licensed 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. +--> +<wicket:panel> + <span wicket:id="label">text</span> +</wicket:panel>