modules/graphics/src/main/java/javafx/css/CascadingStyle.java
Print this page
rev 9240 : 8076423: JEP 253: Prepare JavaFX UI Controls & CSS APIs for Modularization
*** 21,39 ****
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
! package com.sun.javafx.css;
!
! import javafx.css.PseudoClass;
! import javafx.css.StyleOrigin;
import java.util.Set;
!
! /** A marriage of pseudo-classes (potentially empty) to property and value */
public class CascadingStyle implements Comparable<CascadingStyle> {
/** */
private final Style style;
public Style getStyle() {
--- 21,38 ----
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
! package javafx.css;
import java.util.Set;
! /** A marriage of pseudo-classes (potentially empty) to property and value
! *
! * @since 9
! */
public class CascadingStyle implements Comparable<CascadingStyle> {
/** */
private final Style style;
public Style getStyle() {
*** 62,71 ****
--- 61,77 ----
this.specificity = specificity;
this.ordinal = ordinal;
this.skinProp = "-fx-skin".equals(style.getDeclaration().getProperty());
}
+ public CascadingStyle(final Declaration decl, final Match match, final int ordinal) {
+ this(new Style(match.getSelector(), decl),
+ match.getPseudoClasses(),
+ match.getSpecificity(),
+ ordinal);
+ }
+
// Wrapper to make StyleHelper's life a little easier
public String getProperty() {
return style.getDeclaration().getProperty();
}
*** 83,94 ****
public StyleOrigin getOrigin() {
return getRule().getOrigin();
}
// Wrapper to make StyleHelper's life a little easier
! public ParsedValueImpl getParsedValueImpl() {
! return style.getDeclaration().getParsedValueImpl();
}
@Override public String toString() { return getProperty(); }
/**
--- 89,100 ----
public StyleOrigin getOrigin() {
return getRule().getOrigin();
}
// Wrapper to make StyleHelper's life a little easier
! public ParsedValue getParsedValue() {
! return style.getDeclaration().getParsedValue();
}
@Override public String toString() { return getProperty(); }
/**
*** 122,133 ****
/*
* Hash on property and pseudoclasses since
* obj1.hashCode() should equal obj2.hashCode() if obj1.equals(obj2)
*/
! @Override
! public int hashCode() {
int hash = 7;
final String property = getProperty();
hash = 47 * hash + (property != null ? property.hashCode() : 0);
hash = 47 * hash + (pseudoClasses != null ? pseudoClasses.hashCode() : 0);
return hash;
--- 128,138 ----
/*
* Hash on property and pseudoclasses since
* obj1.hashCode() should equal obj2.hashCode() if obj1.equals(obj2)
*/
! @Override public int hashCode() {
int hash = 7;
final String property = getProperty();
hash = 47 * hash + (property != null ? property.hashCode() : 0);
hash = 47 * hash + (pseudoClasses != null ? pseudoClasses.hashCode() : 0);
return hash;
*** 135,146 ****
/**
* Implementation of Comparable such that more specific styles get
* sorted before less specific ones.
*/
! @Override
! public int compareTo(CascadingStyle other) {
//
// Important styles take the cake
// Importance being equal, then specificity is considered
// Specificity being equal, then the order of declaration decides.
--- 140,150 ----
/**
* Implementation of Comparable such that more specific styles get
* sorted before less specific ones.
*/
! @Override public int compareTo(CascadingStyle other) {
//
// Important styles take the cake
// Importance being equal, then specificity is considered
// Specificity being equal, then the order of declaration decides.