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

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

Introduction

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

Prototype

public final String getNamespace() 

Source Link

Usage

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

License:Apache License

/**
 * @see IMarkupFilter#nextTag()//from   w w  w  .jav  a 2  s  .c o 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:jp.javelindev.wicket.MyMarkupFilter.java

License:Apache License

@Override
protected MarkupElement onComponentTag(ComponentTag tag) throws ParseException {
    String namespace = markup.getWicketNamespace();
    final String wicketIdValue = tag.getAttributes().getString(namespace + ":id");

    //wicket??????wicket:id?????????wicket:id???
    if (!namespace.equalsIgnoreCase(tag.getNamespace()) && Strings.isEmpty(wicketIdValue)) {
        tag.put("wicket:id", "dummy" + count++);
    }/*from ww  w.  j a  v a  2  s .  c om*/
    LOGGER.info(tag.toString());

    return tag;
}