org.netbeans.core/2 3.32

org.netbeans.beaninfo.editors
Class DimensionEditor

java.lang.Object
  extended by java.beans.PropertyEditorSupport
      extended by org.netbeans.beaninfo.editors.DimensionEditor
All Implemented Interfaces:
PropertyEditor, XMLPropertyEditor, ExPropertyEditor

public class DimensionEditor
extends PropertyEditorSupport

A property editor for Dimension class.


Field Summary
static String ATTR_VALUE
           
 
Fields inherited from interface org.openide.explorer.propertysheet.ExPropertyEditor
PROP_VALUE_VALID, PROPERTY_HELP_ID
 
Constructor Summary
DimensionEditor()
           
 
Method Summary
 void attachEnv(PropertyEnv env)
           
 String getAsText()
           
 Component getCustomEditor()
           
 String getJavaInitializationString()
          This method is intended for use when generating Java code to set the value of the property.
protected  String getXMLValueTag()
          Provides name of XML tag to use for XML persistence of the property value
 void readFromXML(Node element)
          Called to load property value from specified XML subtree.
 void setAsText(String text)
          Set the property value by parsing a given String.
 Node storeToXML(Document doc)
          Called to store current property value into XML subtree.
 boolean supportsCustomEditor()
           
 
Methods inherited from class java.beans.PropertyEditorSupport
addPropertyChangeListener, firePropertyChange, getSource, getTags, getValue, isPaintable, paintValue, removePropertyChangeListener, setSource, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.beans.PropertyEditor
addPropertyChangeListener, getTags, getValue, isPaintable, paintValue, removePropertyChangeListener, setValue
 

Field Detail

ATTR_VALUE

public static final String ATTR_VALUE
See Also:
Constant Field Values
Constructor Detail

DimensionEditor

public DimensionEditor()
Method Detail

supportsCustomEditor

public boolean supportsCustomEditor()
Specified by:
supportsCustomEditor in interface PropertyEditor
Overrides:
supportsCustomEditor in class PropertyEditorSupport

getCustomEditor

public Component getCustomEditor()
Specified by:
getCustomEditor in interface PropertyEditor
Overrides:
getCustomEditor in class PropertyEditorSupport

getXMLValueTag

protected String getXMLValueTag()
Provides name of XML tag to use for XML persistence of the property value


attachEnv

public void attachEnv(PropertyEnv env)
Specified by:
attachEnv in interface ExPropertyEditor

getJavaInitializationString

public String getJavaInitializationString()
This method is intended for use when generating Java code to set the value of the property. It should return a fragment of Java code that can be used to initialize a variable with the current property value.

Example results are "2", "new Color(127,127,34)", "Color.orange", etc.

Specified by:
getJavaInitializationString in interface PropertyEditor
Overrides:
getJavaInitializationString in class PropertyEditorSupport
Returns:
A fragment of Java code representing an initializer for the current value.

getAsText

public String getAsText()
Specified by:
getAsText in interface PropertyEditor
Overrides:
getAsText in class PropertyEditorSupport
Returns:
The property value as a human editable string.

Returns null if the value can't be expressed as an editable string.

If a non-null value is returned, then the PropertyEditor should be prepared to parse that string back in setAsText().


setAsText

public void setAsText(String text)
               throws IllegalArgumentException
Set the property value by parsing a given String. May raise java.lang.IllegalArgumentException if either the String is badly formatted or if this kind of property can't be expressed as text.

Specified by:
setAsText in interface PropertyEditor
Overrides:
setAsText in class PropertyEditorSupport
Parameters:
text - The string to be parsed.
Throws:
IllegalArgumentException

readFromXML

public void readFromXML(Node element)
                 throws IOException
Called to load property value from specified XML subtree. If succesfully loaded, the value should be available via the getValue method. An IOException should be thrown when the value cannot be restored from the specified XML element

Specified by:
readFromXML in interface XMLPropertyEditor
Parameters:
element - the XML DOM element representing a subtree of XML from which the value should be loaded
Throws:
IOException - thrown when the value cannot be restored from the specified XML element

storeToXML

public Node storeToXML(Document doc)
Called to store current property value into XML subtree. The property value should be set using the setValue method prior to calling this method.

Specified by:
storeToXML in interface XMLPropertyEditor
Parameters:
doc - The XML document to store the XML in - should be used for creating nodes only
Returns:
the XML DOM element representing a subtree of XML from which the value should be loaded

org.netbeans.core/2 3.32

Built on May 22 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.