70 */
71 public final StyleConverter<V, T> getConverter() { return converter; }
72
73 /**
74 * Convenience method for calling
75 * {@link StyleConverter#convert(javafx.css.ParsedValue, javafx.scene.text.Font) convert}
76 * on this {@code ParsedValue}.
77 * @param font The {@link Font} to use when converting a
78 * <a href="http://www.w3.org/TR/css3-values/#relative-lengths">relative</a>
79 * value.
80 * @return The value converted to the type of the {@link StyleableProperty}
81 * @see #getConverter()
82 */
83 @SuppressWarnings("unchecked")
84 public T convert(Font font) {
85 // unchecked!
86 return (T)((converter != null) ? converter.convert(this, font) : value);
87 }
88
89 /**
90 * Create an instance of ParsedValue where the value type V is converted to
91 * the target type T using the given converter.
92 * If {@code converter} is null, then it is assumed that the type of value
93 * {@code V} and the type of target {@code T} are the same and
94 * do not need converted.
95 */
96 protected ParsedValue(V value, StyleConverter<V, T> converter) {
97 this.value = value;
98 this.converter = converter;
99 }
100
101 }
|
70 */
71 public final StyleConverter<V, T> getConverter() { return converter; }
72
73 /**
74 * Convenience method for calling
75 * {@link StyleConverter#convert(javafx.css.ParsedValue, javafx.scene.text.Font) convert}
76 * on this {@code ParsedValue}.
77 * @param font The {@link Font} to use when converting a
78 * <a href="http://www.w3.org/TR/css3-values/#relative-lengths">relative</a>
79 * value.
80 * @return The value converted to the type of the {@link StyleableProperty}
81 * @see #getConverter()
82 */
83 @SuppressWarnings("unchecked")
84 public T convert(Font font) {
85 // unchecked!
86 return (T)((converter != null) ? converter.convert(this, font) : value);
87 }
88
89 /**
90 * If value is itself a ParsedValue or sequence of values, and should any of
91 * those values need to be looked up, then this flag is set. This
92 * does not mean that this particular value needs to be looked up, but
93 * that this value contains a value that needs to be looked up.
94 *
95 * @since 9
96 */
97 public boolean isContainsLookups() { return false; }
98
99 /**
100 * If value references another property, then the real value needs to
101 * be looked up.
102 *
103 * @since 9
104 */
105 public boolean isLookup() { return false; }
106
107 /**
108 * Create an instance of ParsedValue where the value type V is converted to
109 * the target type T using the given converter.
110 * If {@code converter} is null, then it is assumed that the type of value
111 * {@code V} and the type of target {@code T} are the same and
112 * do not need converted.
113 */
114 protected ParsedValue(V value, StyleConverter<V, T> converter) {
115 this.value = value;
116 this.converter = converter;
117 }
118
119 }
|