Example usage for org.apache.wicket.markup ComponentTag setType

List of usage examples for org.apache.wicket.markup ComponentTag setType

Introduction

In this page you can find the example usage for org.apache.wicket.markup ComponentTag setType.

Prototype

public final void setType(final TagType type) 

Source Link

Document

THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.

Usage

From source file:com.evolveum.midpoint.web.component.AjaxIconButton.java

License:Apache License

@Override
protected void onComponentTag(ComponentTag tag) {
    super.onComponentTag(tag);

    if (tag.isOpenClose()) {
        tag.setType(XmlTag.TagType.OPEN);
    }//  ww  w  .j a v a 2 s .c  o m
}

From source file:com.lyndir.lhunath.opal.wayward.component.AjaxLabelLink.java

License:Apache License

@Override
protected void onComponentTag(final ComponentTag tag) {

    super.onComponentTag(tag);
    // always transform the tag to <span></span> so even labels defined as <span/> render
    tag.setType(XmlTag.OPEN);
}

From source file:com.lyndir.lhunath.snaplog.webapp.filter.OpenCloseTagExpander.java

License:Apache License

/**
 * @see IMarkupFilter#nextTag()//from  w  w  w .  j  ava2s. co  m
 */
@Override
public MarkupElement nextTag() throws ParseException {

    if (next != null) {
        MarkupElement tmp = next;
        next = null;
        return tmp;
    }

    ComponentTag tag = nextComponentTag();
    if (tag == null)
        return tag;

    if (tag.isOpenClose()) {
        String name = tag.getName();
        if (tag.getNamespace() != null)
            name = tag.getNamespace() + ':' + tag.getName();

        if (replaceForTags.contains(name.toLowerCase(Locale.ENGLISH))) {
            tag.setType(XmlTag.OPEN);

            next = new ComponentTag(tag.getName(), XmlTag.CLOSE);
            next.setNamespace(tag.getNamespace());
            next.setOpenTag(tag);
        }
    }
    return tag;
}

From source file:name.martingeisse.wicket.bootstrap.GlyphiconComponent.java

License:Open Source License

/**
 * Adds the CSS classes "glyphicon" and "glyphicon-?" to the specified
 * tag to render the glyph icon in it.//from   ww  w  . j av  a  2 s .  c  o m
 * 
 * Note that the tag should not contain text content -- the word spacing
 * from the glyphicon font looks really ugly on normal text.
 * 
 * @param glyphiconIdentifier the glyph icon identifier
 * @param tag the tag to render the glyph icon to
 */
public static void applyGlyphiconToTag(String glyphiconIdentifier, ComponentTag tag) {
    if (tag.isOpenClose()) {
        tag.setType(TagType.OPEN);
    }
    tag.append("class", "glyphicon glyphicon-" + glyphiconIdentifier, " ");

}

From source file:name.martingeisse.wicket.helpers.Iframe.java

License:Open Source License

@Override
protected void onComponentTag(final ComponentTag tag) {
    super.onComponentTag(tag);
    if (tag.isOpenClose()) {
        tag.setType(TagType.OPEN);
    }/* www.  ja va 2  s .  c o  m*/
    final Object modelObject = getDefaultModelObject();
    if (modelObject instanceof IResource) {
        tag.put("src", urlFor(IResourceListener.INTERFACE, contentParameters));
    } else if (modelObject instanceof ResourceReference) {
        final ResourceReference resourceReference = (ResourceReference) modelObject;
        if (resourceReference.canBeRegistered() && Application.exists()) {
            Application.get().getResourceReferenceRegistry().registerResourceReference(resourceReference);
        }
        tag.put("src", RequestCycle.get().urlFor(resourceReference, contentParameters));
    } else if (modelObject instanceof IPageProvider) {
        setSrcAttribute(tag, (IPageProvider) modelObject);
    } else if (modelObject instanceof IRequestablePage) {
        setSrcAttribute(tag, new PageProvider((IRequestablePage) modelObject));
    } else if (modelObject instanceof Class<?>) {
        final Class<?> c = (Class<?>) modelObject;
        if (Page.class.isAssignableFrom(c)) {
            setSrcAttribute(tag, new PageProvider(c.asSubclass(Page.class)));
        } else {
            throw new RuntimeException(
                    "cannot handle iframe model object: Class<" + c.getCanonicalName() + ">");
        }
    } else {
        throw new RuntimeException("cannot handle iframe model object: " + modelObject);
    }
}

From source file:net.dontdrinkandroot.wicket.component.basic.ToStringLabel.java

License:Apache License

/**
 * {@inheritDoc}/*from ww w .  j  a  v  a2  s  . c om*/
 */
@Override
protected void onComponentTag(ComponentTag tag) {

    super.onComponentTag(tag);

    if (tag.isOpenClose()) {
        // always transform the tag to <span></span> so even labels defined as <span/> render
        tag.setType(TagType.OPEN);
    }
}

From source file:org.apache.isis.viewer.wicket.ui.components.scalars.markup.MarkupComponent.java

License:Apache License

@Override
protected void onComponentTag(ComponentTag tag) {
    super.onComponentTag(tag);
    tag.setType(TagType.OPEN);
}

From source file:org.artifactory.common.wicket.component.checkbox.styled.StyledCheckbox.java

License:Open Source License

@Override
public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
    super.onComponentTagBody(markupStream, openTag);

    // close span  tag
    getResponse().write(openTag.syntheticCloseTagString());
    openTag.setType(XmlTag.TagType.CLOSE);
}

From source file:org.artifactory.common.wicket.component.links.BaseTitledLink.java

License:Open Source License

@Override
protected void onComponentTag(ComponentTag tag) {
    if (tag.isOpenClose()) {
        wasOpenCloseTag = true;/*from  w w w  .j av a2  s  . co m*/
        tag.setType(XmlTag.TagType.OPEN);
    }

    super.onComponentTag(tag);

    tag.put("class", getCssClass(tag));
    if ("input".equalsIgnoreCase(tag.getName())) {
        tag.put("value", getTitle());
    }

    if (isEnabled()) {
        // is a <a> or other tag
        if ("a".equalsIgnoreCase(tag.getName())) {
            tag.put("href", Strings.replaceAll(getURL(), "&", "&amp;"));
        }
    } else {
        disableLink(tag);
    }
}

From source file:org.berlin.wicket.components.HtmlComment.java

License:Open Source License

/**
 * @see org.apache.wicket.Component#onComponentTag(org.apache.wicket.markup.ComponentTag)
 *///w w  w.j a v a  2  s.c o  m
@Override
protected void onComponentTag(final ComponentTag tag) {
    super.onComponentTag(tag);
    tag.setType(XmlTag.TagType.OPEN);
}