📄 componenttag.java
字号:
public final void put(final String key, final boolean value) { xmlTag.put(key, value); } /** * @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); } /** * @see org.apache.wicket.markup.parser.XmlTag#put(String, CharSequence) * @param key * The key * @param value * The value */ public final void put(String key, CharSequence value) { xmlTag.put(key, value); } /** * @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); } /** * @see org.apache.wicket.markup.parser.XmlTag#putAll(Map) * @param map * a key/value map */ public final void putAll(final Map map) { xmlTag.putAll(map); } /** * @see org.apache.wicket.markup.parser.XmlTag#remove(String) * @param key * The key to remove */ public final void remove(String key) { xmlTag.remove(key); } /** * Gets whether this tag does not require a closing tag. * * @return True if this tag does not require a closing tag */ public final boolean requiresCloseTag() { if (getNamespace() == null) { return HtmlHandler.requiresCloseTag(getName()); } else { return HtmlHandler.requiresCloseTag(getNamespace() + ":" + getName()); } } /** * Set the component's id. The value is usually taken from the tag's id attribute, e.g. * wicket:id="componentId". * * @param id * The component's id assigned to the tag. */ public final void setId(final String id) { this.id = id; } /** * @see org.apache.wicket.markup.parser.XmlTag#setName(String) * @param name * New tag name */ public final void setName(String name) { xmlTag.setName(name); } /** * @see org.apache.wicket.markup.parser.XmlTag#setNamespace(String) * @param namespace * New tag name namespace */ public final void setNamespace(String namespace) { xmlTag.setNamespace(namespace); } /** * Assuming this is a close tag, assign it's corresponding open tag. * * @param tag * the open-tag * @throws RuntimeException * if 'this' is not a close tag */ public final void setOpenTag(final ComponentTag tag) { closes = tag; getXmlTag().setOpenTag(tag.getXmlTag()); } /** * 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); } /** * @return A synthetic close tag for this tag */ public final CharSequence syntheticCloseTagString() { AppendingStringBuffer buf = new AppendingStringBuffer(); buf.append("</"); if (getNamespace() != null) { buf.append(getNamespace()).append(":"); } buf.append(getName()).append(">"); return buf; } /** * @see org.apache.wicket.markup.MarkupElement#toCharSequence() */ public CharSequence toCharSequence() { return xmlTag.toCharSequence(); } /** * Converts this object to a string representation. * * @return String version of this object */ public final String toString() { return toCharSequence().toString(); } /** * Write the tag to the response * * @param response * The response to write to * @param stripWicketAttributes * if true, wicket:id are removed from output * @param namespace * Wicket's namespace to use */ public final void writeOutput(final Response response, final boolean stripWicketAttributes, final String namespace) { response.write("<"); if (getType() == XmlTag.CLOSE) { response.write("/"); } if (getNamespace() != null) { response.write(getNamespace()); response.write(":"); } response.write(getName()); String namespacePrefix = null; if (stripWicketAttributes == true) { namespacePrefix = namespace + ":"; } if (getAttributes().size() > 0) { final Iterator iterator = getAttributes().keySet().iterator(); while (iterator.hasNext()) { final String key = (String)iterator.next(); if (key == null) { continue; } if ((namespacePrefix == null) || (key.startsWith(namespacePrefix) == false)) { response.write(" "); response.write(key); CharSequence value = getString(key); // attributes without values are possible, e.g. 'disabled' if (value != null) { response.write("=\""); value = Strings.replaceAll(value, "\"", """); response.write(value); response.write("\""); } } } } if (getType() == XmlTag.OPEN_CLOSE) { response.write("/"); } response.write(">"); } /** * Converts this object to a string representation including useful information for debugging * * @return String version of this object */ public final String toUserDebugString() { return xmlTag.toUserDebugString(); } /** * @return Returns the underlying xml tag. */ final XmlTag getXmlTag() { return xmlTag; } /** * Manually mark the ComponentTag being modified. Flagging the tag being modified does not * happen automatically. * * @param modified */ public final void setModified(final boolean modified) { this.modified = modified; } /** * * @return True, if the component tag has been marked modified */ public final boolean isModified() { return modified; } /** * Gets the component path of wicket elements * * @return path */ public String getPath() { return path; } /** * Sets the component path of wicket elements * * @param path * path */ void setPath(final String path) { this.path = path; } /** * * @return True if the HTML tag (e.g. br) has no close tag */ public boolean hasNoCloseTag() { return hasNoCloseTag; } /** * True if the HTML tag (e.g. br) has no close tag * * @param hasNoCloseTag */ public void setHasNoCloseTag(boolean hasNoCloseTag) { this.hasNoCloseTag = hasNoCloseTag; } /** * In case of inherited markup, the base and the extended markups are merged and the information * about the tags origin is lost. In some cases like wicket:head and wicket:link this * information however is required. * * @return wicketHeaderClass */ public Class getMarkupClass() { return (markupClassRef == null ? null : (Class)markupClassRef.get()); } /** * Set the class of wicket component which contains the wicket:head tag. * * @param wicketHeaderClass * wicketHeaderClass */ public void setMarkupClass(Class wicketHeaderClass) { if (wicketHeaderClass == null) { markupClassRef = null; } else { markupClassRef = new WeakReference(wicketHeaderClass); } } /** * @see org.apache.wicket.markup.MarkupElement#equalTo(org.apache.wicket.markup.MarkupElement) */ public boolean equalTo(final MarkupElement element) { if (element instanceof ComponentTag) { final ComponentTag that = (ComponentTag)element; return getXmlTag().equalTo(that.getXmlTag()); } return false; } /** * Gets ignore. * * @return If true than MarkupParser will remove it from the markup */ public boolean isIgnore() { return ignore; } /** * Sets ignore. * * @param ignore * If true than MarkupParser will remove it from the markup */ public void setIgnore(boolean ignore) { this.ignore = ignore; } /** * @return True, if wicket:id has been automatically created (internal component) */ public boolean isAutoComponentTag() { return autoComponent; } /** * @param auto * True, if wicket:id has been automatically created (internal component) */ public void setAutoComponentTag(boolean auto) { autoComponent = auto; } /** * Gets userData. * * @param key * The key to store and retrieve the value * @return userData */ public Object getUserData(final String key) { if (userData == null) { return null; } return userData.get(key); } /** * Sets userData. * * @param key * The key to store and retrieve the value * @param value * The user specific value to store */ public void setUserData(final String key, final Object value) { if (userData == null) { userData = new HashMap(); } userData.put(key, value); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -