java.lang.Object
javafx.css.Stylesheet
public class Stylesheet extends Object
A stylesheet which can apply properties to a tree of objects. A stylesheet
is a collection of zero or more
Rules
, each of which is applied
to each object in the tree. Typically the selector will examine the object to
determine whether or not it is applicable, and if so it will apply certain
property values to the object.- Since:
- 9
-
Method Summary
Modifier and Type Method Description static void
convertToBinary(File source, File destination)
Converts the css file referenced bysource
to binary format and writes it todestination
.boolean
equals(Object obj)
Indicates whether thisStylesheet
is "equal to" some other object.List<FontFace>
getFontFaces()
Returns the font faces used by thisStylesheet
.StyleOrigin
getOrigin()
Returns the origin of thisStylesheet
.List<Rule>
getRules()
Returns the rules that are defined in thisStylesheet
.String
getUrl()
The URL from which thisStylesheet
was loaded.static Stylesheet
loadBinary(InputStream stream)
Loads a binary stylesheet from a stream.static Stylesheet
loadBinary(URL url)
Loads a binary stylesheet from aURL
.void
setOrigin(StyleOrigin origin)
Sets the origin of thisStylesheet
.String
toString()
Returns a string representation of this object.
-
Method Details
-
getUrl
The URL from which thisStylesheet
was loaded.- Returns:
- A
String
representation of the URL from which the stylesheet was loaded, ornull
if the stylesheet was created from an inline style.
-
getOrigin
Returns the origin of thisStylesheet
.- Returns:
- the origin of this
Stylesheet
-
setOrigin
Sets the origin of thisStylesheet
.- Parameters:
origin
- the origin of thisStylesheet
-
getRules
Returns the rules that are defined in thisStylesheet
.- Returns:
- a list of rules used by this
Stylesheet
-
getFontFaces
Returns the font faces used by thisStylesheet
.- Returns:
- a list of font faces used by this
Stylesheet
-
equals
Indicates whether thisStylesheet
is "equal to" some other object. Equality of twoStylesheet
s is based on the equality of their URL as defined bygetUrl()
. -
toString
Returns a string representation of this object. -
loadBinary
Loads a binary stylesheet from aURL
.- Parameters:
url
- theURL
from which theStylesheet
will be loaded- Returns:
- the loaded
Stylesheet
- Throws:
IOException
- if the binary stream corresponds to a more recent binary css version or if an I/O error occurs while reading from the stream
-
loadBinary
Loads a binary stylesheet from a stream.- Parameters:
stream
- the input stream- Returns:
- the loaded
Stylesheet
- Throws:
IOException
- if the binary stream corresponds to a more recent binary css version or if an I/O error occurs while reading from the stream- Since:
- 17
-
convertToBinary
Converts the css file referenced bysource
to binary format and writes it todestination
.- Parameters:
source
- the JavaFX compliant css file to convertdestination
- the file to which the binary formatted data is written- Throws:
IOException
- if the destination file can not be created or if an I/O error occursIllegalArgumentException
- if either parameter isnull
, ifsource
anddestination
are the same, ifsource
cannot be read, or ifdestination
cannot be written
-