Skip to content

Commit 7575473

Browse files
committed
8250590: Classes and methods in the javafx.css package are missing documentation
Reviewed-by: kcr, pbansal
1 parent df07ac8 commit 7575473

33 files changed

+580
-73
lines changed

modules/javafx.base/src/main/java/javafx/util/StringConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public StringConverter() {
4343
* Converts the object provided into its string form.
4444
* Format of the returned string is defined by the specific converter.
4545
* @param object the object of type {@code T} to convert
46-
* @return a string representation of the object passed in.
46+
* @return a string representation of the object passed in
4747
*/
4848
public abstract String toString(T object);
4949

modules/javafx.graphics/src/main/java/com/sun/javafx/css/PseudoClassImpl.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,38 @@
3232
*/
3333
final class PseudoClassImpl extends PseudoClass {
3434

35-
35+
/**
36+
* Constructs a {@code PseudoClassImpl} object.
37+
* @param pseudoClassName name of the pseudo-class
38+
* @param index index of this PseudoClass in pseudoClasses list
39+
* @return a {@code PseudoClassImpl} object
40+
*/
3641
PseudoClassImpl(String pseudoClassName, int index) {
3742
this.pseudoClassName = pseudoClassName;
3843
this.index = index;
3944
}
4045

41-
/** @return the pseudo-class state */
46+
/**
47+
* Gets the pseudo class name.
48+
* @return the pseudo class name
49+
*/
4250
@Override
4351
public String getPseudoClassName() {
4452
return pseudoClassName;
4553
}
4654

47-
/** @return the pseudo-class state */
55+
/**
56+
* Gets the pseudo class name.
57+
* @return the pseudo class name
58+
*/
4859
@Override public String toString() {
4960
return pseudoClassName;
5061
}
5162

63+
/**
64+
* Returns the index of this {@code PseudoClass} in the styleClasses list.
65+
* @return index
66+
*/
5267
public int getIndex() {
5368
return index;
5469
}

modules/javafx.graphics/src/main/java/javafx/css/CssMetaData.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
public abstract class CssMetaData<S extends Styleable, V> {
114114

115115
/**
116-
* Set the value of the corresponding property on the given Node.
116+
* Sets the value of the corresponding property on the given Node.
117117
* @param styleable The Styleable on which the property value is being set
118118
* @param value The value to which the property is set
119119
* @param origin the origin
@@ -160,16 +160,20 @@ public void set(S styleable, V value, StyleOrigin origin) {
160160
public abstract StyleableProperty<V> getStyleableProperty(S styleable);
161161

162162
private final String property;
163+
163164
/**
165+
* Gets the CSS property name.
164166
* @return the CSS property name
165167
*/
166168
public final String getProperty() {
167169
return property;
168170
}
169171

170172
private final StyleConverter<?,V> converter;
173+
171174
/**
172-
* @return The CSS converter that handles conversion from a CSS value to a Java Object
175+
* Gets the CSS converter that handles conversion from a CSS value to a Java Object.
176+
* @return the CSS converter
173177
*/
174178
public final StyleConverter<?,V> getConverter() {
175179
return converter;

modules/javafx.graphics/src/main/java/javafx/css/CssParser.java

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,14 @@
107107
import java.util.Stack;
108108

109109
/**
110+
* A parser for a CSS document string.
110111
* @since 9
111112
*/
112113
final public class CssParser {
113114

115+
/**
116+
* Constructs a {@code CssParser}.
117+
*/
114118
public CssParser() {
115119
properties = new HashMap<String,String>();
116120
}
@@ -180,10 +184,10 @@ private static final class ParseException extends Exception {
180184
}
181185

182186
/**
183-
* Creates a stylesheet from a CSS document string.
187+
* Creates a {@code Stylesheet} from a CSS document string.
184188
*
185189
* @param stylesheetText the CSS document to parse
186-
* @return the Stylesheet
190+
* @return the {@code Stylesheet}
187191
*/
188192
public Stylesheet parse(final String stylesheetText) {
189193
final Stylesheet stylesheet = new Stylesheet();
@@ -199,8 +203,8 @@ public Stylesheet parse(final String stylesheetText) {
199203
}
200204

201205
/**
202-
* Creates a stylesheet from a CSS document string using docbase as the base
203-
* URL for resolving references within stylesheet.
206+
* Creates a {@code Stylesheet} from a CSS document string using docbase as the base
207+
* URL for resolving references within {@code Stylesheet}.
204208
*
205209
* @param docbase the doc base for resolving URL references
206210
* @param stylesheetText the CSS document to parse
@@ -256,7 +260,8 @@ private void parse(final Stylesheet stylesheet, final Reader reader) {
256260

257261
}
258262

259-
/** Parse an in-line style from a Node.
263+
/**
264+
* Parse an in-line style from a {@code Node}.
260265
* @param node the styleable node
261266
* @return the style sheet
262267
*/
@@ -4715,23 +4720,34 @@ private Term term(CssLexer lexer) {
47154720
return term;
47164721
}
47174722

4723+
/**
4724+
* List of errors that may have occurred during CSS processing.
4725+
* @return an {@code ObservableList} of {@code ParseError}
4726+
*/
47184727
public static ObservableList<ParseError> errorsProperty() {
47194728
return StyleManager.errorsProperty();
47204729
}
47214730

47224731

47234732

47244733
/**
4725-
* Encapsulate information about the source and nature of errors encountered
4726-
* while parsing CSS or applying styles to Nodes.
4734+
* A class that encapsulates information about the source and nature
4735+
* of errors encountered while parsing CSS or applying styles to Nodes.
47274736
*/
47284737
public static class ParseError {
47294738

4730-
/** @return The error message from the CSS code. */
4739+
/**
4740+
* Returns the error message.
4741+
* @return the error message
4742+
*/
47314743
public final String getMessage() {
47324744
return message;
47334745
}
47344746

4747+
/**
4748+
* Constructs a {@code ParseError} object with the message.
4749+
* @param message the message
4750+
*/
47354751
public ParseError(String message) {
47364752
this.message = message;
47374753
}
@@ -4815,6 +4831,12 @@ public final static class PropertySetError extends ParseError {
48154831
private final CssMetaData styleableProperty;
48164832
private final Styleable styleable;
48174833

4834+
/**
4835+
* Constructs a {@code PropertySetError} object.
4836+
* @param styleableProperty CSS meta data
4837+
* @param styleable styleable node
4838+
* @param message parse error message
4839+
*/
48184840
public PropertySetError(CssMetaData styleableProperty,
48194841
Styleable styleable, String message) {
48204842
super(message);

modules/javafx.graphics/src/main/java/javafx/css/Declaration.java

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import java.io.IOException;
3434

3535
/**
36+
* This class serves as a container of a CSS property and its value.
3637
* @since 9
3738
*/
3839
final public class Declaration {
@@ -42,6 +43,12 @@ final public class Declaration {
4243
// The Rule to which this Declaration belongs.
4344
Rule rule;
4445

46+
/**
47+
* Constructs a {@code Declaration} object.
48+
* @param propertyName name of the CSS property
49+
* @param parsedValue value of the CSS property
50+
* @param important importance of the Declaration
51+
*/
4552
Declaration(final String propertyName, final ParsedValue parsedValue,
4653
final boolean important) {
4754
this.property = propertyName;
@@ -55,26 +62,41 @@ final public class Declaration {
5562
}
5663
}
5764

58-
/** @return ParsedValue contains the parsed declaration. */
65+
/**
66+
* Gets the parsed value.
67+
* @return the parsed value
68+
*/
5969
public ParsedValue getParsedValue() {
6070
return parsedValue;
6171
}
6272

63-
/** @return The CSS property name */
73+
/**
74+
* Gets the CSS property name.
75+
* @return the CSS property
76+
*/
6477
public String getProperty() {
6578
return property;
6679
}
6780

68-
/** @return The Rule to which this Declaration belongs. */
81+
/**
82+
* Gets the {@code Rule} to which this {@code Declaration} belongs.
83+
* @return the {@code Rule}
84+
*/
6985
public Rule getRule() {
7086
return rule;
7187
}
7288

89+
/**
90+
* Gets the importance of this {@code Declaration}.
91+
* @return the important flag
92+
*/
7393
public final boolean isImportant() {
7494
return important;
7595
}
7696

77-
/** Helper */
97+
/**
98+
* Gets the {@code StyleOrigin} of this {@code Declaration}.
99+
*/
78100
private StyleOrigin getOrigin() {
79101
Rule rule = getRule();
80102
if (rule != null) {
@@ -83,9 +105,14 @@ private StyleOrigin getOrigin() {
83105
return null;
84106
}
85107
/**
86-
* One declaration is the equal to another regardless of the Rule to which
87-
* the Declaration belongs. Only the property, value and importance are
108+
* Indicates whether some other {@code Object} is "equal to" this one.
109+
* <p>
110+
* One {@code Declaration} is equal to another regardless of the {@code Rule} to which
111+
* the {@code Declaration} belongs. Only the property, value and importance are
88112
* considered.
113+
*
114+
* @param obj an {@code Object} to compare
115+
* @return {@code true} if this object is the same as the {@code obj} argument; {@code false} otherwise
89116
*/
90117
@Override public boolean equals(Object obj) {
91118
if (this == obj) {

modules/javafx.graphics/src/main/java/javafx/css/Match.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,40 @@ public final class Match implements Comparable<Match> {
6565
specificity = (idCount << 8) | (styleClassCount << 4) | nPseudoClasses;
6666
}
6767

68+
/**
69+
* Gets the {@code Selector}.
70+
* @return the {@code Selector}
71+
*/
6872
public Selector getSelector() {
6973
return selector;
7074
}
7175

76+
/**
77+
* Gets the pseudo class state.
78+
* @return the pseudo class state
79+
*/
7280
public PseudoClassState getPseudoClasses() {
7381
return pseudoClasses;
7482
}
7583

84+
/**
85+
* Gets the specificity.
86+
* @return the specificity
87+
*/
7688
public int getSpecificity() {
7789
return specificity;
7890
}
7991

92+
/**
93+
* Compares this object with the given {@code Match} object.
94+
* <p>
95+
* Comparison is based on the specificity of the objects.
96+
* Specificity is calculated based on the id count, the style class count and
97+
* the pseudoclass count.
98+
* @param o the {@code Match} object to be compared
99+
* @return the difference between the specificity of this object and
100+
* the specificity of the given {@code Match} object
101+
*/
80102
@Override public int compareTo(Match o) {
81103
return specificity - o.specificity;
82104
}

modules/javafx.graphics/src/main/java/javafx/css/ParsedValue.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ public class ParsedValue<V, T> {
4747
final protected V value;
4848

4949
/**
50-
* @return The CSS property value as created by the parser, which may be null
50+
* Gets the CSS property value as created by the parser, which may be null
5151
* or otherwise incomprehensible.
52+
* @return the CSS property value
5253
*/
5354
public final V getValue() { return value; }
5455

modules/javafx.graphics/src/main/java/javafx/css/PseudoClass.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,23 @@ public PseudoClass() {
8181
}
8282

8383
/**
84-
* There is only one PseudoClass instance for a given pseudoClass.
85-
* @param pseudoClass the pseudo-class
86-
* @return The PseudoClass for the given pseudoClass. Will not return null.
87-
* @throws IllegalArgumentException if pseudoClass parameter is null or an empty String
84+
* Gets the {@code PseudoClass} instance for a given pseudo class name.
85+
* <p>
86+
* Note: There is only one {@code PseudoClass} instance for a given pseudo class name.
87+
*
88+
* @param pseudoClass the name of the pseudo class
89+
* @return the {@code PseudoClass} instance for a given pseudo class name;
90+
* It will not return {@code null}
91+
* @throws IllegalArgumentException if pseudoClass parameter is {@code null} or an empty {@code String}
8892
*/
8993
public static PseudoClass getPseudoClass(String pseudoClass) {
90-
9194
return PseudoClassState.getPseudoClass(pseudoClass);
92-
9395
}
9496

95-
/** @return the pseudo-class state */
97+
/**
98+
* Gets the name of the {@code PseudoClass}.
99+
* @return the name of the {@code PseudoClass}
100+
*/
96101
abstract public String getPseudoClassName();
97102

98103
}

modules/javafx.graphics/src/main/java/javafx/css/Rule.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
import java.util.List;
4141
import java.util.Set;
4242

43-
/*
44-
* A selector is a collection of selectors and declarations.
43+
/**
44+
* A Rule is a collection of CSS {@code Selector}s and {@code Declaration}s.
4545
*
4646
* @since 9
4747
*/
@@ -135,8 +135,12 @@ public final ObservableList<Selector> getSelectors() {
135135
return observables.getSelectors();
136136
}
137137

138-
/** The stylesheet this selector belongs to */
139138
private Stylesheet stylesheet;
139+
140+
/**
141+
* Gets the {@code Stylesheet} this {@code Rule} belongs to.
142+
* @return the stylesheet
143+
*/
140144
public Stylesheet getStylesheet() {
141145
return stylesheet;
142146
}
@@ -156,6 +160,10 @@ void setStylesheet(Stylesheet stylesheet) {
156160
}
157161
}
158162

163+
/**
164+
* Get the {@code StyleOrigin} of this {@code Stylesheet}.
165+
* @return the origin of the stylesheet
166+
*/
159167
public StyleOrigin getOrigin() {
160168
return stylesheet != null ? stylesheet.getOrigin() : null;
161169
}
@@ -211,8 +219,9 @@ long applies(Node node, Set<PseudoClass>[] triggerStates) {
211219
return mask;
212220
}
213221

214-
/** Converts this object to a string.
215-
* @return the converted string
222+
/**
223+
* Converts this object to a {@code String}.
224+
* @return the converted {@code String}
216225
*/
217226
@Override public String toString() {
218227
StringBuilder sb = new StringBuilder();

0 commit comments

Comments
 (0)