@Override
 public void delete(List<BindingInfo> bindings, boolean deleteAll) throws Exception {
   if (m_model instanceof WidgetObserveInfo) {
     WidgetObserveInfo model = (WidgetObserveInfo) m_model;
     if (model.isGrid()) {
       model.getSelfProperty().setProperties(Collections.<IObserveInfo>emptyList());
     }
   }
   super.delete(bindings, deleteAll);
 }
 private void createAutobindings(List<FieldBindingInfo> bindings, boolean full) throws Exception {
   BeanObserveInfo beanObserveObject = null;
   if (full) {
     if (m_gridSelectionModel == null) {
       if (m_model instanceof BeanObserveInfo) {
         beanObserveObject = (BeanObserveInfo) m_model;
       }
     } else {
       beanObserveObject = m_gridSelectionModel;
     }
   }
   WidgetObserveInfo formPanel = (WidgetObserveInfo) m_target;
   for (WidgetObserveInfo field : formPanel.getChildren()) {
     Property property = field.getJavaInfo().getPropertyByTitle("name");
     if (property != null) {
       Object nameValue = property.getValue();
       if (nameValue instanceof String && !StringUtils.isEmpty(nameValue.toString())) {
         FieldBindingInfo binding =
             field.createFieldBinding(field.getSelfProperty(), "\"" + nameValue.toString() + "\"");
         if (full) {
           if (beanObserveObject == null) {
             binding.setModel(m_model, null);
           } else {
             binding.setModel(
                 beanObserveObject,
                 beanObserveObject.resolvePropertyReference(binding.getParsedProperty(), null));
           }
         }
         binding.setAutobind(true);
         binding.setParentBinding(this);
         bindings.add(binding);
       }
     }
   }
 }
 private void finishBinding(
     Expression grid, Expression bindingElement, IDatabindingsProvider iprovider)
     throws Exception {
   DatabindingsProvider provider = DatabindingsProvider.cast(iprovider);
   BeansObserveTypeContainer beansContainer = provider.getBeansContainer();
   WidgetsObserveTypeContainer widgetsContainer = provider.getWidgetsContainer();
   //
   WidgetObserveInfo gridWidget = widgetsContainer.getBindableWidget(grid);
   m_model = gridWidget;
   m_modelProperty = gridWidget.getSelfProperty();
   //
   ClassLoader classLoader = CoreUtils.classLoader(provider.getJavaInfoRoot());
   String bindingElementClassName = AstNodeUtils.getFullyQualifiedName(bindingElement, true);
   Class<?> bindingElementClass = classLoader.loadClass(bindingElementClassName);
   //
   m_gridSelectionModel =
       new BeanObserveInfo(beansContainer.getBeanSupport(), m_modelProperty, bindingElementClass);
   gridWidget
       .getSelfProperty()
       .setProperties(
           m_gridSelectionModel.getChildren(ChildrenContext.ChildrenForPropertiesTable));
   //
   for (FieldBindingInfo binding : m_fieldBindings) {
     binding.setModel(
         m_model,
         m_gridSelectionModel.resolvePropertyReference(binding.getParsedProperty(), null));
     binding.setGridSelectionModel(m_gridSelectionModel);
   }
   //
   int index = provider.getBindings().indexOf(this);
   provider.getBindings().addAll(index + 1, m_fieldBindings);
   //
   if (m_autobind) {
     createAutobindings(m_fieldBindings, true);
   }
 }
  ////////////////////////////////////////////////////////////////////////////
  //
  // Editing
  //
  ////////////////////////////////////////////////////////////////////////////
  @Override
  public void createContentProviders(
      List<IUiContentProvider> providers,
      IPageListener listener,
      final DatabindingsProvider provider)
      throws Exception {
    super_createContentProviders(providers, listener, provider);
    //
    AutobindUiContentProvider autoBindEditor = new AutobindUiContentProvider(this);
    providers.add(autoBindEditor);
    //
    MultiTargetRunnable multiTargetRunnable = null;
    //
    if (m_model instanceof WidgetObserveInfo) {
      WidgetObserveInfo model = (WidgetObserveInfo) m_model;
      if (model.isGrid()) {
        ChooseClassConfiguration configuration = new ChooseClassConfiguration();
        configuration.setDialogFieldLabel("Grid selection element:");
        configuration.setBaseClassName("com.extjs.gxt.ui.client.data.ModelData");
        configuration.setValueScope("beans");
        configuration.setChooseInterfaces(true);
        configuration.setEmptyClassErrorMessage("Choose Grid selection element");
        configuration.setErrorMessagePrefix("Grid selection element");
        //
        ChooseClassUiContentProvider gridSelectionElementEditor =
            new ChooseClassUiContentProvider(configuration) {
              public void updateFromObject() throws Exception {
                if (m_gridSelectionModel == null) {
                  calculateFinish();
                } else {
                  setClassName(m_gridSelectionModel.getObjectType().getName());
                }
              }

              public void saveToObject() throws Exception {
                m_gridSelectionModel =
                    new BeanObserveInfo(
                        provider.getBeansContainer().getBeanSupport(),
                        m_modelProperty,
                        getChoosenClass());
                ((WidgetObserveInfo) m_model)
                    .getSelfProperty()
                    .setProperties(
                        m_gridSelectionModel.getChildren(
                            ChildrenContext.ChildrenForPropertiesTable));
              }
            };
        providers.add(gridSelectionElementEditor);
        //
        multiTargetRunnable = new MultiTargetRunnable(gridSelectionElementEditor);
        new ChooseClassRouter(gridSelectionElementEditor, multiTargetRunnable);
      }
    }
    //
    TabContainerConfiguration configuration = new TabContainerConfiguration();
    configuration.setUseMultiAddButton(true);
    configuration.setCreateEmptyPage("Bindings", "Add field bindings for this form.");
    //
    providers.add(
        new FormBindingUiContentProvider(
            provider,
            configuration,
            (BooleanDialogField) autoBindEditor.getDialogField(),
            multiTargetRunnable,
            this));
  }