< prev index next >

src/java.desktop/share/classes/javax/swing/text/html/HTML.java

Print this page

        

*** 29,39 **** import javax.swing.text.AttributeSet; import javax.swing.text.StyleConstants; import javax.swing.text.StyleContext; /** ! * Constants used in the <code>HTMLDocument</code>. These * are basically tag and attribute definitions. * * @author Timothy Prinzing * @author Sunita Mani * --- 29,39 ---- import javax.swing.text.AttributeSet; import javax.swing.text.StyleConstants; import javax.swing.text.StyleContext; /** ! * Constants used in the {@code HTMLDocument}. These * are basically tag and attribute definitions. * * @author Timothy Prinzing * @author Sunita Mani *
*** 51,140 **** /** @since 1.3 */ public Tag() {} /** ! * Creates a new <code>Tag</code> with the specified <code>id</code>, ! * and with <code>causesBreak</code> and <code>isBlock</code> ! * set to <code>false</code>. * * @param id the id of the new tag */ protected Tag(String id) { this(id, false, false); } /** ! * Creates a new <code>Tag</code> with the specified <code>id</code>; ! * <code>causesBreak</code> and <code>isBlock</code> are defined * by the user. * * @param id the id of the new tag ! * @param causesBreak <code>true</code> if this tag * causes a break to the flow of data ! * @param isBlock <code>true</code> if the tag is used * to add structure to a document */ protected Tag(String id, boolean causesBreak, boolean isBlock) { name = id; this.breakTag = causesBreak; this.blockTag = isBlock; } /** ! * Returns <code>true</code> if this tag is a block * tag, which is a tag used to add structure to a * document. * ! * @return <code>true</code> if this tag is a block ! * tag, otherwise returns <code>false</code> */ public boolean isBlock() { return blockTag; } /** ! * Returns <code>true</code> if this tag causes a * line break to the flow of data, otherwise returns ! * <code>false</code>. * ! * @return <code>true</code> if this tag causes a * line break to the flow of data, otherwise returns ! * <code>false</code> */ public boolean breaksFlow() { return breakTag; } /** ! * Returns <code>true</code> if this tag is pre-formatted, ! * which is true if the tag is either <code>PRE</code> or ! * <code>TEXTAREA</code>. * ! * @return <code>true</code> if this tag is pre-formatted, ! * otherwise returns <code>false</code> */ public boolean isPreformatted() { return (this == PRE || this == TEXTAREA); } /** * Returns the string representation of the * tag. * ! * @return the <code>String</code> representation of the tag */ public String toString() { return name; } /** ! * Returns <code>true</code> if this tag is considered to be a paragraph ! * in the internal HTML model. <code>false</code> - otherwise. * ! * @return <code>true</code> if this tag is considered to be a paragraph ! * in the internal HTML model. <code>false</code> - otherwise. * @see HTMLDocument.HTMLReader.ParagraphAction */ boolean isParagraph() { return ( this == P --- 51,140 ---- /** @since 1.3 */ public Tag() {} /** ! * Creates a new {@code Tag} with the specified {@code id}, ! * and with {@code causesBreak} and {@code isBlock} ! * set to {@code false}. * * @param id the id of the new tag */ protected Tag(String id) { this(id, false, false); } /** ! * Creates a new {@code Tag} with the specified {@code id}; ! * {@code causesBreak} and {@code isBlock} are defined * by the user. * * @param id the id of the new tag ! * @param causesBreak {@code true} if this tag * causes a break to the flow of data ! * @param isBlock {@code true} if the tag is used * to add structure to a document */ protected Tag(String id, boolean causesBreak, boolean isBlock) { name = id; this.breakTag = causesBreak; this.blockTag = isBlock; } /** ! * Returns {@code true} if this tag is a block * tag, which is a tag used to add structure to a * document. * ! * @return {@code true} if this tag is a block ! * tag, otherwise returns {@code false} */ public boolean isBlock() { return blockTag; } /** ! * Returns {@code true} if this tag causes a * line break to the flow of data, otherwise returns ! * {@code false}. * ! * @return {@code true} if this tag causes a * line break to the flow of data, otherwise returns ! * {@code false} */ public boolean breaksFlow() { return breakTag; } /** ! * Returns {@code true} if this tag is pre-formatted, ! * which is true if the tag is either {@code PRE} or ! * {@code TEXTAREA}. * ! * @return {@code true} if this tag is pre-formatted, ! * otherwise returns {@code false} */ public boolean isPreformatted() { return (this == PRE || this == TEXTAREA); } /** * Returns the string representation of the * tag. * ! * @return the {@code String} representation of the tag */ public String toString() { return name; } /** ! * Returns {@code true} if this tag is considered to be a paragraph ! * in the internal HTML model. {@code false} - otherwise. * ! * @return {@code true} if this tag is considered to be a paragraph ! * in the internal HTML model. {@code false} - otherwise. * @see HTMLDocument.HTMLReader.ParagraphAction */ boolean isParagraph() { return ( this == P
*** 578,589 **** // Serializable. @SuppressWarnings("serial") // Same-version serialization only public static class UnknownTag extends Tag implements Serializable { /** ! * Creates a new <code>UnknownTag</code> with the specified ! * <code>id</code>. * @param id the id of the new tag */ public UnknownTag(String id) { super(id); } --- 578,589 ---- // Serializable. @SuppressWarnings("serial") // Same-version serialization only public static class UnknownTag extends Tag implements Serializable { /** ! * Creates a new {@code UnknownTag} with the specified ! * {@code id}. * @param id the id of the new tag */ public UnknownTag(String id) { super(id); }
*** 596,612 **** return toString().hashCode(); } /** * Compares this object to the specified object. ! * The result is <code>true</code> if and only if the argument is not ! * <code>null</code> and is an <code>UnknownTag</code> object * with the same name. * * @param obj the object to compare this tag with ! * @return <code>true</code> if the objects are equal; ! * <code>false</code> otherwise */ public boolean equals(Object obj) { if (obj instanceof UnknownTag) { return toString().equals(obj.toString()); } --- 596,612 ---- return toString().hashCode(); } /** * Compares this object to the specified object. ! * The result is {@code true} if and only if the argument is not ! * {@code null} and is an {@code UnknownTag} object * with the same name. * * @param obj the object to compare this tag with ! * @return {@code true} if the objects are equal; ! * {@code false} otherwise */ public boolean equals(Object obj) { if (obj instanceof UnknownTag) { return toString().equals(obj.toString()); }
*** 637,650 **** * attribute. */ public static final class Attribute { /** ! * Creates a new <code>Attribute</code> with the specified ! * <code>id</code>. * ! * @param id the id of the new <code>Attribute</code> */ Attribute(String id) { name = id; } --- 637,650 ---- * attribute. */ public static final class Attribute { /** ! * Creates a new {@code Attribute} with the specified ! * {@code id}. * ! * @param id the id of the new {@code Attribute} */ Attribute(String id) { name = id; }
*** 1205,1235 **** * META, NOBR, NOFRAMES, OBJECT, OL, OPTION, P, PARAM, * PRE, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, S, * STRONG, STYLE, SUB, SUP, TABLE, TD, TEXTAREA, * TH, TITLE, TR, TT, U, UL, VAR}. If the given * name does not represent one of the well-known tags, then ! * <code>null</code> will be returned. * ! * @param tagName the <code>String</code> name requested ! * @return a tag constant corresponding to the <code>tagName</code>, ! * or <code>null</code> if not found */ public static Tag getTag(String tagName) { Tag t = tagHashtable.get(tagName); return (t == null ? null : t); } /** ! * Returns the HTML <code>Tag</code> associated with the ! * <code>StyleConstants</code> key <code>sc</code>. ! * If no matching <code>Tag</code> is found, returns ! * <code>null</code>. * ! * @param sc the <code>StyleConstants</code> key ! * @return tag which corresponds to <code>sc</code>, or ! * <code>null</code> if not found */ static Tag getTagForStyleConstantsKey(StyleConstants sc) { return scMapping.get(sc); } --- 1205,1235 ---- * META, NOBR, NOFRAMES, OBJECT, OL, OPTION, P, PARAM, * PRE, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, S, * STRONG, STYLE, SUB, SUP, TABLE, TD, TEXTAREA, * TH, TITLE, TR, TT, U, UL, VAR}. If the given * name does not represent one of the well-known tags, then ! * {@code null} will be returned. * ! * @param tagName the {@code String} name requested ! * @return a tag constant corresponding to the {@code tagName}, ! * or {@code null} if not found */ public static Tag getTag(String tagName) { Tag t = tagHashtable.get(tagName); return (t == null ? null : t); } /** ! * Returns the HTML {@code Tag} associated with the ! * {@code StyleConstants} key {@code sc}. ! * If no matching {@code Tag} is found, returns ! * {@code null}. * ! * @param sc the {@code StyleConstants} key ! * @return tag which corresponds to {@code sc}, or ! * {@code null} if not found */ static Tag getTagForStyleConstantsKey(StyleConstants sc) { return scMapping.get(sc); }
*** 1298,1311 **** * DUMMY, CELLSPACING, CELLPADDING, VALIGN, HALIGN, NOWRAP, ROWSPAN, * COLSPAN, PROMPT, HTTPEQUIV, CONTENT, LANGUAGE, VERSION, N, * FRAMEBORDER, MARGINWIDTH, MARGINHEIGHT, SCROLLING, NORESIZE, * MEDIA, ENDTAG}). * If the given name does not represent one of the well-known attributes, ! * then <code>null</code> will be returned. * ! * @param attName the <code>String</code> requested ! * @return the <code>Attribute</code> corresponding to <code>attName</code> */ public static Attribute getAttributeKey(String attName) { Attribute a = attHashtable.get(attName); if (a == null) { return null; --- 1298,1311 ---- * DUMMY, CELLSPACING, CELLPADDING, VALIGN, HALIGN, NOWRAP, ROWSPAN, * COLSPAN, PROMPT, HTTPEQUIV, CONTENT, LANGUAGE, VERSION, N, * FRAMEBORDER, MARGINWIDTH, MARGINHEIGHT, SCROLLING, NORESIZE, * MEDIA, ENDTAG}). * If the given name does not represent one of the well-known attributes, ! * then {@code null} will be returned. * ! * @param attName the {@code String} requested ! * @return the {@code Attribute} corresponding to {@code attName} */ public static Attribute getAttributeKey(String attName) { Attribute a = attHashtable.get(attName); if (a == null) { return null;
< prev index next >