use of org.apache.wicket.markup.resolver.ComponentResolvers.ResolverFilter in project wicket by apache.
the class Enclosure method getChildComponent.
/**
* Resolves the child component which is the controller of this Enclosure
*
* @param markupStream
* the markup stream of this Enclosure
* @param enclosureParent
* the non-auto parent component of this Enclosure
* @return The component associated with the {@linkplain #childId}
*/
private Component getChildComponent(final MarkupStream markupStream, MarkupContainer enclosureParent) {
String fullChildId = getChildId();
Component controller = enclosureParent.get(fullChildId);
if (controller == null) {
int orgIndex = markupStream.getCurrentIndex();
try {
while (markupStream.isCurrentIndexInsideTheStream()) {
markupStream.next();
if (markupStream.skipUntil(ComponentTag.class)) {
ComponentTag tag = markupStream.getTag();
if ((tag != null) && (tag.isOpen() || tag.isOpenClose())) {
String tagId = tag.getId();
if (fullChildId.equals(tagId)) {
ComponentTag fullComponentTag = new ComponentTag(tag);
fullComponentTag.setId(childId.toString());
controller = ComponentResolvers.resolve(enclosureParent, markupStream, fullComponentTag, new ResolverFilter() {
@Override
public boolean ignoreResolver(final IComponentResolver resolver) {
return resolver instanceof EnclosureHandler;
}
});
break;
} else if (fullChildId.startsWith(tagId + PATH_SEPARATOR)) {
fullChildId = Strings.afterFirst(fullChildId, PATH_SEPARATOR);
}
}
}
}
} finally {
markupStream.setCurrentIndex(orgIndex);
}
}
checkChildComponent(controller);
return controller;
}
Aggregations