/** * 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 ComponentTag mutable() { if (xmlTag.isMutable()) { return this; } else { ComponentTag tag = new ComponentTag(xmlTag.mutable()); copyPropertiesTo(tag); return tag; } }
/** * Appends specified {@code value} to the attribute * * @param key The key * @param value The value * @param separator The separator used to append the value */ public final void append(String key, CharSequence value, String separator) { String current = getAttribute(key); if (Strings.isEmpty(current)) { xmlTag.put(key, value); } else { xmlTag.put(key, current + separator + value); } setModified(true); }
/** * @see org.apache.wicket.markup.parser.XmlTag#put(String, StringValue) * @param key The key * @param value The value */ public final void put(String key, StringValue value) { xmlTag.put(key, value); setModified(true); }
/** * THIS METHOD IS NOT PART OF THE PUBLIC API, DO NOT CALL IT * * @see org.apache.wicket.markup.parser.XmlTag#put(String, CharSequence) * @param key The key * @param value The value */ public final void putInternal(String key, CharSequence value) { xmlTag.put(key, value); setModified(true); }
/** * @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); setModified(true); }
/** * @see org.apache.wicket.markup.parser.XmlTag#getAttributes() * @return The tag#s attributes */ public final IValueMap getAttributes() { return xmlTag.getAttributes(); }
/** @see org.apache.wicket.markup.MarkupElement#toCharSequence() */ @Override public CharSequence toCharSequence() { return xmlTag.toCharSequence(); }
/** * @see org.apache.wicket.markup.parser.XmlTag#setNamespace(String) * @param namespace New tag name namespace */ public final void setNamespace(String namespace) { xmlTag.setNamespace(namespace); }
/** * @see org.apache.wicket.markup.parser.XmlTag#isOpenClose() * @return True if this tag is an open and a close tag */ public final boolean isOpenClose() { return xmlTag.isOpenClose(); }
/** @return the tag type (OPEN, CLOSE or OPEN_CLOSE). */ public final TagType getType() { return xmlTag.getType(); }
/** * @see org.apache.wicket.markup.parser.XmlTag#getPos() * @return Tag location (index in input string) */ public final int getPos() { return xmlTag.getPos(); }
/** @return The tag's namespace */ public final String getNamespace() { return xmlTag.getNamespace(); }
/** * Gets the length of the tag in characters. * * @return The tag's length */ public final int getLength() { return xmlTag.getLength(); }
/** * A convenient method. The same as getAttributes().getString(name) * * @param name * @return The attributes value */ public final String getAttribute(String name) { return xmlTag.getAttributes().getString(name); }
/** * @see org.apache.wicket.markup.parser.XmlTag#putAll(Map) * @param map a key/value map */ public final void putAll(final Map<String, Object> map) { xmlTag.putAll(map); setModified(true); }
/** * @see org.apache.wicket.markup.parser.XmlTag#remove(String) * @param key The key to remove */ public final void remove(String key) { xmlTag.remove(key); setModified(true); }
/** * @param id Required component id * @return True if this tag is an openclose tag with the given component id * @see org.apache.wicket.markup.parser.XmlTag#isOpenClose() */ public final boolean isOpenClose(String id) { return xmlTag.isOpenClose() && this.id.equals(id); }
/** * 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); } }
/** * Makes this tag object immutable by making the attribute map unmodifiable. Immutable tags cannot * be made mutable again. They can only be copied into new mutable tag objects. */ public final void makeImmutable() { xmlTag.makeImmutable(); }
/** * Converts this object to a string representation including useful information for debugging * * @return String version of this object */ @Override public final String toUserDebugString() { return xmlTag.toUserDebugString(); }
/** * Automatically create a XmlTag, assign the name and the type, and construct a ComponentTag based * on this XmlTag. * * @param name The name of html tag * @param type The type of tag */ public ComponentTag(final String name, final XmlTag.TagType type) { final XmlTag tag = new XmlTag(); tag.setName(name); tag.setType(type); xmlTag = tag; }