< prev index next >

modules/javafx.graphics/src/main/java/javafx/scene/Node.java

Print this page




1182      * @see <a href="doc-files/cssref.html">CSS Reference Guide</a>.
1183      */
1184     private StringProperty id;
1185 
1186     public final void setId(String value) {
1187         idProperty().set(value);
1188     }
1189 
1190     //TODO: this is copied from the property in order to add the @return statement.
1191     //      We should have a better, general solution without the need to copy it.
1192     /**
1193      * The id of this {@code Node}. This simple string identifier is useful for
1194      * finding a specific Node within the scene graph. While the id of a Node
1195      * should be unique within the scene graph, this uniqueness is not enforced.
1196      * This is analogous to the "id" attribute on an HTML element
1197      * (<a href="http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier">CSS ID Specification</a>).
1198      *
1199      * @return the id assigned to this {@code Node} using the {@code setId}
1200      *         method or {@code null}, if no id has been assigned.
1201      * @defaultValue null
1202      * @see <a href="doc-files/cssref.html">CSS Reference Guide</a>.
1203      */
1204     public final String getId() {
1205         return id == null ? null : id.get();
1206     }
1207 
1208     public final StringProperty idProperty() {
1209         if (id == null) {
1210             id = new StringPropertyBase() {
1211 
1212                 @Override
1213                 protected void invalidated() {
1214                     reapplyCSS();
1215                     if (PrismSettings.printRenderGraph) {
1216                         NodeHelper.markDirty(Node.this, DirtyBits.DEBUG);
1217                     }
1218                 }
1219 
1220                 @Override
1221                 public Object getBean() {
1222                     return Node.this;


1274     /**
1275      * A string representation of the CSS style associated with this
1276      * specific {@code Node}. This is analogous to the "style" attribute of an
1277      * HTML element. Note that, like the HTML style attribute, this
1278      * variable contains style properties and values and not the
1279      * selector portion of a style rule.
1280      * @defaultValue empty string
1281      * @see <a href="doc-files/cssref.html">CSS Reference Guide</a>.
1282      */
1283     private StringProperty style;
1284 
1285     /**
1286      * A string representation of the CSS style associated with this
1287      * specific {@code Node}. This is analogous to the "style" attribute of an
1288      * HTML element. Note that, like the HTML style attribute, this
1289      * variable contains style properties and values and not the
1290      * selector portion of a style rule.
1291      * @param value The inline CSS style to use for this {@code Node}.
1292      *         {@code null} is implicitly converted to an empty String.
1293      * @defaultValue empty string
1294      * @see <a href="doc-files/cssref.html">CSS Reference Guide</a>.
1295      */
1296     public final void setStyle(String value) {
1297         styleProperty().set(value);
1298     }
1299 
1300     // TODO: javadoc copied from property for the sole purpose of providing a return tag
1301     /**
1302      * A string representation of the CSS style associated with this
1303      * specific {@code Node}. This is analogous to the "style" attribute of an
1304      * HTML element. Note that, like the HTML style attribute, this
1305      * variable contains style properties and values and not the
1306      * selector portion of a style rule.
1307      * @defaultValue empty string
1308      * @return The inline CSS style associated with this {@code Node}.
1309      *         If this {@code Node} does not have an inline style,
1310      *         an empty String is returned.
1311      * @see <a href="doc-files/cssref.html">CSS Reference Guide</a>.
1312      */
1313     public final String getStyle() {
1314         return style == null ? "" : style.get();
1315     }
1316 
1317     public final StringProperty styleProperty() {
1318         if (style == null) {
1319             style = new StringPropertyBase("") {
1320 
1321                 @Override public void set(String value) {
1322                     // getStyle returns an empty string if the style property
1323                     // is null. To be consistent, getStyle should also return
1324                     // an empty string when the style property's value is null.
1325                     super.set((value != null) ? value : "");
1326                 }
1327 
1328                 @Override
1329                 protected void invalidated() {
1330                     // If the style has changed, then styles of this node
1331                     // and child nodes might be affected.




1182      * @see <a href="doc-files/cssref.html">CSS Reference Guide</a>.
1183      */
1184     private StringProperty id;
1185 
1186     public final void setId(String value) {
1187         idProperty().set(value);
1188     }
1189 
1190     //TODO: this is copied from the property in order to add the @return statement.
1191     //      We should have a better, general solution without the need to copy it.
1192     /**
1193      * The id of this {@code Node}. This simple string identifier is useful for
1194      * finding a specific Node within the scene graph. While the id of a Node
1195      * should be unique within the scene graph, this uniqueness is not enforced.
1196      * This is analogous to the "id" attribute on an HTML element
1197      * (<a href="http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier">CSS ID Specification</a>).
1198      *
1199      * @return the id assigned to this {@code Node} using the {@code setId}
1200      *         method or {@code null}, if no id has been assigned.
1201      * @defaultValue null
1202      * @see <a href="doc-files/cssref.html">CSS Reference Guide</a>
1203      */
1204     public final String getId() {
1205         return id == null ? null : id.get();
1206     }
1207 
1208     public final StringProperty idProperty() {
1209         if (id == null) {
1210             id = new StringPropertyBase() {
1211 
1212                 @Override
1213                 protected void invalidated() {
1214                     reapplyCSS();
1215                     if (PrismSettings.printRenderGraph) {
1216                         NodeHelper.markDirty(Node.this, DirtyBits.DEBUG);
1217                     }
1218                 }
1219 
1220                 @Override
1221                 public Object getBean() {
1222                     return Node.this;


1274     /**
1275      * A string representation of the CSS style associated with this
1276      * specific {@code Node}. This is analogous to the "style" attribute of an
1277      * HTML element. Note that, like the HTML style attribute, this
1278      * variable contains style properties and values and not the
1279      * selector portion of a style rule.
1280      * @defaultValue empty string
1281      * @see <a href="doc-files/cssref.html">CSS Reference Guide</a>.
1282      */
1283     private StringProperty style;
1284 
1285     /**
1286      * A string representation of the CSS style associated with this
1287      * specific {@code Node}. This is analogous to the "style" attribute of an
1288      * HTML element. Note that, like the HTML style attribute, this
1289      * variable contains style properties and values and not the
1290      * selector portion of a style rule.
1291      * @param value The inline CSS style to use for this {@code Node}.
1292      *         {@code null} is implicitly converted to an empty String.
1293      * @defaultValue empty string
1294      * @see <a href="doc-files/cssref.html">CSS Reference Guide</a>
1295      */
1296     public final void setStyle(String value) {
1297         styleProperty().set(value);
1298     }
1299 
1300     // TODO: javadoc copied from property for the sole purpose of providing a return tag
1301     /**
1302      * A string representation of the CSS style associated with this
1303      * specific {@code Node}. This is analogous to the "style" attribute of an
1304      * HTML element. Note that, like the HTML style attribute, this
1305      * variable contains style properties and values and not the
1306      * selector portion of a style rule.
1307      * @defaultValue empty string
1308      * @return The inline CSS style associated with this {@code Node}.
1309      *         If this {@code Node} does not have an inline style,
1310      *         an empty String is returned.
1311      * @see <a href="doc-files/cssref.html">CSS Reference Guide</a>
1312      */
1313     public final String getStyle() {
1314         return style == null ? "" : style.get();
1315     }
1316 
1317     public final StringProperty styleProperty() {
1318         if (style == null) {
1319             style = new StringPropertyBase("") {
1320 
1321                 @Override public void set(String value) {
1322                     // getStyle returns an empty string if the style property
1323                     // is null. To be consistent, getStyle should also return
1324                     // an empty string when the style property's value is null.
1325                     super.set((value != null) ? value : "");
1326                 }
1327 
1328                 @Override
1329                 protected void invalidated() {
1330                     // If the style has changed, then styles of this node
1331                     // and child nodes might be affected.


< prev index next >