com.google.gwt.uibinder.rebind.XMLElement.setAttribute()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(72)

本文整理了Java中com.google.gwt.uibinder.rebind.XMLElement.setAttribute()方法的一些代码示例,展示了XMLElement.setAttribute()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLElement.setAttribute()方法的具体详情如下:
包路径:com.google.gwt.uibinder.rebind.XMLElement
类名称:XMLElement
方法名:setAttribute

XMLElement.setAttribute介绍

暂无

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

public String interpretElement(XMLElement elem)
   throws UnableToCompleteException {
  Map<String, String> attNameToToken = new HashMap<String, String>();

  for (int i = elem.getAttributeCount() - 1; i >= 0; i--) {
   XMLAttribute att = elem.getAttribute(i);

   if (att.hasComputedValue()) {
    String attToken = delegate.getAttributeToken(att);
    attNameToToken.put(att.getName(), attToken);
   } else {
    /*
     * No computed value, but make sure that any {{ madness gets escaped.
     * TODO(rjrjr) Move this to XMLElement RSN
     */
    String n = att.getName();
    String v = att.consumeRawValue().replace("\\{", "{");
    elem.setAttribute(n, v);
   }
  }

  for (Map.Entry<String, String> attr : attNameToToken.entrySet()) {
   elem.setAttribute(attr.getKey(), attr.getValue());
  }

  // Return null because we don't want to replace the dom element
  return null;
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

public String interpretElement(XMLElement elem)
   throws UnableToCompleteException {
  String fieldName = writer.declareFieldIfNeeded(elem);
  if (fieldName != null) {
   String token = writer.declareDomField(elem, fieldName, element);

   if (elem.hasAttribute("id")) {
    writer.die(elem, String.format(
      "Cannot declare id=\"%s\" and %s=\"%s\" on the same element",
      elem.consumeRawAttribute("id"), writer.getUiFieldAttributeName(),
      fieldName));
   }

   elem.setAttribute("id", token);
  }

  /*
   * Return null because we don't want to replace the dom element with any
   * particular string (though we may have consumed its id or gwt:field)
   */
  return null;
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

public String interpretElement(XMLElement elem)
   throws UnableToCompleteException {
  MessagesWriter messages = writer.getMessages();
  for (AttributeMessage am : messages.consumeAttributeMessages(elem)) {
   String message = am.getMessageUnescaped();
   if (!writer.useSafeHtmlTemplates()) {
    /*
     * We have to do our own simple escaping to if the SafeHtml integration
     * is off
     */
    message += ".replaceAll(\"&\", \"&amp;\").replaceAll(\"'\", \"&#39;\")";
   }
   elem.setAttribute(am.getAttribute(),
    writer.tokenForStringExpression(elem, message));
  }

  /*
   * Return null because we don't want to replace the dom element with any
   * particular string (though we may have consumed its id or ui:field)
   */
  return null;
 }
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

public String interpretElement(XMLElement elem)
   throws UnableToCompleteException {
  Map<String, String> attNameToToken = new HashMap<String, String>();

  for (int i = elem.getAttributeCount() - 1; i >= 0; i--) {
   XMLAttribute att = elem.getAttribute(i);

   if (att.hasComputedValue()) {
    String attToken = delegate.getAttributeToken(att);
    attNameToToken.put(att.getName(), attToken);
   } else {
    /*
     * No computed value, but make sure that any {{ madness gets escaped.
     * TODO(rjrjr) Move this to XMLElement RSN
     */
    String n = att.getName();
    String v = att.consumeRawValue().replace("{{", "{");
    elem.setAttribute(n, v);
   }
  }

  for (Map.Entry<String, String> attr : attNameToToken.entrySet()) {
   elem.setAttribute(attr.getKey(), attr.getValue());
  }

  // Return null because we don't want to replace the dom element
  return null;
 }
}

代码示例来源:origin: net.wetheinter/gwt-user

public String interpretElement(XMLElement elem)
   throws UnableToCompleteException {
  Map<String, String> attNameToToken = new HashMap<String, String>();

  for (int i = elem.getAttributeCount() - 1; i >= 0; i--) {
   XMLAttribute att = elem.getAttribute(i);

   if (att.hasComputedValue()) {
    String attToken = delegate.getAttributeToken(att);
    attNameToToken.put(att.getName(), attToken);
   } else {
    /*
     * No computed value, but make sure that any {{ madness gets escaped.
     * TODO(rjrjr) Move this to XMLElement RSN
     */
    String n = att.getName();
    String v = att.consumeRawValue().replace("\\{", "{");
    elem.setAttribute(n, v);
   }
  }

  for (Map.Entry<String, String> attr : attNameToToken.entrySet()) {
   elem.setAttribute(attr.getKey(), attr.getValue());
  }

  // Return null because we don't want to replace the dom element
  return null;
 }
}

代码示例来源:origin: com.jhickman/gxt-uibinder

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(", ");
      }
      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);
  }
}

代码示例来源:origin: net.wetheinter/gwt-user

public String interpretElement(XMLElement elem)
   throws UnableToCompleteException {
  String fieldName = writer.declareFieldIfNeeded(elem);
  if (fieldName != null) {
   String token = writer.declareDomField(elem, fieldName, element);

   if (elem.hasAttribute("id")) {
    writer.die(elem, String.format(
      "Cannot declare id=\"%s\" and %s=\"%s\" on the same element",
      elem.consumeRawAttribute("id"), writer.getUiFieldAttributeName(),
      fieldName));
   }

   elem.setAttribute("id", token);
  }

  /*
   * Return null because we don't want to replace the dom element with any
   * particular string (though we may have consumed its id or gwt:field)
   */
  return null;
 }
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

public String interpretElement(XMLElement elem)
   throws UnableToCompleteException {
  String fieldName = writer.declareFieldIfNeeded(elem);
  if (fieldName != null) {
   String token = writer.declareDomField(elem, fieldName, element);

   if (elem.hasAttribute("id")) {
    writer.die(elem, String.format(
      "Cannot declare id=\"%s\" and %s=\"%s\" on the same element",
      elem.consumeRawAttribute("id"), writer.getUiFieldAttributeName(),
      fieldName));
   }

   elem.setAttribute("id", token);
  }

  /*
   * Return null because we don't want to replace the dom element with any
   * particular string (though we may have consumed its id or gwt:field)
   */
  return null;
 }
}

代码示例来源:origin: net.wetheinter/gwt-user

public String interpretElement(XMLElement elem)
   throws UnableToCompleteException {
  MessagesWriter messages = writer.getMessages();
  for (AttributeMessage am : messages.consumeAttributeMessages(elem)) {
   String message = am.getMessageUnescaped();
   if (!writer.useSafeHtmlTemplates()) {
    /*
     * We have to do our own simple escaping to if the SafeHtml integration
     * is off
     */
    message += ".replaceAll(\"&\", \"&amp;\").replaceAll(\"'\", \"&#39;\")";
   }
   elem.setAttribute(am.getAttribute(),
    writer.tokenForStringExpression(elem, message));
  }

  /*
   * Return null because we don't want to replace the dom element with any
   * particular string (though we may have consumed its id or ui:field)
   */
  return null;
 }
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

public String interpretElement(XMLElement elem)
   throws UnableToCompleteException {
  MessagesWriter messages = writer.getMessages();
  for (AttributeMessage am : messages.consumeAttributeMessages(elem)) {
   String message = am.getMessageUnescaped();
   if (!writer.useSafeHtmlTemplates()) {
    /*
     * We have to do our own simple escaping to if the SafeHtml integration
     * is off
     */
    message += ".replaceAll(\"&\", \"&amp;\").replaceAll(\"'\", \"&#39;\")";
   }
   elem.setAttribute(am.getAttribute(),
    writer.tokenForStringExpression(elem, message));
  }

  /*
   * Return null because we don't want to replace the dom element with any
   * particular string (though we may have consumed its id or ui:field)
   */
  return null;
 }
}

相关文章

XMLElement类方法