jdk/src/share/classes/javax/swing/text/html/StyleSheet.java
changeset 25148 1026dc322690
parent 24528 21c5bb3d76cc
child 25208 f7fd86906713
--- a/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java	Thu Jun 19 16:54:59 2014 +0400
+++ b/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java	Thu Jun 19 16:57:14 2014 +0400
@@ -156,7 +156,7 @@
     // . When one of the AttributeSets is mutated by way of a
     //   StyleConstants key, all the associated CSS keys are removed. This is
     //   done so that the two representations don't get out of sync. For
-    //   example, if the developer adds StyleConsants.BOLD, FALSE to an
+    //   example, if the developer adds StyleConstants.BOLD, FALSE to an
     //   AttributeSet that contains HTML.Tag.B, the HTML.Tag.B entry will
     //   be removed.
 
@@ -270,6 +270,9 @@
      * 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
      * the rule "p".
+     *
+     * @param selector a space separated String of the element names.
+     * @return the rule that best matches the selector.
      */
     public Style getRule(String selector) {
         selector = cleanSelectorString(selector);
@@ -284,6 +287,8 @@
      * Adds a set of rules to the sheet.  The rules are expected to
      * be in valid CSS format.  Typically this would be called as
      * a result of parsing a <style> tag.
+     *
+     * @param rule a set of rules
      */
     public void addRule(String rule) {
         if (rule != null) {
@@ -315,6 +320,9 @@
      * Translates a CSS declaration to an AttributeSet that represents
      * the CSS declaration.  Typically this would be called as a
      * result of encountering an HTML style attribute.
+     *
+     * @param decl a CSS declaration
+     * @return a set of attributes that represents the CSS declaration.
      */
     public AttributeSet getDeclaration(String decl) {
         if (decl == null) {
@@ -334,6 +342,7 @@
      *  location of the stream and may be null.  All relative
      *  URLs specified in the stream will be based upon this
      *  parameter.
+     * @throws java.io.IOException if I/O error occured.
      */
     public void loadRules(Reader in, URL ref) throws IOException {
         CssParser parser = new CssParser();
@@ -344,6 +353,9 @@
      * Fetches a set of attributes to use in the view for
      * displaying.  This is basically a set of attributes that
      * can be used for View.getAttributes.
+     *
+     * @param v a view
+     * @return the of attributes
      */
     public AttributeSet getViewAttributes(View v) {
         return new ViewAttributeSet(v);
@@ -388,6 +400,7 @@
      * 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
      */
     public void addStyleSheet(StyleSheet ss) {
@@ -410,6 +423,7 @@
     /**
      * Removes the StyleSheet <code>ss</code> from those of the receiver.
      *
+     * @param ss a StyleSheet
      * @since 1.3
      */
     public void removeStyleSheet(StyleSheet ss) {
@@ -435,6 +449,7 @@
      * Returns an array of the linked StyleSheets. Will return null
      * if there are no linked StyleSheets.
      *
+     * @return an array of StyleSheets.
      * @since 1.3
      */
     public StyleSheet[] getStyleSheets() {
@@ -458,6 +473,7 @@
      * to become part of the receiver, create a new StyleSheet and use
      * addStyleSheet to link it in.
      *
+     * @param url an url
      * @since 1.3
      */
     public void importStyleSheet(URL url) {
@@ -480,6 +496,7 @@
      * Sets the base. All import statements that are relative, will be
      * relative to <code>base</code>.
      *
+     * @param base a base.
      * @since 1.3
      */
     public void setBase(URL base) {
@@ -489,6 +506,7 @@
     /**
      * Returns the base.
      *
+     * @return the base.
      * @since 1.3
      */
     public URL getBase() {
@@ -498,6 +516,9 @@
     /**
      * Adds a CSS attribute to the given set.
      *
+     * @param attr a set of attributes
+     * @param key a CSS property
+     * @param value an HTML attribute value
      * @since 1.3
      */
     public void addCSSAttribute(MutableAttributeSet attr, CSS.Attribute key,
@@ -508,6 +529,11 @@
     /**
      * Adds a CSS attribute to the given set.
      *
+     * @param attr a set of attributes
+     * @param key a CSS property
+     * @param value an HTML attribute value
+     * @return {@code true} if an HTML attribute {@code value} can be converted
+     *         to a CSS attribute, false otherwise.
      * @since 1.3
      */
     public boolean addCSSAttributeFromHTML(MutableAttributeSet attr,
@@ -527,6 +553,7 @@
      * set of CSS attributes.
      *
      * @param htmlAttrSet AttributeSet containing the HTML attributes.
+     * @return the set of CSS attributes.
      */
     public AttributeSet translateHTMLToCSS(AttributeSet htmlAttrSet) {
         AttributeSet cssAttrSet = css.translateHTMLToCSS(htmlAttrSet);
@@ -917,6 +944,9 @@
     /**
      * Fetches the box formatter to use for the given set
      * of CSS attributes.
+     *
+     * @param a a set of CSS attributes
+     * @return the box formatter.
      */
     public BoxPainter getBoxPainter(AttributeSet a) {
         return new BoxPainter(a, css, this);
@@ -925,6 +955,9 @@
     /**
      * Fetches the list formatter to use for the given set
      * of CSS attributes.
+     *
+     * @param a a set of CSS attributes
+     * @return the list formatter.
      */
     public ListPainter getListPainter(AttributeSet a) {
         return new ListPainter(a, this);
@@ -932,6 +965,8 @@
 
     /**
      * Sets the base font size, with valid values between 1 and 7.
+     *
+     * @param sz a font size.
      */
     public void setBaseFontSize(int sz) {
         css.setBaseFontSize(sz);
@@ -941,17 +976,29 @@
      * Sets the base font size from the passed in String. The string
      * can either identify a specific font size, with legal values between
      * 1 and 7, or identify a relative font size such as +1 or -2.
+     *
+     * @param size a font size.
      */
     public void setBaseFontSize(String size) {
         css.setBaseFontSize(size);
     }
 
+    /**
+     *
+     * Returns the index of HTML/CSS size model.
+     *
+     * @param pt a size of point
+     * @return the index of HTML/CSS size model.
+     */
     public static int getIndexOfSize(float pt) {
         return CSS.getIndexOfSize(pt, sizeMapDefault);
     }
 
     /**
      * Returns the point size, given a size index.
+     *
+     * @param index a size index
+     * @return the point size value.
      */
     public float getPointSize(int index) {
         return css.getPointSize(index, this);
@@ -960,6 +1007,9 @@
     /**
      *  Given a string such as "+2", "-2", or "2",
      *  returns a point size value.
+     *
+     * @param size a CSS string describing font size
+     * @return the point size value.
      */
     public float getPointSize(String size) {
         return css.getPointSize(size, this);
@@ -970,6 +1020,9 @@
      * Note: This will only convert the HTML3.2 color strings
      *       or a string of length 7;
      *       otherwise, it will return null.
+     *
+     * @param string color string such as "RED" or "#NNNNNN"
+     * @return the color
      */
     public Color stringToColor(String string) {
         return CSS.stringToColor(string);
@@ -1816,6 +1869,7 @@
          * @param v the view making the request.  This is
          *  used to get the AttributeSet, and may be used to
          *  resolve percentage arguments.
+         * @return the inset needed for the margin, border and padding.
          * @exception IllegalArgumentException for an invalid direction
          */
         public float getInset(int side, View v) {