Example usage for com.google.gwt.uibinder.rebind XMLElement setAttribute

List of usage examples for com.google.gwt.uibinder.rebind XMLElement setAttribute

Introduction

In this page you can find the example usage for com.google.gwt.uibinder.rebind XMLElement setAttribute.

Prototype

public void setAttribute(String name, String value) 

Source Link

Usage

From source file:com.jhickman.web.gwt.gxtuibinder.elementparsers.layout.BorderLayoutParser.java

License:Apache License

public void parse(XMLElement layoutElem, XMLElement elem, String fieldName, JClassType type,
        UiBinderWriter writer) throws UnableToCompleteException {
    createAndSetLayout(layoutElem, elem, fieldName, writer);

    Set<String> layoutRegionsSeen = new HashSet<String>();

    for (XMLElement layoutDataElem : elem.consumeChildElements()) {
        if (!isValidChildElement(elem, layoutDataElem)) {
            StringBuilder sb = new StringBuilder("Child must be one of ");
            for (String name : DOCK_NAMES) {
                sb.append("<%1$s:").append(name).append(", ");
            }/*from   w ww.  j a  v  a  2s  .c o m*/
            sb.append("but found %2$s");
            writer.die(elem, sb.toString(), elem.getPrefix(), layoutDataElem);
        }

        // have we already added this region?
        String region = layoutDataElem.getLocalName();
        if (layoutRegionsSeen.contains(region)) {
            writer.die(elem, "Only one <%s:%s> is allowed", elem.getPrefix(), region);
        }
        layoutRegionsSeen.add(region);

        // delegate to super class
        layoutDataElem.setAttribute("type", "BorderLayoutData");
        handleLayoutData(layoutDataElem, fieldName, writer);
    }
}