return ( UiAccessBuilderConfiguration<T> ) super.getConfiguration();
}
@NotNull
public EditorDescriptor getEditorDescriptor(@NotNull final ObservableObjectAccess<T> objectAccess) {
EditorDescriptor editorDescriptor = new EditorDescriptor();
editorDescriptor.setEditorClass( FormBasedEditor.class );
// editorDescriptor.setBeanName( getConfiguration().getIdStrategy().getBaseId() );
Map<Object, Object> map = new HashMap<Object, Object>();
map.put( FormBasedEditor.PROPERTY_ID_STRATEGY, getConfiguration().getIdStrategy() );
map.put( FormBasedEditor.PROPERTY_FORM_FACTORY, getConfiguration().getFormFactory() );
map.put( FormBasedEditor.PROPERTY_OBJECT_COMMIT, objectAccess );
map.put( FormBasedEditor.PROPERTY_LABEL_PROVIDER, getLabelProvider() );
FormBasedEditor.InitializerCallback<T> initializerCallback = new FormBasedEditor.InitializerCallback<T>() {
@Override
public void isInitializing( @NotNull final FormBasedEditor<T> editor ) {
if ( objectAccess instanceof DelegatingObjectAccess ) {
ObservableObjectAccess<T> currentDelegate = ( ( DelegatingObjectAccess<T> ) objectAccess ).getCurrentDelegate();
if ( currentDelegate == null ) {
throw new IllegalStateException( "No delegate available - impossible" );
}
currentDelegate.addElementListener( new EditorCloseListener<T>( editor ) );
} else {
objectAccess.addElementListener( new EditorCloseListener<T>( editor ) );
}
}
};
map.put( FormBasedEditor.PROPERTY_INITIALIZER_CALLBACK, initializerCallback );
editorDescriptor.setEditorProperties( map );
return editorDescriptor;
}