Example usage for org.apache.wicket.markup.parser.filter EnclosureHandler CHILD_ATTRIBUTE

List of usage examples for org.apache.wicket.markup.parser.filter EnclosureHandler CHILD_ATTRIBUTE

Introduction

In this page you can find the example usage for org.apache.wicket.markup.parser.filter EnclosureHandler CHILD_ATTRIBUTE.

Prototype

String CHILD_ATTRIBUTE

To view the source code for org.apache.wicket.markup.parser.filter EnclosureHandler CHILD_ATTRIBUTE.

Click Source Link

Document

The child attribute

Usage

From source file:org.brixcms.markup.transform.EnclosureMarkupSourceTransformer.java

License:Apache License

/**
 * Gets the value of the "child" attribute and splits the path into a list
 *
 * @param enclosure//ww  w. j a  va 2  s .c o m
 * @return ids
 */
private List<String> getChildren(Tag enclosure) {
    Map<String, String> attributes = enclosure.getAttributeMap();
    if (attributes != null) {
        if (attributes.containsKey(EnclosureHandler.CHILD_ATTRIBUTE)) {
            // split for nested components
            String[] children = attributes.get(EnclosureHandler.CHILD_ATTRIBUTE)
                    .split("" + Component.PATH_SEPARATOR);
            ArrayList<String> list = new ArrayList<String>();
            for (String child : children) {
                list.add(child);
            }
            return list;
        }
    }
    return null;
}

From source file:org.brixcms.markup.transform.EnclosureMarkupSourceTransformer.java

License:Apache License

/**
 * Replaces the supplied enclosure child tag with the actual resolved comma separated component path
 *
 * @param enclosure//from   w ww.  j  ava 2s  . c  o m
 * @param children
 * @param enclosureChildTags
 */
private void updateEnclosureChildId(Tag enclosure, List<String> children, List<Tag> enclosureChildTags) {
    Map<String, String> attributes = enclosure.getAttributeMap();
    if (attributes != null) {
        String child = "";
        for (int i = 0; i < children.size(); i++) {
            String childid = children.get(i);
            if (childid != null) {
                child += (child.length() > 0 ? Component.PATH_SEPARATOR : "") + childid;
            } else {
                Tag tag = enclosureChildTags.get(i);
                String id = getGeneratedTagId(tag);
                if (id != null) {
                    // nested children are delimited by commas
                    child += (child.length() > 0 ? Component.PATH_SEPARATOR : "") + id;
                }
            }
        }
        attributes.put(EnclosureHandler.CHILD_ATTRIBUTE, child);
    }
}