use of org.apache.wicket.markup.parser.filter.EnclosureHandler in project wicket by apache.
the class MarkupParser method initializeMarkupFilters.
/**
* Initialize Wicket's MarkupParser with all necessary markup filters. You may subclass this
* method, to add your own filters to the list.
*
* @param markup
* @return The list of markup filter
*/
@Override
protected MarkupFilterList initializeMarkupFilters(final Markup markup) {
// MarkupFilterList is a simple extension of ArrayList providing few additional helpers
final MarkupFilterList filters = new MarkupFilterList();
MarkupResourceStream markupResourceStream = markup.getMarkupResourceStream();
filters.add(new WicketTagIdentifier(markupResourceStream));
filters.add(new HtmlHandler());
filters.add(new WicketRemoveTagHandler(markupResourceStream));
filters.add(new WicketLinkTagHandler(markupResourceStream));
filters.add(new AutoLabelTagHandler(markupResourceStream));
filters.add(new WicketNamespaceHandler(markupResourceStream));
filters.add(new WicketMessageTagHandler(markupResourceStream));
// Provided the wicket component requesting the markup is known ...
if ((markupResourceStream != null) && (markupResourceStream.getResource() != null)) {
final ContainerInfo containerInfo = markupResourceStream.getContainerInfo();
if (containerInfo != null) {
// Pages require additional handlers
if (Page.class.isAssignableFrom(containerInfo.getContainerClass())) {
filters.add(new HtmlHeaderSectionHandler(markup));
}
filters.add(new HeadForceTagIdHandler(containerInfo.getContainerClass()));
}
}
filters.add(new OpenCloseTagExpander());
filters.add(new RelativePathPrefixHandler(markupResourceStream));
filters.add(new EnclosureHandler(markupResourceStream));
filters.add(new InlineEnclosureHandler(markupResourceStream));
// Append it. See WICKET-4390
filters.add(new StyleAndScriptIdentifier(), StyleAndScriptIdentifier.class);
filters.add(new WicketContainerTagHandler(markupResourceStream, Application.get().usesDevelopmentConfig()));
return filters;
}
use of org.apache.wicket.markup.parser.filter.EnclosureHandler 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;
}
use of org.apache.wicket.markup.parser.filter.EnclosureHandler in project wicket by apache.
the class Application method internalInit.
/**
* THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT OVERRIDE OR CALL.
*
* Internal initialization.
*/
protected void internalInit() {
settingsAccessible = true;
PageSettings pageSettings = getPageSettings();
// Install default component resolvers
pageSettings.addComponentResolver(new HtmlHeaderResolver());
pageSettings.addComponentResolver(new WicketLinkTagHandler());
pageSettings.addComponentResolver(new WicketMessageResolver());
pageSettings.addComponentResolver(new RelativePathPrefixHandler());
pageSettings.addComponentResolver(new EnclosureHandler());
pageSettings.addComponentResolver(new InlineEnclosureHandler());
pageSettings.addComponentResolver(new WicketMessageTagHandler());
pageSettings.addComponentResolver(new WicketContainerResolver());
getResourceSettings().getResourceFinders().add(new ClassPathResourceFinder(""));
// Install button image resource factory
getResourceSettings().addResourceFactory("buttonFactory", new DefaultButtonImageResourceFactory());
String applicationKey = getApplicationKey();
applicationKeyToApplication.put(applicationKey, this);
converterLocator = newConverterLocator();
setPageManagerProvider(new DefaultPageManagerProvider(this));
resourceReferenceRegistry = newResourceReferenceRegistry();
sharedResources = newSharedResources(resourceReferenceRegistry);
resourceBundles = newResourceBundles(resourceReferenceRegistry);
// set up default request mapper
setRootRequestMapper(new SystemMapper(this));
pageFactory = newPageFactory();
requestCycleProvider = (context) -> new RequestCycle(context);
exceptionMapperProvider = () -> new DefaultExceptionMapper();
// add a request cycle listener that logs each request for the requestlogger.
getRequestCycleListeners().add(new RequestLoggerRequestCycleListener());
}
Aggregations