Implement PropertyEditorUI
The class that actually displays the custom property editor must
implement the
com.escenic.studio.editors.PropertyEditorUI
interface. The main body of this class will be standard Swing
programming and is not discussed here. In addition to ensuring that the
class implements PropertyEditorUI
correctly, however,
you also need to be aware of the following:
-
The
PropertyEditorSpi
class that creates instances of this class passes two parameters to the constructor: anAbstractPropertyBinding
and aResourceRecorder
. -
The
AbstractPropertyBinding
object has agetPropertyDescriptor()
method that gives you access to the contents of the field definition in thecontent-type
resource. -
The
PropertyDescriptor
you obtain in this way hasgetModule()
andgetModules()
methods that you can use to access any parameters specified in the field definition. -
Your class should include a
dispose()
method that calls theResourceRecorder
'sdisposeAll()
method for all theAbstractPropertyBinding
'sBindingListener
s. For example:public void dispose() { List<BindingListener> listeners = new ArrayList<BindingListener>(mBinding.getBindingListeners()); for (BindingListener listener : listeners) { mBinding.removeBindingListener(listener); } mResourceRecorder.disposeAll(); }