List of usage examples for org.apache.wicket MarkupContainer autoAdd
public final boolean autoAdd(final Component component, MarkupStream markupStream)
From source file:net.jawr.web.wicket.JawrWicketLinkResolver.java
License:Apache License
@Override public Component resolve(MarkupContainer container, MarkupStream markupStream, ComponentTag tag) { Component component = null;/*from w w w .j a v a 2 s .c om*/ // Only component tags have the id == "_jawrAutolink_" String tagName = tag.getName(); if (tag.getId().equals(JawrWicketLinkTagHandler.AUTOLINK_ID)) { // create the right component depending on the tag name WebMarkupContainer jawrTag = null; final String id = tag.getId() + container.getPage().getAutoIndex(); if (tagName.equalsIgnoreCase(IMG_TAG_NAME)) { jawrTag = new JawrImageReference(id); } else if (tagName.equalsIgnoreCase("input") && tag.getAttribute("type").equals(IMAGE_TAG_NAME)) { jawrTag = new JawrHtmlImageReference(id); } else if (tagName.equalsIgnoreCase("script")) { jawrTag = new JawrJavascriptReference(id); } else if (tagName.equalsIgnoreCase("link")) { jawrTag = new JawrStylesheetReference(id); } if (jawrTag != null) { container.autoAdd(jawrTag, markupStream); } // Yes, we handled the tag return jawrTag; } else if (tag instanceof WicketTag) { // For tag wicket:jawr if (tagName.equals("jawr")) { final String id = tag.getId() + container.getPage().getAutoIndex(); component = new TransparentWebMarkupContainer(id); component.setRenderBodyOnly(true); container.autoAdd(component, markupStream); // Yes, we handled the tag return component; } } // We were not able to handle the tag return null; }