< prev index next >

src/java.desktop/share/classes/java/beans/PropertyEditor.java

Print this page




 110     /**
 111      * Returns a fragment of Java code that can be used to set a property
 112      * to match the editors current state. This method is intended
 113      * for use when generating Java code to reflect changes made through the
 114      * property editor.
 115      * <p>
 116      * The code fragment should be context free and must be a legal Java
 117      * expression as specified by the JLS.
 118      * <p>
 119      * Specifically, if the expression represents a computation then all
 120      * classes and static members should be fully qualified. This rule
 121      * applies to constructors, static methods and non primitive arguments.
 122      * <p>
 123      * Caution should be used when evaluating the expression as it may throw
 124      * exceptions. In particular, code generators must ensure that generated
 125      * code will compile in the presence of an expression that can throw
 126      * checked exceptions.
 127      * <p>
 128      * Example results are:
 129      * <ul>
 130      * <li>Primitive expresssion: <code>2</code>
 131      * <li>Class constructor: <code>new java.awt.Color(127,127,34)</code>
 132      * <li>Static field: <code>java.awt.Color.orange</code>
 133      * <li>Static method: <code>javax.swing.Box.createRigidArea(new
 134      *                                   java.awt.Dimension(0, 5))</code>
 135      * </ul>
 136      *
 137      * @return a fragment of Java code representing an initializer for the
 138      *         current value. It should not contain a semi-colon
 139      *         ('<code>;</code>') to end the expression.
 140      */
 141     String getJavaInitializationString();
 142 
 143     //----------------------------------------------------------------------
 144 
 145     /**
 146      * Gets the property value as text.
 147      *
 148      * @return The property value as a human editable string.
 149      * <p>   Returns null if the value can't be expressed as an editable string.
 150      * <p>   If a non-null value is returned, then the PropertyEditor should
 151      *       be prepared to parse that string back in setAsText().
 152      */
 153     String getAsText();
 154 
 155     /**
 156      * Set the property value by parsing a given String.  May raise
 157      * java.lang.IllegalArgumentException if either the String is
 158      * badly formatted or if this kind of property can't be expressed
 159      * as text.




 110     /**
 111      * Returns a fragment of Java code that can be used to set a property
 112      * to match the editors current state. This method is intended
 113      * for use when generating Java code to reflect changes made through the
 114      * property editor.
 115      * <p>
 116      * The code fragment should be context free and must be a legal Java
 117      * expression as specified by the JLS.
 118      * <p>
 119      * Specifically, if the expression represents a computation then all
 120      * classes and static members should be fully qualified. This rule
 121      * applies to constructors, static methods and non primitive arguments.
 122      * <p>
 123      * Caution should be used when evaluating the expression as it may throw
 124      * exceptions. In particular, code generators must ensure that generated
 125      * code will compile in the presence of an expression that can throw
 126      * checked exceptions.
 127      * <p>
 128      * Example results are:
 129      * <ul>
 130      * <li>Primitive expresssion: {@code 2}
 131      * <li>Class constructor: {@code new java.awt.Color(127,127,34)}
 132      * <li>Static field: {@code java.awt.Color.orange}
 133      * <li>Static method: {@code javax.swing.Box.createRigidArea(new
 134      *                                   java.awt.Dimension(0, 5))}
 135      * </ul>
 136      *
 137      * @return a fragment of Java code representing an initializer for the
 138      *         current value. It should not contain a semi-colon
 139      *         ('{@code ;}') to end the expression.
 140      */
 141     String getJavaInitializationString();
 142 
 143     //----------------------------------------------------------------------
 144 
 145     /**
 146      * Gets the property value as text.
 147      *
 148      * @return The property value as a human editable string.
 149      * <p>   Returns null if the value can't be expressed as an editable string.
 150      * <p>   If a non-null value is returned, then the PropertyEditor should
 151      *       be prepared to parse that string back in setAsText().
 152      */
 153     String getAsText();
 154 
 155     /**
 156      * Set the property value by parsing a given String.  May raise
 157      * java.lang.IllegalArgumentException if either the String is
 158      * badly formatted or if this kind of property can't be expressed
 159      * as text.


< prev index next >