modules/graphics/src/main/java/javafx/css/Declaration.java
Print this page
rev 9240 : 8076423: JEP 253: Prepare JavaFX UI Controls & CSS APIs for Modularization
*** 21,49 ****
* 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 com.sun.javafx.css.converters.URLConverter;
! import javafx.css.ParsedValue;
! import javafx.css.StyleConverter;
! import javafx.css.StyleOrigin;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
final public class Declaration {
final String property;
! final ParsedValueImpl parsedValue;
final boolean important;
// The Rule to which this Declaration belongs.
Rule rule;
! public Declaration(final String propertyName, final ParsedValueImpl parsedValue,
final boolean important) {
this.property = propertyName;
this.parsedValue = parsedValue;
this.important = important;
if (propertyName == null) {
--- 21,50 ----
* 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 com.sun.javafx.css.ParsedValueImpl;
! import javafx.css.converter.URLConverter;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
+ /**
+ * @since 9
+ */
final public class Declaration {
final String property;
! final ParsedValue parsedValue;
final boolean important;
// The Rule to which this Declaration belongs.
Rule rule;
! Declaration(final String propertyName, final ParsedValue parsedValue,
final boolean important) {
this.property = propertyName;
this.parsedValue = parsedValue;
this.important = important;
if (propertyName == null) {
*** 57,82 ****
/** @return ParsedValue contains the parsed declaration. */
public ParsedValue getParsedValue() {
return parsedValue;
}
- /** @return ParsedValue contains the parsed declaration. */
- ParsedValueImpl getParsedValueImpl() {
- return parsedValue;
- }
-
/** @return The CSS property name */
public String getProperty() {
return property;
}
/** @return The Rule to which this Declaration belongs. */
public Rule getRule() {
return rule;
}
! public boolean isImportant() {
return important;
}
/** Helper */
private StyleOrigin getOrigin() {
--- 58,78 ----
/** @return ParsedValue contains the parsed declaration. */
public ParsedValue getParsedValue() {
return parsedValue;
}
/** @return The CSS property name */
public String getProperty() {
return property;
}
/** @return The Rule to which this Declaration belongs. */
public Rule getRule() {
return rule;
}
! boolean isImportant() {
return important;
}
/** Helper */
private StyleOrigin getOrigin() {
*** 89,100 ****
/**
* One declaration is the equal to another regardless of the Rule to which
* the Declaration belongs. Only the property, value and importance are
* considered.
*/
! @Override
! public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
--- 85,95 ----
/**
* One declaration is the equal to another regardless of the Rule to which
* the Declaration belongs. Only the property, value and importance are
* considered.
*/
! @Override public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
*** 116,127 ****
return false;
}
return true;
}
! @Override
! public int hashCode() {
int hash = 5;
hash = 89 * hash + (this.property != null ? this.property.hashCode() : 0);
hash = 89 * hash + (this.parsedValue != null ? this.parsedValue.hashCode() : 0);
hash = 89 * hash + (this.important ? 1 : 0);
return hash;
--- 111,121 ----
return false;
}
return true;
}
! @Override public int hashCode() {
int hash = 5;
hash = 89 * hash + (this.property != null ? this.property.hashCode() : 0);
hash = 89 * hash + (this.parsedValue != null ? this.parsedValue.hashCode() : 0);
hash = 89 * hash + (this.important ? 1 : 0);
return hash;
*** 168,184 ****
}
}
! final void writeBinary(final DataOutputStream os, final StringStore stringStore)
throws IOException
{
os.writeShort(stringStore.addString(getProperty()));
! getParsedValueImpl().writeBinary(os,stringStore);
os.writeBoolean(isImportant());
}
static Declaration readBinary(int bssVersion, DataInputStream is, String[] strings)
throws IOException
{
final String propertyName = strings[is.readShort()];
--- 162,180 ----
}
}
! final void writeBinary(final DataOutputStream os, final StyleConverter.StringStore stringStore)
throws IOException
{
+ if (parsedValue instanceof ParsedValueImpl) {
os.writeShort(stringStore.addString(getProperty()));
! ((ParsedValueImpl)parsedValue).writeBinary(os,stringStore);
os.writeBoolean(isImportant());
}
+ }
static Declaration readBinary(int bssVersion, DataInputStream is, String[] strings)
throws IOException
{
final String propertyName = strings[is.readShort()];