< prev index next >

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

Print this page




 966      * @see <a href="doc-files/cssref.html">CSS Reference Guide</a>.
 967      */
 968     private StringProperty id;
 969 
 970     public final void setId(String value) {
 971         idProperty().set(value);
 972     }
 973 
 974     //TODO: this is copied from the property in order to add the @return statement.
 975     //      We should have a better, general solution without the need to copy it.
 976     /**
 977      * The id of this {@code Node}. This simple string identifier is useful for
 978      * finding a specific Node within the scene graph. While the id of a Node
 979      * should be unique within the scene graph, this uniqueness is not enforced.
 980      * This is analogous to the "id" attribute on an HTML element
 981      * (<a href="http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier">CSS ID Specification</a>).
 982      *
 983      * @return the id assigned to this {@code Node} using the {@code setId}
 984      *         method or {@code null}, if no id has been assigned.
 985      * @defaultValue null
 986      * @see <a href="doc-files/cssref.html">CSS Reference Guide</a>.
 987      */
 988     public final String getId() {
 989         return id == null ? null : id.get();
 990     }
 991 
 992     public final StringProperty idProperty() {
 993         if (id == null) {
 994             id = new StringPropertyBase() {
 995 
 996                 @Override
 997                 protected void invalidated() {
 998                     impl_reapplyCSS();
 999                     if (PrismSettings.printRenderGraph) {
1000                         impl_markDirty(DirtyBits.DEBUG);
1001                     }
1002                 }
1003 
1004                 @Override
1005                 public Object getBean() {
1006                     return Node.this;


1058     /**
1059      * A string representation of the CSS style associated with this
1060      * specific {@code Node}. This is analogous to the "style" attribute of an
1061      * HTML element. Note that, like the HTML style attribute, this
1062      * variable contains style properties and values and not the
1063      * selector portion of a style rule.
1064      * @defaultValue empty string
1065      * @see <a href="doc-files/cssref.html">CSS Reference Guide</a>.
1066      */
1067     private StringProperty style;
1068 
1069     /**
1070      * A string representation of the CSS style associated with this
1071      * specific {@code Node}. This is analogous to the "style" attribute of an
1072      * HTML element. Note that, like the HTML style attribute, this
1073      * variable contains style properties and values and not the
1074      * selector portion of a style rule.
1075      * @param value The inline CSS style to use for this {@code Node}.
1076      *         {@code null} is implicitly converted to an empty String.
1077      * @defaultValue empty string
1078      * @see <a href="doc-files/cssref.html">CSS Reference Guide</a>.
1079      */
1080     public final void setStyle(String value) {
1081         styleProperty().set(value);
1082     }
1083 
1084     // TODO: javadoc copied from property for the sole purpose of providing a return tag
1085     /**
1086      * A string representation of the CSS style associated with this
1087      * specific {@code Node}. This is analogous to the "style" attribute of an
1088      * HTML element. Note that, like the HTML style attribute, this
1089      * variable contains style properties and values and not the
1090      * selector portion of a style rule.
1091      * @defaultValue empty string
1092      * @return The inline CSS style associated with this {@code Node}.
1093      *         If this {@code Node} does not have an inline style,
1094      *         an empty String is returned.
1095      * @see <a href="doc-files/cssref.html">CSS Reference Guide</a>.
1096      */
1097     public final String getStyle() {
1098         return style == null ? "" : style.get();
1099     }
1100 
1101     public final StringProperty styleProperty() {
1102         if (style == null) {
1103             style = new StringPropertyBase("") {
1104 
1105                 @Override public void set(String value) {
1106                     // getStyle returns an empty string if the style property
1107                     // is null. To be consistent, getStyle should also return
1108                     // an empty string when the style property's value is null.
1109                     super.set((value != null) ? value : "");
1110                 }
1111 
1112                 @Override
1113                 protected void invalidated() {
1114                     // If the style has changed, then styles of this node
1115                     // and child nodes might be affected.




 966      * @see <a href="doc-files/cssref.html">CSS Reference Guide</a>.
 967      */
 968     private StringProperty id;
 969 
 970     public final void setId(String value) {
 971         idProperty().set(value);
 972     }
 973 
 974     //TODO: this is copied from the property in order to add the @return statement.
 975     //      We should have a better, general solution without the need to copy it.
 976     /**
 977      * The id of this {@code Node}. This simple string identifier is useful for
 978      * finding a specific Node within the scene graph. While the id of a Node
 979      * should be unique within the scene graph, this uniqueness is not enforced.
 980      * This is analogous to the "id" attribute on an HTML element
 981      * (<a href="http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier">CSS ID Specification</a>).
 982      *
 983      * @return the id assigned to this {@code Node} using the {@code setId}
 984      *         method or {@code null}, if no id has been assigned.
 985      * @defaultValue null
 986      * @see <a href="doc-files/cssref.html">CSS Reference Guide</a>
 987      */
 988     public final String getId() {
 989         return id == null ? null : id.get();
 990     }
 991 
 992     public final StringProperty idProperty() {
 993         if (id == null) {
 994             id = new StringPropertyBase() {
 995 
 996                 @Override
 997                 protected void invalidated() {
 998                     impl_reapplyCSS();
 999                     if (PrismSettings.printRenderGraph) {
1000                         impl_markDirty(DirtyBits.DEBUG);
1001                     }
1002                 }
1003 
1004                 @Override
1005                 public Object getBean() {
1006                     return Node.this;


1058     /**
1059      * A string representation of the CSS style associated with this
1060      * specific {@code Node}. This is analogous to the "style" attribute of an
1061      * HTML element. Note that, like the HTML style attribute, this
1062      * variable contains style properties and values and not the
1063      * selector portion of a style rule.
1064      * @defaultValue empty string
1065      * @see <a href="doc-files/cssref.html">CSS Reference Guide</a>.
1066      */
1067     private StringProperty style;
1068 
1069     /**
1070      * A string representation of the CSS style associated with this
1071      * specific {@code Node}. This is analogous to the "style" attribute of an
1072      * HTML element. Note that, like the HTML style attribute, this
1073      * variable contains style properties and values and not the
1074      * selector portion of a style rule.
1075      * @param value The inline CSS style to use for this {@code Node}.
1076      *         {@code null} is implicitly converted to an empty String.
1077      * @defaultValue empty string
1078      * @see <a href="doc-files/cssref.html">CSS Reference Guide</a>
1079      */
1080     public final void setStyle(String value) {
1081         styleProperty().set(value);
1082     }
1083 
1084     // TODO: javadoc copied from property for the sole purpose of providing a return tag
1085     /**
1086      * A string representation of the CSS style associated with this
1087      * specific {@code Node}. This is analogous to the "style" attribute of an
1088      * HTML element. Note that, like the HTML style attribute, this
1089      * variable contains style properties and values and not the
1090      * selector portion of a style rule.
1091      * @defaultValue empty string
1092      * @return The inline CSS style associated with this {@code Node}.
1093      *         If this {@code Node} does not have an inline style,
1094      *         an empty String is returned.
1095      * @see <a href="doc-files/cssref.html">CSS Reference Guide</a>
1096      */
1097     public final String getStyle() {
1098         return style == null ? "" : style.get();
1099     }
1100 
1101     public final StringProperty styleProperty() {
1102         if (style == null) {
1103             style = new StringPropertyBase("") {
1104 
1105                 @Override public void set(String value) {
1106                     // getStyle returns an empty string if the style property
1107                     // is null. To be consistent, getStyle should also return
1108                     // an empty string when the style property's value is null.
1109                     super.set((value != null) ? value : "");
1110                 }
1111 
1112                 @Override
1113                 protected void invalidated() {
1114                     // If the style has changed, then styles of this node
1115                     // and child nodes might be affected.


< prev index next >