|
1 | 1 | /* |
2 | | - * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
@@ -66,20 +66,28 @@ public class Stylesheet { |
66 | 66 | final static int BINARY_CSS_VERSION = 6; |
67 | 67 |
|
68 | 68 | private final String url; |
69 | | - /** The URL from which the stylesheet was loaded. |
70 | | - * @return The URL from which the stylesheet was loaded, or null if |
| 69 | + /** |
| 70 | + * The URL from which this {@code Stylesheet} was loaded. |
| 71 | + * |
| 72 | + * @return A {@code String} representation of the URL from which the stylesheet was loaded, or {@code null} if |
71 | 73 | * the stylesheet was created from an inline style. |
72 | 74 | */ |
73 | 75 | public String getUrl() { |
74 | 76 | return url; |
75 | 77 | } |
76 | 78 |
|
77 | 79 | /** |
78 | | - * True if this style came from user stylesheet, we need to know this so |
| 80 | + * Specifies the origin of this {@code Stylesheet}. We need to know this so |
79 | 81 | * that we can make user important styles have higher priority than |
80 | | - * author styles |
| 82 | + * author styles. |
81 | 83 | */ |
82 | 84 | private StyleOrigin origin = StyleOrigin.AUTHOR; |
| 85 | + |
| 86 | + /** |
| 87 | + * Returns the origin of this {@code Stylesheet}. |
| 88 | + * |
| 89 | + * @return the origin of this {@code Stylesheet} |
| 90 | + */ |
83 | 91 | public StyleOrigin getOrigin() { |
84 | 92 | return origin; |
85 | 93 | } |
@@ -133,18 +141,29 @@ public void setOrigin(StyleOrigin origin) { |
133 | 141 | /** |
134 | 142 | * Constructs a Stylesheet using the given URL as the base URI. The |
135 | 143 | * parameter may not be null. |
136 | | - * @param url |
| 144 | + * |
| 145 | + * @param url the base URI for this stylesheet |
137 | 146 | */ |
138 | 147 | Stylesheet(String url) { |
139 | 148 |
|
140 | 149 | this.url = url; |
141 | 150 |
|
142 | 151 | } |
143 | 152 |
|
| 153 | + /** |
| 154 | + * Returns the rules that are defined in this {@code Stylesheet}. |
| 155 | + * |
| 156 | + * @return a list of rules used by this {@code Stylesheet} |
| 157 | + */ |
144 | 158 | public List<Rule> getRules() { |
145 | 159 | return rules; |
146 | 160 | } |
147 | 161 |
|
| 162 | + /** |
| 163 | + * Returns the font faces used by this {@code Stylesheet}. |
| 164 | + * |
| 165 | + * @return a list of font faces used by this {@code Stylesheet} |
| 166 | + */ |
148 | 167 | public List<FontFace> getFontFaces() { |
149 | 168 | return fontFaces; |
150 | 169 | } |
@@ -238,10 +257,13 @@ final void readBinary(int bssVersion, DataInputStream is, String[] strings) |
238 | 257 | private String[] stringStore; |
239 | 258 | final String[] getStringStore() { return stringStore; } |
240 | 259 |
|
241 | | - /** Load a binary stylesheet file from a input stream. |
242 | | - * @param url the URL from which the stylesheet will be loaded |
243 | | - * @return the constructed stylesheet |
244 | | - * @throws java.io.IOException the exception |
| 260 | + /** |
| 261 | + * Loads a binary stylesheet from a {@code URL}. |
| 262 | + * |
| 263 | + * @param url the {@code URL} from which the {@code Stylesheet} will be loaded |
| 264 | + * @return the loaded {@code Stylesheet} |
| 265 | + * @throws IOException if the binary stream corresponds to a more recent binary |
| 266 | + * css version or if an I/O error occurs while reading from the stream |
245 | 267 | */ |
246 | 268 | public static Stylesheet loadBinary(URL url) throws IOException { |
247 | 269 |
|
@@ -293,12 +315,14 @@ public static Stylesheet loadBinary(URL url) throws IOException { |
293 | 315 | } |
294 | 316 |
|
295 | 317 | /** |
296 | | - * Convert the .css file referenced by urlIn to binary format and write to urlOut. |
297 | | - * @param source is the JavaFX .css file to convert |
298 | | - * @param destination is the file to which the binary conversion is written |
299 | | - * @throws IOException the exception |
300 | | - * @throws IllegalArgumentException if either parameter is null, if source and destination are the same, |
301 | | - * if source cannot be read, or if destination cannot be written. |
| 318 | + * Converts the css file referenced by {@code source} to binary format and writes it to {@code destination}. |
| 319 | + * |
| 320 | + * @param source the JavaFX compliant css file to convert |
| 321 | + * @param destination the file to which the binary formatted data is written |
| 322 | + * @throws IOException if the destination file can not be created or if an I/O error occurs |
| 323 | + * @throws IllegalArgumentException if either parameter is {@code null}, if {@code source} and |
| 324 | + * {@code destination} are the same, if {@code source} cannot be read, or if {@code destination} |
| 325 | + * cannot be written |
302 | 326 | */ |
303 | 327 | public static void convertToBinary(File source, File destination) throws IOException { |
304 | 328 |
|
|
0 commit comments