org.netbeans.core/2 3.32

org.netbeans.beaninfo.editors
Class ExPropertyEditorSupport

java.lang.Object
  extended by java.beans.PropertyEditorSupport
      extended by org.netbeans.beaninfo.editors.ExPropertyEditorSupport
All Implemented Interfaces:
PropertyEditor, ExPropertyEditor
Direct Known Subclasses:
BoolEditor, IntEditor

public abstract class ExPropertyEditorSupport
extends PropertyEditorSupport
implements ExPropertyEditor

Support class for ExPropertyEditor which provides means for validating hints from the PropertyEnv instance passed to attachEnv. Forces subclasses to be fail-fast in the case that illegal values are passed via the PropertyEnv (the alternative is cryptic error messages when the editor tries to use the hints).


Nested Class Summary
static class ExPropertyEditorSupport.EnvException
          This class exists to enable unit tests to differentiate between code bugs in the editors and invalid values from the propertyEnv.
 
Field Summary
 
Fields inherited from interface org.openide.explorer.propertysheet.ExPropertyEditor
PROP_VALUE_VALID, PROPERTY_HELP_ID
 
Constructor Summary
protected ExPropertyEditorSupport()
          Creates a new instance of ExPropertyEditorSupport
 
Method Summary
protected static String arrToStr(Object[] s)
          Utility method to convert an array of Objects into a comma delimited string.
 void attachEnv(PropertyEnv env)
          Implementation of PropertyEditorSupport.attachEnv().
protected abstract  void attachEnvImpl(PropertyEnv env)
          Perform the actual attaching of the PropertyEnv.
protected abstract  void validateEnv(PropertyEnv env)
          Validate values stored in the PropertyEnv.
 
Methods inherited from class java.beans.PropertyEditorSupport
addPropertyChangeListener, firePropertyChange, getAsText, getCustomEditor, getJavaInitializationString, getSource, getTags, getValue, isPaintable, paintValue, removePropertyChangeListener, setAsText, setSource, setValue, supportsCustomEditor
 
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, getAsText, getCustomEditor, getJavaInitializationString, getTags, getValue, isPaintable, paintValue, removePropertyChangeListener, setAsText, setValue, supportsCustomEditor
 

Constructor Detail

ExPropertyEditorSupport

protected ExPropertyEditorSupport()
Creates a new instance of ExPropertyEditorSupport

Method Detail

attachEnv

public final void attachEnv(PropertyEnv env)
Implementation of PropertyEditorSupport.attachEnv(). This method is final to ensure that the values from the env are validated. Subclasses should override attachEnvImpl to provide the actual attaching behavior. attachEnvImpl is called first, then validateEnv (to avoid fetching the values twice).

Specified by:
attachEnv in interface ExPropertyEditor

attachEnvImpl

protected abstract void attachEnvImpl(PropertyEnv env)
Perform the actual attaching of the PropertyEnv.


validateEnv

protected abstract void validateEnv(PropertyEnv env)
Validate values stored in the PropertyEnv. This method allows subclasses to be fail-fast if they are supplied illegal values as hints from the PropertyEnv. Subclasses should confirm that any hints used by their property editor are valid values. If they are not valid, an EnvException should be thrown with a clear description of the problem.


arrToStr

protected static final String arrToStr(Object[] s)
Utility method to convert an array of Objects into a comma delimited string.


org.netbeans.core/2 3.32

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