org.apache.wicket.markup.parser.XmlTag类的使用及代码示例

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

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

XmlTag介绍

[英]A subclass of MarkupElement which represents a tag including namespace and its optional attributes. XmlTags are returned by the XML parser.
[中]MarkupElement的一个子类,表示包含名称空间及其可选属性的标记。XML解析器返回XML标记。

代码示例

代码示例来源:origin: org.wicketstuff/wicketstuff-minis

private static XmlTag createXmlTag(final String name, final XmlTag.TagType type)
{
  final XmlTag xmlTag = new XmlTag();
  xmlTag.setType(type);
  xmlTag.setName(name);
  return xmlTag;
}

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

/**
 * @see org.apache.wicket.markup.parser.XmlTag#put(String, int)
 * @param key
 *            The key
 * @param value
 *            The value
 */
public final void put(final String key, final int value)
{
  xmlTag.put(key, value);
}

代码示例来源:origin: org.apache.wicket/wicket-core

/**
 * Converts this object to a string representation.
 * 
 * @return String version of this object
 */
@Override
public final String toString()
{
  return "" + httpTagType + ": '" + xmlTag.toString() + "'";
}

代码示例来源:origin: org.apache.wicket/wicket-core

/**
 * Construct.
 * 
 * @param message
 * @param tag
 */
public WicketParseException(final String message, final XmlTag tag)
{
  super(message + tag.toUserDebugString(), tag.getPos());
}

代码示例来源:origin: apache/wicket

/**
 * String representation with line and column number
 * 
 * @return String version of this object
 */
public String toUserDebugString()
{
  return " '" + toString() + "' (line " + getLineNumber() + ", column " + getColumnNumber() +
    ")";
}

代码示例来源:origin: org.wicketstuff/tinymce

/**
   * Create image xml tag which represets image html tag with proper url generated.
   * @param pImageFileDescription  - image file description.
   * @param pUrl - component url.
   * @return image xml tag which represets image html tag with proper url generated.
   */
  public static XmlTag createImageTag(ImageFileDescription pImageFileDescription, CharSequence pUrl) {
    XmlTag tag = new XmlTag();
    tag.setName("img");
    tag.setType(XmlTag.OPEN_CLOSE);
    tag.put(IMAGE_FILE_NAME, pImageFileDescription.getName());
    StringBuilder sb = new StringBuilder(pUrl);
    sb.append("&").append(IMAGE_FILE_NAME).append("=").append(pImageFileDescription.getName());
    sb.append("&").append(IMAGE_CONTENT_TYPE).append("=").append(pImageFileDescription.getContentType());
    tag.put("src", RequestCycle.get().getOriginalResponse().encodeURL(
        Strings.replaceAll(sb.toString(), "&", "&")));
    return tag;
  }
}

代码示例来源:origin: org.apache.wicket/wicket-core

/**
 * Gets this tag if it is already mutable, or a mutable copy of this tag if it is immutable.
 * 
 * @return This tag if it is already mutable, or a mutable copy of this tag if it is immutable.
 */
public XmlTag mutable()
{
  if (isMutable)
  {
    return this;
  }
  else
  {
    final XmlTag tag = new XmlTag();
    copyPropertiesTo(tag);
    return tag;
  }
}

代码示例来源:origin: org.apache.wicket/wicket-core

/**
 * Gets the markup for this tag. This includes all markup between the open tag and the close
 * tag.
 * 
 * @return all the markup between the open tag and the close tag
 */
public String getMarkup()
{
  int openPos = openTag.getPos();
  int closePos = closeTag.getPos() + closeTag.getLength();
  return parser.getInput(openPos, closePos).toString();
}

代码示例来源:origin: org.apache.wicket/wicket-core

/**
 * Checks if the tag has a child with the given <code>tagName</code>.
 *
 * @param tagName
 *            the tag name to search for
 * @return <code>true</code> if this tag has a child with the given <code>tagName</code>.
 */
public TagTester getChild(String tagName)
{
  Args.notNull(tagName, "tagName");
  TagTester childTagTester = null;
  if (openTag.isOpen())
  {
    // Get the content of the tag
    int startPos = openTag.getPos() + openTag.getLength();
    int endPos = closeTag.getPos();
    String markup = parser.getInput(startPos, endPos).toString();
    childTagTester = createTagByAttribute(markup, tagName);
  }
  return childTagTester;
}

代码示例来源:origin: org.wicketstuff/wicketstuff-minis

stringBuilder.append(xmlTag.toCharSequence());
onGridCell(component, xmlTag);
if (constraint.getColSpan() > 1)
  xmlTag.put("colspan", constraint.getColSpan());
if (constraint.getRowSpan() > 1)
  xmlTag.put("rowspan", constraint.getRowSpan());
stringBuilder.append(xmlTag.toCharSequence());

代码示例来源:origin: apache/wicket

/**
 * @see org.apache.wicket.markup.parser.XmlTag#setName(String)
 * @param name
 *            New tag name
 */
public final void setName(String name)
{
  xmlTag.setName(name);
}

代码示例来源:origin: org.apache.wicket/wicket-core

/**
 * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.
 * 
 * @param type
 *            The new type
 */
public final void setType(final TagType type)
{
  if (type != xmlTag.getType())
  {
    xmlTag.setType(type);
    setModified(true);
  }
}

代码示例来源:origin: org.apache.wicket/wicket-core

@Override
public CharSequence toCharSequence()
{
  return xmlTag.toCharSequence();
}

代码示例来源:origin: apache/wicket

/**
 * @return The tag's name
 */
public final String getName()
{
  return xmlTag.getName();
}

代码示例来源:origin: apache/wicket

/**
 * @see org.apache.wicket.markup.parser.XmlTag#isOpen()
 * @return True if this tag is an open tag
 */
public final boolean isOpen()
{
  return xmlTag.isOpen();
}

代码示例来源:origin: org.apache.wicket/wicket-core

/**
 * @param element
 * @return true, if namespace, name and attributes are the same
 */
public final boolean equalTo(final XmlTag element)
{
  final XmlTag that = element;
  if (!Objects.equal(getNamespace(), that.getNamespace()))
  {
    return false;
  }
  if (!getName().equals(that.getName()))
  {
    return false;
  }
  return getAttributes().equals(that.getAttributes());
}

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

/**
 * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.
 * 
 * @param type
 *            The new type
 */
public final void setType(final Type type)
{
  xmlTag.setType(type);
}

代码示例来源:origin: org.apache.wicket/wicket-core

/**
 * @see org.apache.wicket.markup.parser.XmlTag#getPos()
 * @return Tag location (index in input string)
 */
public final int getPos()
{
  return xmlTag.getPos();
}

代码示例来源:origin: apache/wicket

/**
 * Gets the length of the tag in characters.
 * 
 * @return The tag's length
 */
public final int getLength()
{
  return xmlTag.getLength();
}

代码示例来源:origin: org.wicketstuff/wicketstuff-tinymce

/**
   * Create image xml tag which represets image html tag with proper url generated.
   * 
   * @param pImageFileDescription
   *            - image file description.
   * @param pUrl
   *            - component url.
   * @return image xml tag which represets image html tag with proper url generated.
   */
  public static XmlTag createImageTag(ImageFileDescription pImageFileDescription,
    CharSequence pUrl)
  {
    XmlTag tag = new XmlTag();
    tag.setName("img");
    tag.setType(XmlTag.TagType.OPEN_CLOSE);
    tag.put(IMAGE_FILE_NAME, pImageFileDescription.getName());
    StringBuilder sb = new StringBuilder(pUrl);
    sb.append("&").append(IMAGE_FILE_NAME).append("=").append(pImageFileDescription.getName());
    sb.append("&")
      .append(IMAGE_CONTENT_TYPE)
      .append("=")
      .append(pImageFileDescription.getContentType());
    tag.put(
      "src",
      RequestCycle.get()
        .getOriginalResponse()
        .encodeURL(sb.toString()));
    return tag;
  }
}

相关文章