< prev index next >
src/java.desktop/share/classes/javax/swing/text/html/CSS.java
Print this page
@@ -733,13 +733,13 @@
}
}
}
/**
- * Sets the base font size. <code>sz</code> is a CSS value, and is
+ * Sets the base font size. {@code sz} is a CSS value, and is
* not necessarily the point size. Use getPointSize to determine the
- * point size corresponding to <code>sz</code>.
+ * point size corresponding to {@code sz}.
*/
void setBaseFontSize(int sz) {
if (sz < 1)
baseFontSize = 0;
else if (sz > 7)
@@ -773,12 +773,12 @@
int getBaseFontSize() {
return baseFontSize;
}
/**
- * Parses the CSS property <code>key</code> with value
- * <code>value</code> placing the result in <code>att</code>.
+ * Parses the CSS property {@code key} with value
+ * {@code value} placing the result in {@code att}.
*/
void addInternalCSSValue(MutableAttributeSet attr,
CSS.Attribute key, String value) {
if (key == CSS.Attribute.FONT) {
ShorthandFontParser.parseShorthandFont(this, value, attr);
@@ -821,13 +821,13 @@
}
}
}
/**
- * Gets the internal CSS representation of <code>value</code> which is
- * a CSS value of the CSS attribute named <code>key</code>. The receiver
- * should not modify <code>value</code>, and the first <code>count</code>
+ * Gets the internal CSS representation of {@code value} which is
+ * a CSS value of the CSS attribute named {@code key}. The receiver
+ * should not modify {@code value}, and the first {@code count}
* strings are valid.
*/
Object getInternalCSSValue(CSS.Attribute key, String value) {
CssValue conv = (CssValue) valueConvertor.get(key);
Object r = conv.parseCssValue(value);
@@ -854,11 +854,11 @@
return null;
}
/**
* Converts the passed in CSS value to a StyleConstants value.
- * <code>key</code> identifies the CSS attribute being mapped.
+ * {@code key} identifies the CSS attribute being mapped.
*/
Object cssValueToStyleConstantsValue(StyleConstants key, Object value) {
if (value instanceof CssValue) {
return ((CssValue)value).toStyleConstants(key, null);
}
@@ -866,11 +866,11 @@
}
/**
* Returns the font for the values in the passed in AttributeSet.
* It is assumed the keys will be CSS.Attribute keys.
- * <code>sc</code> is the StyleContext that will be messaged to get
+ * {@code sc} is the StyleContext that will be messaged to get
* the font once the size, name and style have been determined.
*/
Font getFont(StyleContext sc, AttributeSet a, int defaultSize, StyleSheet ss) {
ss = getStyleSheet(ss);
int size = getFontSize(a, defaultSize, ss);
@@ -928,11 +928,11 @@
/**
* Takes a set of attributes and turn it into a color
* specification. This might be used to specify things
* like brighter, more hue, etc.
- * This will return null if there is no value for <code>key</code>.
+ * This will return null if there is no value for {@code key}.
*
* @param key CSS.Attribute identifying where color is stored.
* @param a the set of attributes
* @return the color
*/
@@ -967,12 +967,12 @@
}
return 0;
}
/**
- * Returns the length of the attribute in <code>a</code> with
- * key <code>key</code>.
+ * Returns the length of the attribute in {@code a} with
+ * key {@code key}.
*/
float getLength(AttributeSet a, CSS.Attribute key, StyleSheet ss) {
ss = getStyleSheet(ss);
LengthValue lv = (LengthValue) a.getAttribute(key);
boolean isW3CLengthUnits = (ss == null) ? false : ss.isW3CLengthUnits();
@@ -1234,33 +1234,33 @@
System.arraycopy(Attribute.allAttributes, 0, keys, 0, Attribute.allAttributes.length);
return keys;
}
/**
- * Translates a string to a <code>CSS.Attribute</code> object.
- * This will return <code>null</code> if there is no attribute
+ * Translates a string to a {@code CSS.Attribute} object.
+ * This will return {@code null} if there is no attribute
* by the given name.
*
* @param name the name of the CSS attribute to fetch the
* typesafe enumeration for
- * @return the <code>CSS.Attribute</code> object,
- * or <code>null</code> if the string
+ * @return the {@code CSS.Attribute} object,
+ * or {@code null} if the string
* doesn't represent a valid attribute key
*/
public static final Attribute getAttribute(String name) {
return attributeMap.get(name);
}
/**
- * Translates a string to a <code>CSS.Value</code> object.
- * This will return <code>null</code> if there is no value
+ * Translates a string to a {@code CSS.Value} object.
+ * This will return {@code null} if there is no value
* by the given name.
*
* @param name the name of the CSS value to fetch the
* typesafe enumeration for
- * @return the <code>CSS.Value</code> object,
- * or <code>null</code> if the string
+ * @return the {@code CSS.Value} object,
+ * or {@code null} if the string
* doesn't represent a valid CSS value name; this does
* not mean that it doesn't represent a valid CSS value
*/
static final Value getValue(String name) {
return valueMap.get(name);
@@ -1271,11 +1271,11 @@
// Conversion related methods/classes
//
/**
* Returns a URL for the given CSS url string. If relative,
- * <code>base</code> is used as the parent. If a valid URL can not
+ * {@code base} is used as the parent. If a valid URL can not
* be found, this will not throw a MalformedURLException, instead
* null will be returned.
*/
static URL getURL(URL base, String cssString) {
if (cssString == null) {
@@ -1422,11 +1422,11 @@
color = hexToColor(str); // sometimes get specified without leading #
return color;
}
/**
- * Parses a String in the format <code>rgb(r, g, b)</code> where
+ * Parses a String in the format {@code rgb(r, g, b)} where
* each of the Color components is either an integer, or a floating number
* with a % after indicating a percentage value of 255. Values are
* constrained to fit with 0-255. The resulting Color is returned.
*/
private static Color parseRGB(String string) {
@@ -1440,12 +1440,12 @@
return new Color(red, green, blue);
}
/**
- * Returns the next integer value from <code>string</code> starting
- * at <code>index[0]</code>. The value can either can an integer, or
+ * Returns the next integer value from {@code string} starting
+ * at {@code index[0]}. The value can either can an integer, or
* a percentage (floating number ending with %), in which case it is
* multiplied by 255.
*/
private static int getColorComponent(String string, int[] index) {
int length = string.length();
@@ -1504,11 +1504,11 @@
return getIndexOfSize(pt, sizeMap);
}
/**
- * @return an array of all the strings in <code>value</code>
+ * @return an array of all the strings in {@code value}
* that are separated by whitespace.
*/
static String[] parseStrings(String value) {
int current, last;
int length = (value == null) ? 0 : value.length();
@@ -1781,34 +1781,34 @@
Object parseHtmlValue(String value) {
return parseCssValue(value);
}
/**
- * Converts a <code>StyleConstants</code> attribute value to
+ * Converts a {@code StyleConstants} attribute value to
* a CSS attribute value. If there is no conversion,
- * returns <code>null</code>. By default, there is no conversion.
+ * returns {@code null}. By default, there is no conversion.
*
- * @param key the <code>StyleConstants</code> attribute
- * @param value the value of a <code>StyleConstants</code>
+ * @param key the {@code StyleConstants} attribute
+ * @param value the value of a {@code StyleConstants}
* attribute to be converted
* @return the CSS value that represents the
- * <code>StyleConstants</code> value
+ * {@code StyleConstants} value
*/
Object fromStyleConstants(StyleConstants key, Object value) {
return null;
}
/**
* Converts a CSS attribute value to a
- * <code>StyleConstants</code>
+ * {@code StyleConstants}
* value. If there is no conversion, returns
- * <code>null</code>.
+ * {@code null}.
* By default, there is no conversion.
*
- * @param key the <code>StyleConstants</code> attribute
- * @param v the view containing <code>AttributeSet</code>
- * @return the <code>StyleConstants</code> attribute value that
+ * @param key the {@code StyleConstants} attribute
+ * @param v the view containing {@code AttributeSet}
+ * @return the {@code StyleConstants} attribute value that
* represents the CSS attribute value
*/
Object toStyleConstants(StyleConstants key, View v) {
return null;
}
@@ -1849,19 +1849,19 @@
sv.svalue = value;
return sv;
}
/**
- * Converts a <code>StyleConstants</code> attribute value to
+ * Converts a {@code StyleConstants} attribute value to
* a CSS attribute value. If there is no conversion
- * returns <code>null</code>.
+ * returns {@code null}.
*
- * @param key the <code>StyleConstants</code> attribute
- * @param value the value of a <code>StyleConstants</code>
+ * @param key the {@code StyleConstants} attribute
+ * @param value the value of a {@code StyleConstants}
* attribute to be converted
* @return the CSS value that represents the
- * <code>StyleConstants</code> value
+ * {@code StyleConstants} value
*/
Object fromStyleConstants(StyleConstants key, Object value) {
if (key == StyleConstants.Italic) {
if (value.equals(Boolean.TRUE)) {
return parseCssValue("italic");
@@ -1911,16 +1911,16 @@
return null;
}
/**
* Converts a CSS attribute value to a
- * <code>StyleConstants</code> value.
- * If there is no conversion, returns <code>null</code>.
+ * {@code StyleConstants} value.
+ * If there is no conversion, returns {@code null}.
* By default, there is no conversion.
*
- * @param key the <code>StyleConstants</code> attribute
- * @return the <code>StyleConstants</code> attribute value that
+ * @param key the {@code StyleConstants} attribute
+ * @return the {@code StyleConstants} attribute value that
* represents the CSS attribute value
*/
Object toStyleConstants(StyleConstants key, View v) {
if (key == StyleConstants.Italic) {
if (svalue.indexOf("italic") >= 0) {
@@ -2117,19 +2117,19 @@
}
return fs;
}
/**
- * Converts a <code>StyleConstants</code> attribute value to
+ * Converts a {@code StyleConstants} attribute value to
* a CSS attribute value. If there is no conversion
- * returns <code>null</code>. By default, there is no conversion.
+ * returns {@code null}. By default, there is no conversion.
*
- * @param key the <code>StyleConstants</code> attribute
- * @param value the value of a <code>StyleConstants</code>
+ * @param key the {@code StyleConstants} attribute
+ * @param value the value of a {@code StyleConstants}
* attribute to be converted
* @return the CSS value that represents the
- * <code>StyleConstants</code> value
+ * {@code StyleConstants} value
*/
Object fromStyleConstants(StyleConstants key, Object value) {
if (value instanceof Number) {
FontSize fs = new FontSize();
@@ -2140,16 +2140,16 @@
}
return parseCssValue(value.toString());
}
/**
- * Converts a CSS attribute value to a <code>StyleConstants</code>
- * value. If there is no conversion, returns <code>null</code>.
+ * Converts a CSS attribute value to a {@code StyleConstants}
+ * value. If there is no conversion, returns {@code null}.
* By default, there is no conversion.
*
- * @param key the <code>StyleConstants</code> attribute
- * @return the <code>StyleConstants</code> attribute value that
+ * @param key the {@code StyleConstants} attribute
+ * @return the {@code StyleConstants} attribute value that
* represents the CSS attribute value
*/
Object toStyleConstants(StyleConstants key, View v) {
if (v != null) {
return Integer.valueOf(getValue(v.getAttributes(), null));
@@ -2228,31 +2228,31 @@
// TBD
return parseCssValue(value);
}
/**
- * Converts a <code>StyleConstants</code> attribute value to
+ * Converts a {@code StyleConstants} attribute value to
* a CSS attribute value. If there is no conversion
- * returns <code>null</code>. By default, there is no conversion.
+ * returns {@code null}. By default, there is no conversion.
*
- * @param key the <code>StyleConstants</code> attribute
- * @param value the value of a <code>StyleConstants</code>
+ * @param key the {@code StyleConstants} attribute
+ * @param value the value of a {@code StyleConstants}
* attribute to be converted
* @return the CSS value that represents the
- * <code>StyleConstants</code> value
+ * {@code StyleConstants} value
*/
Object fromStyleConstants(StyleConstants key, Object value) {
return parseCssValue(value.toString());
}
/**
- * Converts a CSS attribute value to a <code>StyleConstants</code>
- * value. If there is no conversion, returns <code>null</code>.
+ * Converts a CSS attribute value to a {@code StyleConstants}
+ * value. If there is no conversion, returns {@code null}.
* By default, there is no conversion.
*
- * @param key the <code>StyleConstants</code> attribute
- * @return the <code>StyleConstants</code> attribute value that
+ * @param key the {@code StyleConstants} attribute
+ * @return the {@code StyleConstants} attribute value that
* represents the CSS attribute value
*/
Object toStyleConstants(StyleConstants key, View v) {
return family;
}
@@ -2284,34 +2284,34 @@
}
return fw;
}
/**
- * Converts a <code>StyleConstants</code> attribute value to
+ * Converts a {@code StyleConstants} attribute value to
* a CSS attribute value. If there is no conversion
- * returns <code>null</code>. By default, there is no conversion.
+ * returns {@code null}. By default, there is no conversion.
*
- * @param key the <code>StyleConstants</code> attribute
- * @param value the value of a <code>StyleConstants</code>
+ * @param key the {@code StyleConstants} attribute
+ * @param value the value of a {@code StyleConstants}
* attribute to be converted
* @return the CSS value that represents the
- * <code>StyleConstants</code> value
+ * {@code StyleConstants} value
*/
Object fromStyleConstants(StyleConstants key, Object value) {
if (value.equals(Boolean.TRUE)) {
return parseCssValue("bold");
}
return parseCssValue("normal");
}
/**
- * Converts a CSS attribute value to a <code>StyleConstants</code>
- * value. If there is no conversion, returns <code>null</code>.
+ * Converts a CSS attribute value to a {@code StyleConstants}
+ * value. If there is no conversion, returns {@code null}.
* By default, there is no conversion.
*
- * @param key the <code>StyleConstants</code> attribute
- * @return the <code>StyleConstants</code> attribute value that
+ * @param key the {@code StyleConstants} attribute
+ * @return the {@code StyleConstants} attribute value that
* represents the CSS attribute value
*/
Object toStyleConstants(StyleConstants key, View v) {
return (weight > 500) ? Boolean.TRUE : Boolean.FALSE;
}
@@ -2348,34 +2348,34 @@
Object parseHtmlValue(String value) {
return parseCssValue(value);
}
/**
- * Converts a <code>StyleConstants</code> attribute value to
+ * Converts a {@code StyleConstants} attribute value to
* a CSS attribute value. If there is no conversion
- * returns <code>null</code>. By default, there is no conversion.
+ * returns {@code null}. By default, there is no conversion.
*
- * @param key the <code>StyleConstants</code> attribute
- * @param value the value of a <code>StyleConstants</code>
+ * @param key the {@code StyleConstants} attribute
+ * @param value the value of a {@code StyleConstants}
* attribute to be converted
* @return the CSS value that represents the
- * <code>StyleConstants</code> value
+ * {@code StyleConstants} value
*/
Object fromStyleConstants(StyleConstants key, Object value) {
ColorValue colorValue = new ColorValue();
colorValue.c = (Color)value;
colorValue.svalue = colorToHex(colorValue.c);
return colorValue;
}
/**
- * Converts a CSS attribute value to a <code>StyleConstants</code>
- * value. If there is no conversion, returns <code>null</code>.
+ * Converts a CSS attribute value to a {@code StyleConstants}
+ * value. If there is no conversion, returns {@code null}.
* By default, there is no conversion.
*
- * @param key the <code>StyleConstants</code> attribute
- * @return the <code>StyleConstants</code> attribute value that
+ * @param key the {@code StyleConstants} attribute
+ * @return the {@code StyleConstants} attribute value that
* represents the CSS attribute value
*/
Object toStyleConstants(StyleConstants key, View v) {
return c;
}
@@ -2463,11 +2463,11 @@
return getValue(0, isW3CLengthUnits);
}
/**
* Returns the length (span) to use. If the value represents
- * a percentage, it is scaled based on <code>currentValue</code>.
+ * a percentage, it is scaled based on {@code currentValue}.
*/
float getValue(float currentValue) {
return getValue(currentValue, false);
}
float getValue(float currentValue, boolean isW3CLengthUnits) {
@@ -2527,34 +2527,34 @@
value = "1";
}
return parseCssValue(value);
}
/**
- * Converts a <code>StyleConstants</code> attribute value to
+ * Converts a {@code StyleConstants} attribute value to
* a CSS attribute value. If there is no conversion,
- * returns <code>null</code>. By default, there is no conversion.
+ * returns {@code null}. By default, there is no conversion.
*
- * @param key the <code>StyleConstants</code> attribute
- * @param value the value of a <code>StyleConstants</code>
+ * @param key the {@code StyleConstants} attribute
+ * @param value the value of a {@code StyleConstants}
* attribute to be converted
* @return the CSS value that represents the
- * <code>StyleConstants</code> value
+ * {@code StyleConstants} value
*/
Object fromStyleConstants(StyleConstants key, Object value) {
LengthValue v = new LengthValue();
v.svalue = value.toString();
v.span = ((Float)value).floatValue();
return v;
}
/**
- * Converts a CSS attribute value to a <code>StyleConstants</code>
- * value. If there is no conversion, returns <code>null</code>.
+ * Converts a CSS attribute value to a {@code StyleConstants}
+ * value. If there is no conversion, returns {@code null}.
* By default, there is no conversion.
*
- * @param key the <code>StyleConstants</code> attribute
- * @return the <code>StyleConstants</code> attribute value that
+ * @param key the {@code StyleConstants} attribute
+ * @return the {@code StyleConstants} attribute value that
* represents the CSS attribute value
*/
Object toStyleConstants(StyleConstants key, View v) {
return new Float(getValue(false));
}
@@ -2961,12 +2961,12 @@
* for the other font properties. This expands the properties, placing
* them in the attributeset.
*/
static class ShorthandFontParser {
/**
- * Parses the shorthand font string <code>value</code>, placing the
- * result in <code>attr</code>.
+ * Parses the shorthand font string {@code value}, placing the
+ * result in {@code attr}.
*/
static void parseShorthandFont(CSS css, String value,
MutableAttributeSet attr) {
// font is of the form:
// [ <font-style> || <font-variant> || <font-weight> ]? <font-size>
@@ -3103,12 +3103,12 @@
/**
* Parses the background property into its intrinsic values.
*/
static class ShorthandBackgroundParser {
/**
- * Parses the shorthand font string <code>value</code>, placing the
- * result in <code>attr</code>.
+ * Parses the shorthand font string {@code value}, placing the
+ * result in {@code attr}.
*/
static void parseShorthandBackground(CSS css, String value,
MutableAttributeSet attr) {
String[] strings = parseStrings(value);
int count = strings.length;
@@ -3209,12 +3209,12 @@
* Used to parser margin and padding.
*/
static class ShorthandMarginParser {
/**
* Parses the shorthand margin/padding/border string
- * <code>value</code>, placing the result in <code>attr</code>.
- * <code>names</code> give the 4 instrinsic property names.
+ * {@code value}, placing the result in {@code attr}.
+ * {@code names} give the 4 instrinsic property names.
*/
static void parseShorthandMargin(CSS css, String value,
MutableAttributeSet attr,
CSS.Attribute[] names) {
String[] strings = parseStrings(value);
< prev index next >