< prev index next >
src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java
Print this page
@@ -44,11 +44,11 @@
* multiple views over the same model can be rendered
* differently, etc. This can be thought of as a CSS
* rule repository. The key for CSS attributes is an
* object of type CSS.Attribute. The type of the value
* is up to the StyleSheet implementation, but the
- * <code>toString</code> method is required
+ * {@code toString} method is required
* to return a string representation of CSS value.
* <p>
* The primary entry point for HTML View implementations
* to get their attributes is the
* {@link #getViewAttributes getViewAttributes}
@@ -99,25 +99,25 @@
*
* </code></pre>
* <p>
* The semantics for when a CSS style should overide visual attributes
* defined by an element are not well defined. For example, the html
- * <code><body bgcolor=red></code> makes the body have a red
+ * {@code <body bgcolor=red>} makes the body have a red
* background. But if the html file also contains the CSS rule
- * <code>body { background: blue }</code> it becomes less clear as to
+ * {@code body { background: blue }} it becomes less clear as to
* what color the background of the body should be. The current
* implementation gives visual attributes defined in the element the
* highest precedence, that is they are always checked before any styles.
* Therefore, in the previous example the background would have a
* red color as the body element defines the background color to be red.
* <p>
* As already mentioned this supports CSS. We don't support the full CSS
* spec. Refer to the javadoc of the CSS class to see what properties
* we support. The two major CSS parsing related
* concepts we do not currently
- * support are pseudo selectors, such as <code>A:link { color: red }</code>,
- * and the <code>important</code> modifier.
+ * support are pseudo selectors, such as {@code A:link { color: red }},
+ * and the {@code important} modifier.
*
* @implNote This implementation is currently
* incomplete. It can be replaced with alternative implementations
* that are complete. Future versions of this class will provide
* better CSS support.
@@ -261,12 +261,12 @@
}
}
/**
* Fetches the rule that best matches the selector given
- * in string form. Where <code>selector</code> is a space separated
- * String of the element names. For example, <code>selector</code>
+ * in string form. Where {@code selector} is a space separated
+ * String of the element names. For example, {@code selector}
* might be 'html body tr td''<p>
* The attributes of the returned Style will change
* as rules are added and removed. That is if you to ask for a rule
* with a selector "table p" and a new rule was added with a selector
* of "p" the returned Style would include the new attributes from
@@ -394,12 +394,12 @@
}
super.removeStyle(nm);
}
/**
- * Adds the rules from the StyleSheet <code>ss</code> to those of
- * the receiver. <code>ss's</code> rules will override the rules of
+ * Adds the rules from the StyleSheet {@code ss} to those of
+ * the receiver. {@code ss's} rules will override the rules of
* any previously added style sheets. An added StyleSheet will never
* override the rules of the receiving style sheet.
*
* @param ss a StyleSheet
* @since 1.3
@@ -420,11 +420,11 @@
}
}
}
/**
- * Removes the StyleSheet <code>ss</code> from those of the receiver.
+ * Removes the StyleSheet {@code ss} from those of the receiver.
*
* @param ss a StyleSheet
* @since 1.3
*/
public void removeStyleSheet(StyleSheet ss) {
@@ -467,11 +467,11 @@
}
return retValue;
}
/**
- * Imports a style sheet from <code>url</code>. The resulting rules
+ * Imports a style sheet from {@code url}. The resulting rules
* are directly added to the receiver. If you do not want the rules
* to become part of the receiver, create a new StyleSheet and use
* addStyleSheet to link it in.
*
* @param url an url
@@ -493,11 +493,11 @@
}
}
/**
* Sets the base. All import statements that are relative, will be
- * relative to <code>base</code>.
+ * relative to {@code base}.
*
* @param base a base.
* @since 1.3
*/
public void setBase(URL base) {
@@ -1029,11 +1029,11 @@
return CSS.stringToColor(string);
}
/**
* Returns the ImageIcon to draw in the background for
- * <code>attr</code>.
+ * {@code attr}.
*/
ImageIcon getBackgroundImage(AttributeSet attr) {
Object value = attr.getAttribute(CSS.Attribute.BACKGROUND_IMAGE);
if (value != null) {
@@ -1095,11 +1095,11 @@
// the sheet.
//
/**
* Updates the attributes of the rules to reference any related
- * rules in <code>ss</code>.
+ * rules in {@code ss}.
*/
private synchronized void linkStyleSheetAt(StyleSheet ss, int index) {
if (resolvedStyles.size() > 0) {
Enumeration<ResolvedStyle> values = resolvedStyles.elements();
while (values.hasMoreElements()) {
@@ -1109,12 +1109,12 @@
}
}
}
/**
- * Removes references to the rules in <code>ss</code>.
- * <code>index</code> gives the index the StyleSheet was at, that is
+ * Removes references to the rules in {@code ss}.
+ * {@code index} gives the index the StyleSheet was at, that is
* how many StyleSheets had been added before it.
*/
private synchronized void unlinkStyleSheet(StyleSheet ss, int index) {
if (resolvedStyles.size() > 0) {
Enumeration<ResolvedStyle> values = resolvedStyles.elements();
@@ -1305,11 +1305,11 @@
}
return retStyle;
}
/**
- * Returns the resolved style for <code>selector</code>. This will
+ * Returns the resolved style for {@code selector}. This will
* create the resolved style, if necessary.
*/
private synchronized Style getResolvedStyle(String selector,
Vector<Element> elements,
HTML.Tag t) {
@@ -1319,11 +1319,11 @@
}
return retStyle;
}
/**
- * Returns the resolved style for <code>selector</code>. This will
+ * Returns the resolved style for {@code selector}. This will
* create the resolved style, if necessary.
*/
private synchronized Style getResolvedStyle(String selector) {
Style retStyle = resolvedStyles.get(selector);
if (retStyle == null) {
@@ -1331,12 +1331,12 @@
}
return retStyle;
}
/**
- * Adds <code>mapping</code> to <code>elements</code>. It is added
- * such that <code>elements</code> will remain ordered by
+ * Adds {@code mapping} to {@code elements}. It is added
+ * such that {@code elements} will remain ordered by
* specificity.
*/
private void addSortedStyle(SelectorMapping mapping, Vector<SelectorMapping> elements) {
int size = elements.size();
@@ -1352,13 +1352,13 @@
}
elements.addElement(mapping);
}
/**
- * Adds <code>parentMapping</code> to <code>styles</code>, and
- * recursively calls this method if <code>parentMapping</code> has
- * any child mappings for any of the Elements in <code>elements</code>.
+ * Adds {@code parentMapping} to {@code styles}, and
+ * recursively calls this method if {@code parentMapping} has
+ * any child mappings for any of the Elements in {@code elements}.
*/
private synchronized void getStyles(SelectorMapping parentMapping,
Vector<SelectorMapping> styles,
String[] tags, String[] ids, String[] classes,
int index, int numElements,
@@ -1415,11 +1415,11 @@
}
}
/**
* Creates and returns a Style containing all the rules that match
- * <code>selector</code>.
+ * {@code selector}.
*/
private synchronized Style createResolvedStyle(String selector,
String[] tags,
String[] ids, String[] classes) {
SearchBuffer sb = SearchBuffer.obtainSearchBuffer();
@@ -1498,18 +1498,18 @@
}
}
/**
* Creates and returns a Style containing all the rules that
- * matches <code>selector</code>.
+ * matches {@code selector}.
*
* @param elements a Vector of all the Elements
* the style is being asked for. The
* first Element is the deepest Element, with the last Element
* representing the root.
* @param t the Tag to use for
- * the first Element in <code>elements</code>
+ * the first Element in {@code elements}
*/
private Style createResolvedStyle(String selector, Vector<Element> elements,
HTML.Tag t) {
int numElements = elements.size();
// Build three arrays, one for tags, one for class's, and one for
@@ -1562,12 +1562,12 @@
return createResolvedStyle(selector, tags, ids, classes);
}
/**
* Creates and returns a Style containing all the rules that match
- * <code>selector</code>. It is assumed that each simple selector
- * in <code>selector</code> is separated by a space.
+ * {@code selector}. It is assumed that each simple selector
+ * in {@code selector} is separated by a space.
*/
private Style createResolvedStyle(String selector) {
SearchBuffer sb = SearchBuffer.obtainSearchBuffer();
// Will contain the tags, ids, and classes, in that order.
@SuppressWarnings("unchecked")
@@ -1763,11 +1763,11 @@
}
return sb;
}
/**
- * Adds <code>sb</code> to the stack of SearchBuffers that can
+ * Adds {@code sb} to the stack of SearchBuffers that can
* be used.
*/
static void releaseSearchBuffer(SearchBuffer sb) {
sb.empty();
searchBuffers.push(sb);
@@ -2155,11 +2155,11 @@
}
return childtype;
}
/**
- * Obtains the starting index from <code>parent</code>.
+ * Obtains the starting index from {@code parent}.
*/
private void getStart(View parent) {
checkedForStart = true;
Element element = parent.getElement();
if (element != null) {
@@ -2178,12 +2178,12 @@
}
}
/**
* Returns an integer that should be used to render the child at
- * <code>childIndex</code> with. The retValue will usually be
- * <code>childIndex</code> + 1, unless <code>parentView</code>
+ * {@code childIndex} with. The retValue will usually be
+ * {@code childIndex} + 1, unless {@code parentView}
* has some Views that do not represent LI's, or one of the views
* has a HTML.Attribute.START specified.
*/
private int getRenderIndex(View parentView, int childIndex) {
if (!checkedForStart) {
@@ -2858,11 +2858,11 @@
}
/**
* Inserts a Style into the receiver so that the styles the
* receiver represents are still ordered by specificity.
- * <code>style</code> will be added before any extended styles, that
+ * {@code style} will be added before any extended styles, that
* is before extendedIndex.
*/
synchronized void insertStyle(Style style, int specificity) {
AttributeSet[] attrs = getAttributes();
int maxCounter = attrs.length;
@@ -2877,11 +2877,11 @@
extendedIndex++;
}
/**
* Removes a previously added style. This will do nothing if
- * <code>style</code> is not referenced by the receiver.
+ * {@code style} is not referenced by the receiver.
*/
synchronized void removeStyle(Style style) {
AttributeSet[] attrs = getAttributes();
for (int counter = attrs.length - 1; counter >= 0; counter--) {
@@ -2894,35 +2894,35 @@
}
}
}
/**
- * Adds <code>s</code> as one of the Attributesets to look up
+ * Adds {@code s} as one of the Attributesets to look up
* attributes in.
*/
synchronized void insertExtendedStyleAt(Style attr, int index) {
insertAttributeSetAt(attr, extendedIndex + index);
}
/**
- * Adds <code>s</code> as one of the AttributeSets to look up
+ * Adds {@code s} as one of the AttributeSets to look up
* attributes in. It will be the AttributeSet last checked.
*/
synchronized void addExtendedStyle(Style attr) {
insertAttributeSetAt(attr, getAttributes().length);
}
/**
- * Removes the style at <code>index</code> +
- * <code>extendedIndex</code>.
+ * Removes the style at {@code index} +
+ * {@code extendedIndex}.
*/
synchronized void removeExtendedStyleAt(int index) {
removeAttributeSetAt(extendedIndex + index);
}
/**
- * Returns true if the receiver matches <code>selector</code>, where
+ * Returns true if the receiver matches {@code selector}, where
* a match is defined by the CSS rule matching.
* Each simple selector must be separated by a single space.
*/
protected boolean matches(String selector) {
int sLast = selector.length();
@@ -3082,11 +3082,11 @@
}
/**
* SelectorMapping contains a specifitiy, as an integer, and an associated
- * Style. It can also reference children <code>SelectorMapping</code>s,
+ * Style. It can also reference children {@code SelectorMapping}s,
* so that it behaves like a tree.
* <p>
* This is not thread safe, it is assumed the caller will take the
* necessary precations if this is to be used in a threaded environment.
*/
@@ -3117,12 +3117,12 @@
return style;
}
/**
* Returns the child mapping identified by the simple selector
- * <code>selector</code>. If a child mapping does not exist for
- *<code>selector</code>, and <code>create</code> is true, a new
+ * {@code selector}. If a child mapping does not exist for
+ *{@code selector}, and {@code create} is true, a new
* one will be created.
*/
public SelectorMapping getChildSelectorMapping(String selector,
boolean create) {
SelectorMapping retValue = null;
@@ -3141,20 +3141,20 @@
}
return retValue;
}
/**
- * Creates a child <code>SelectorMapping</code> with the specified
- * <code>specificity</code>.
+ * Creates a child {@code SelectorMapping} with the specified
+ * {@code specificity}.
*/
protected SelectorMapping createChildSelectorMapping(int specificity) {
return new SelectorMapping(specificity);
}
/**
* Returns the specificity for the child selector
- * <code>selector</code>.
+ * {@code selector}.
*/
protected int getChildSpecificity(String selector) {
// class (.) 100
// id (#) 10000
char firstChar = selector.charAt(0);
@@ -3262,12 +3262,12 @@
// CSSParserCallback methods, public to implement the interface.
//
/**
* Invoked when a valid @import is encountered, will call
- * <code>importStyleSheet</code> if a
- * <code>MalformedURLException</code> is not thrown in creating
+ * {@code importStyleSheet} if a
+ * {@code MalformedURLException} is not thrown in creating
* the URL.
*/
public void handleImport(String importString) {
URL url = CSS.getURL(base, importString);
if (url != null) {
< prev index next >