use of org.apache.wicket.markup.MergedMarkup in project wicket by apache.
the class InheritedMarkupMarkupLoader method loadMarkup.
/**
* Load the markup from the resource stream with the base MarkupLoader provided, than check if
* markup inheritance must be applied. If yes, than load the base markup and merge them.
*/
@Override
public final Markup loadMarkup(final MarkupContainer container, final MarkupResourceStream markupResourceStream, final IMarkupLoader baseLoader, final boolean enforceReload) throws IOException, ResourceStreamNotFoundException {
// read and parse the markup
Markup markup = baseLoader.loadMarkup(container, markupResourceStream, null, enforceReload);
// Check if markup contains <wicket:extend> which tells us that
// we need to read the inherited markup as well.
int extendIndex = requiresBaseMarkup(markup);
if (extendIndex == -1) {
return markup;
}
// Load the base markup
final Markup baseMarkup = getBaseMarkup(container, markup, enforceReload);
if ((baseMarkup == null) || (baseMarkup == Markup.NO_MARKUP)) {
throw new MarkupNotFoundException("Base markup of inherited markup not found. Component class: " + markup.getMarkupResourceStream().getContainerInfo().getContainerClass().getName() + ". Enable debug messages for " + ResourceStreamLocator.class.getName() + " to get a list of all filenames tried.");
}
// Merge base and derived markup
return new MergedMarkup(markup, baseMarkup, extendIndex);
}
Aggregations