Program: 35647
Project: 35647
Buggy source:
/** 
 * Create the actions to add and create financial projects and local partner projects.
 */
private void addLinkedProjectsListeners(){
  view.getAddFinancialProjectButton().addListener(Events.OnClick,new Listener<ButtonEvent>(){
    final FormWindow window=new FormWindow();
    @Override public void handleEvent(    ButtonEvent be){
      final GetProjects cmd=new GetProjects();
      cmd.setViewOwnOrManage(true);
      dispatcher.execute(cmd,null,new AsyncCallback<ProjectListResult>(){
        @Override public void onFailure(        Throwable e){
          Log.error("String_Node_Str" + null + "String_Node_Str",e);
          MessageBox.alert(I18N.CONSTANTS.createProjectTypeError(),I18N.CONSTANTS.createProjectTypeErrorDetails(),null);
        }
        @Override public void onSuccess(        ProjectListResult result){
          final List<ProjectDTOLight> resultList=result.getOrderedList(ProjectListResult.CODE_COMPARATOR);
          resultList.remove(projectPresenter.getCurrentProjectDTO().light());
          if (resultList.isEmpty()) {
            MessageBox.alert(I18N.CONSTANTS.createProjectTypeFundingSelectNone(),I18N.CONSTANTS.createProjectTypeFundingSelectNoneDetails(),null);
            return;
          }
          for (          final ProjectDTOLight p : resultList) {
            p.generateCompleteName();
          }
          window.clear();
          final ComboBox<ProjectDTOLight> projects=window.addChoicesList(I18N.CONSTANTS.createProjectTypeFunding(),resultList,false,"String_Node_Str");
          final LabelField modelTypeLabel=window.addLabelField(I18N.CONSTANTS.createProjectType());
          modelTypeLabel.setHeight(25);
          final NumberField amountField=window.addNumberField(I18N.MESSAGES.projectFundedByDetails(projectPresenter.getCurrentProjectDTO().getName()) + "String_Node_Str" + I18N.CONSTANTS.currencyEuro()+ ')',true);
          final LabelField percentageField=window.addLabelField(I18N.CONSTANTS.createProjectPercentage());
          percentageField.setValue("String_Node_Str");
          projects.addListener(Events.Select,new Listener<BaseEvent>(){
            @Override public void handleEvent(            BaseEvent be){
              final ProjectModelType type=projects.getSelection().get(0).getProjectModelType(authentication.getOrganizationId());
              final Grid iconGrid=new Grid(1,2);
              iconGrid.setCellPadding(0);
              iconGrid.setCellSpacing(0);
              iconGrid.setWidget(0,0,FundingIconProvider.getProjectTypeIcon(type,IconSize.MEDIUM).createImage());
              DOM.setStyleAttribute(iconGrid.getCellFormatter().getElement(0,0),"String_Node_Str","String_Node_Str");
              iconGrid.setText(0,1,ProjectModelType.getName(type));
              DOM.setStyleAttribute(iconGrid.getCellFormatter().getElement(0,1),"String_Node_Str","String_Node_Str");
              modelTypeLabel.setText(iconGrid.getElement().getString());
            }
          }
);
          amountField.addListener(Events.Change,new Listener<BaseEvent>(){
            @Override public void handleEvent(            BaseEvent be){
              if (amountField.getValue() == null) {
                amountField.setValue(0);
              }
              percentageField.setText(NumberUtils.ratioAsString(amountField.getValue(),projectPresenter.getCurrentProjectDTO().getPlannedBudget()));
            }
          }
);
          window.addFormSubmitListener(new FormSubmitListener(){
            @Override public void formSubmitted(            Object... values){
              if (values == null || values.length < 4) {
                return;
              }
              final Object value0=values[0];
              if (!(value0 instanceof ProjectDTOLight)) {
                return;
              }
              final Object value1=values[2];
              if (!(value1 instanceof Number)) {
                return;
              }
              final ProjectDTOLight p=(ProjectDTOLight)value0;
              final HashMap<String,Object> parameters=new HashMap<String,Object>();
              parameters.put("String_Node_Str",p.getId());
              parameters.put("String_Node_Str",projectPresenter.getCurrentProjectDTO().getId());
              parameters.put("String_Node_Str",((Number)value1).doubleValue());
              dispatcher.execute(new CreateEntity("String_Node_Str",parameters),null,new AsyncCallback<CreateResult>(){
                @Override public void onFailure(                Throwable e){
                  Log.error("String_Node_Str",e);
                  MessageBox.alert(I18N.CONSTANTS.createProjectTypeFundingCreationError(),I18N.CONSTANTS.createProjectTypeFundingCreationDetails(),null);
                }
                @Override public void onSuccess(                CreateResult result){
                  Notification.show(I18N.CONSTANTS.infoConfirmation(),I18N.CONSTANTS.createProjectTypeFundingSelectOk());
                  final ProjectFundingDTO r=(ProjectFundingDTO)result.getEntity();
                  if (result.getNewId() != -1) {
                    view.getFinancialProjectGrid().getStore().update(r);
                  }
 else {
                    view.getFinancialProjectGrid().getStore().add(r);
                  }
                  projectPresenter.getCurrentProjectDTO().addFunding(r);
                }
              }
);
            }
          }
);
          window.show(I18N.CONSTANTS.createProjectTypeFunding(),I18N.CONSTANTS.createProjectTypeFundingSelectDetails() + "String_Node_Str" + projectPresenter.getCurrentProjectDTO().getName()+ "String_Node_Str");
        }
      }
);
    }
  }
);
  view.getCreateFinancialProjectButton().addListener(Events.OnClick,new Listener<ButtonEvent>(){
    private final CreateProjectWindow window=new CreateProjectWindow(dispatcher,authentication,cache);
{
      window.addListener(new CreateProjectListener(){
        @Override public void projectCreated(        ProjectDTOLight project){
        }
        @Override public void projectCreatedAsFunding(        ProjectDTOLight project,        double percentage){
          final HashMap<String,Object> parameters=new HashMap<String,Object>();
          parameters.put("String_Node_Str",project.getId());
          parameters.put("String_Node_Str",projectPresenter.getCurrentProjectDTO().getId());
          parameters.put("String_Node_Str",percentage);
          dispatcher.execute(new CreateEntity("String_Node_Str",parameters),null,new AsyncCallback<CreateResult>(){
            @Override public void onFailure(            Throwable e){
              Log.error("String_Node_Str",e);
              MessageBox.alert(I18N.CONSTANTS.createProjectTypeFundingCreationError(),I18N.CONSTANTS.createProjectTypeFundingCreationDetails(),null);
            }
            @Override public void onSuccess(            CreateResult result){
              Notification.show(I18N.CONSTANTS.infoConfirmation(),I18N.CONSTANTS.createProjectTypeFundingSelectOk());
              final ProjectFundingDTO r=(ProjectFundingDTO)result.getEntity();
              view.getFinancialProjectGrid().getStore().add(r);
              projectPresenter.getCurrentProjectDTO().addFunding(r);
            }
          }
);
        }
        @Override public void projectCreatedAsFunded(        ProjectDTOLight project,        double percentage){
        }
        @Override public void projectCreatedAsTest(        ProjectDTOLight project){
        }
        @Override public void projectDeletedAsTest(        ProjectDTOLight project){
        }
      }
);
    }
    @Override public void handleEvent(    ButtonEvent be){
      window.show(Mode.FUNDING,projectPresenter.getCurrentProjectDTO().light());
    }
  }
);
  view.getAddLocalPartnerProjectButton().addListener(Events.OnClick,new Listener<ButtonEvent>(){
    final FormWindow window=new FormWindow();
    @Override public void handleEvent(    ButtonEvent be){
      final GetProjects cmd=new GetProjects();
      cmd.setViewOwnOrManage(true);
      dispatcher.execute(cmd,null,new AsyncCallback<ProjectListResult>(){
        @Override public void onFailure(        Throwable e){
          Log.error("String_Node_Str" + null + "String_Node_Str",e);
          MessageBox.alert(I18N.CONSTANTS.createProjectTypeError(),I18N.CONSTANTS.createProjectTypeErrorDetails(),null);
        }
        @Override public void onSuccess(        ProjectListResult result){
          final List<ProjectDTOLight> resultList=result.getOrderedList(ProjectListResult.CODE_COMPARATOR);
          resultList.remove(projectPresenter.getCurrentProjectDTO().light());
          if (resultList.isEmpty()) {
            MessageBox.alert(I18N.CONSTANTS.createProjectTypePartnerSelectNone(),I18N.CONSTANTS.createProjectTypePartnerSelectNoneDetails(),null);
            return;
          }
          for (          final ProjectDTOLight p : resultList) {
            p.generateCompleteName();
          }
          window.clear();
          final ComboBox<ProjectDTOLight> projects=window.addChoicesList(I18N.CONSTANTS.createProjectTypeFunding(),resultList,false,"String_Node_Str");
          final LabelField modelTypeLabel=window.addLabelField(I18N.CONSTANTS.createProjectType());
          modelTypeLabel.setHeight(25);
          final NumberField amountField=window.addNumberField(I18N.MESSAGES.projectFinancesDetails(projectPresenter.getCurrentProjectDTO().getName()) + "String_Node_Str" + I18N.CONSTANTS.currencyEuro()+ ')',true);
          final LabelField percentageField=window.addLabelField(I18N.CONSTANTS.createProjectPercentage());
          percentageField.setValue("String_Node_Str");
          projects.addListener(Events.Select,new Listener<BaseEvent>(){
            @Override public void handleEvent(            BaseEvent be){
              final ProjectModelType type=projects.getSelection().get(0).getProjectModelType(authentication.getOrganizationId());
              final Grid iconGrid=new Grid(1,2);
              iconGrid.setCellPadding(0);
              iconGrid.setCellSpacing(0);
              iconGrid.setWidget(0,0,FundingIconProvider.getProjectTypeIcon(type,IconSize.MEDIUM).createImage());
              DOM.setStyleAttribute(iconGrid.getCellFormatter().getElement(0,0),"String_Node_Str","String_Node_Str");
              iconGrid.setText(0,1,ProjectModelType.getName(type));
              DOM.setStyleAttribute(iconGrid.getCellFormatter().getElement(0,1),"String_Node_Str","String_Node_Str");
              modelTypeLabel.setText(iconGrid.getElement().getString());
            }
          }
);
          amountField.addListener(Events.Change,new Listener<BaseEvent>(){
            @Override public void handleEvent(            BaseEvent be){
              if (amountField.getValue() == null) {
                amountField.setValue(0);
              }
              final List<ProjectDTOLight> selection=projects.getSelection();
              if (selection == null || selection.isEmpty()) {
                percentageField.setText(I18N.CONSTANTS.createProjectPercentageNotAvailable());
              }
 else {
                percentageField.setText(NumberUtils.ratioAsString(amountField.getValue(),selection.get(0).getPlannedBudget()));
              }
            }
          }
);
          window.addFormSubmitListener(new FormSubmitListener(){
            @Override public void formSubmitted(            Object... values){
              if (values == null || values.length < 2) {
                return;
              }
              final Object value0=values[0];
              if (!(value0 instanceof ProjectDTOLight)) {
                return;
              }
              final Object value1=values[2];
              if (!(value1 instanceof Number)) {
                return;
              }
              final ProjectDTOLight p=(ProjectDTOLight)value0;
              final HashMap<String,Object> parameters=new HashMap<String,Object>();
              parameters.put("String_Node_Str",projectPresenter.getCurrentProjectDTO().getId());
              parameters.put("String_Node_Str",p.getId());
              parameters.put("String_Node_Str",((Number)value1).doubleValue());
              dispatcher.execute(new CreateEntity("String_Node_Str",parameters),null,new AsyncCallback<CreateResult>(){
                @Override public void onFailure(                Throwable e){
                  Log.error("String_Node_Str",e);
                  MessageBox.alert(I18N.CONSTANTS.createProjectTypeFundingCreationError(),I18N.CONSTANTS.createProjectTypeFundingCreationDetails(),null);
                }
                @Override public void onSuccess(                CreateResult result){
                  Notification.show(I18N.CONSTANTS.infoConfirmation(),I18N.CONSTANTS.createProjectTypePartnerSelectOk());
                  final ProjectFundingDTO r=(ProjectFundingDTO)result.getEntity();
                  if (result.getNewId() != -1) {
                    view.getLocalPartnerProjectGrid().getStore().update(r);
                  }
 else {
                    view.getLocalPartnerProjectGrid().getStore().add(r);
                  }
                  projectPresenter.getCurrentProjectDTO().addFunded(r);
                }
              }
);
            }
          }
);
          window.show(I18N.CONSTANTS.createProjectTypePartner(),I18N.CONSTANTS.createProjectTypePartnerSelectDetails() + "String_Node_Str" + projectPresenter.getCurrentProjectDTO().getName()+ "String_Node_Str");
        }
      }
);
    }
  }
);
  view.getCreateLocalPartnerProjectButton().addListener(Events.OnClick,new Listener<ButtonEvent>(){
    private final CreateProjectWindow window=new CreateProjectWindow(dispatcher,authentication,cache);
{
      window.addListener(new CreateProjectListener(){
        @Override public void projectCreated(        ProjectDTOLight project){
        }
        @Override public void projectCreatedAsFunding(        ProjectDTOLight project,        double percentage){
        }
        @Override public void projectCreatedAsFunded(        ProjectDTOLight project,        double percentage){
          final HashMap<String,Object> parameters=new HashMap<String,Object>();
          parameters.put("String_Node_Str",projectPresenter.getCurrentProjectDTO().getId());
          parameters.put("String_Node_Str",project.getId());
          parameters.put("String_Node_Str",percentage);
          dispatcher.execute(new CreateEntity("String_Node_Str",parameters),null,new AsyncCallback<CreateResult>(){
            @Override public void onFailure(            Throwable e){
              Log.error("String_Node_Str",e);
              MessageBox.alert(I18N.CONSTANTS.createProjectTypeFundingCreationError(),I18N.CONSTANTS.createProjectTypeFundingCreationDetails(),null);
            }
            @Override public void onSuccess(            CreateResult result){
              Notification.show(I18N.CONSTANTS.infoConfirmation(),I18N.CONSTANTS.createProjectTypePartnerSelectOk());
              final ProjectFundingDTO r=(ProjectFundingDTO)result.getEntity();
              view.getLocalPartnerProjectGrid().getStore().add(r);
              projectPresenter.getCurrentProjectDTO().addFunded(r);
            }
          }
);
        }
        @Override public void projectCreatedAsTest(        ProjectDTOLight project){
        }
        @Override public void projectDeletedAsTest(        ProjectDTOLight project){
        }
      }
);
    }
    @Override public void handleEvent(    ButtonEvent be){
      window.show(Mode.FUNDED,projectPresenter.getCurrentProjectDTO().light());
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Create the actions to add and create financial projects and local partner projects.
 */
private void addLinkedProjectsListeners(){
  view.getAddFinancialProjectButton().addListener(Events.OnClick,new Listener<ButtonEvent>(){
    final FormWindow window=new FormWindow();
    @Override public void handleEvent(    ButtonEvent be){
      final GetProjects cmd=new GetProjects();
      cmd.setViewOwnOrManage(true);
      dispatcher.execute(cmd,null,new AsyncCallback<ProjectListResult>(){
        @Override public void onFailure(        Throwable e){
          Log.error("String_Node_Str" + null + "String_Node_Str",e);
          MessageBox.alert(I18N.CONSTANTS.createProjectTypeError(),I18N.CONSTANTS.createProjectTypeErrorDetails(),null);
        }
        @Override public void onSuccess(        ProjectListResult result){
          final List<ProjectDTOLight> resultList=result.getOrderedList(ProjectListResult.CODE_COMPARATOR);
          resultList.remove(projectPresenter.getCurrentProjectDTO().light());
          if (resultList.isEmpty()) {
            MessageBox.alert(I18N.CONSTANTS.createProjectTypeFundingSelectNone(),I18N.CONSTANTS.createProjectTypeFundingSelectNoneDetails(),null);
            return;
          }
          for (          final ProjectDTOLight p : resultList) {
            p.generateCompleteName();
          }
          window.clear();
          final ComboBox<ProjectDTOLight> projects=window.addChoicesList(I18N.CONSTANTS.createProjectTypeFunding(),resultList,false,"String_Node_Str");
          final LabelField modelTypeLabel=window.addLabelField(I18N.CONSTANTS.createProjectType());
          modelTypeLabel.setHeight(25);
          final NumberField amountField=window.addNumberField(I18N.MESSAGES.projectFundedByDetails(projectPresenter.getCurrentProjectDTO().getName()) + "String_Node_Str" + I18N.CONSTANTS.currencyEuro()+ ')',true);
          final LabelField percentageField=window.addLabelField(I18N.CONSTANTS.createProjectPercentage());
          percentageField.setValue("String_Node_Str");
          projects.addListener(Events.Select,new Listener<BaseEvent>(){
            @Override public void handleEvent(            BaseEvent be){
              final ProjectModelType type=projects.getSelection().get(0).getProjectModelType(authentication.getOrganizationId());
              final Grid iconGrid=new Grid(1,2);
              iconGrid.setCellPadding(0);
              iconGrid.setCellSpacing(0);
              iconGrid.setWidget(0,0,FundingIconProvider.getProjectTypeIcon(type,IconSize.MEDIUM).createImage());
              DOM.setStyleAttribute(iconGrid.getCellFormatter().getElement(0,0),"String_Node_Str","String_Node_Str");
              iconGrid.setText(0,1,ProjectModelType.getName(type));
              DOM.setStyleAttribute(iconGrid.getCellFormatter().getElement(0,1),"String_Node_Str","String_Node_Str");
              modelTypeLabel.setText(iconGrid.getElement().getString());
            }
          }
);
          amountField.addListener(Events.Change,new Listener<BaseEvent>(){
            @Override public void handleEvent(            BaseEvent be){
              if (amountField.getValue() == null) {
                amountField.setValue(0);
              }
              percentageField.setText(NumberUtils.ratioAsString(amountField.getValue(),projectPresenter.getCurrentProjectDTO().getPlannedBudget()));
            }
          }
);
          window.addFormSubmitListener(new FormSubmitListener(){
            @Override public void formSubmitted(            Object... values){
              if (values == null || values.length < 4) {
                return;
              }
              final Object value0=values[0];
              if (!(value0 instanceof ProjectDTOLight)) {
                return;
              }
              final Object value1=values[2];
              if (!(value1 instanceof Number)) {
                return;
              }
              final ProjectDTOLight p=(ProjectDTOLight)value0;
              final HashMap<String,Object> parameters=new HashMap<String,Object>();
              parameters.put("String_Node_Str",p.getId());
              parameters.put("String_Node_Str",projectPresenter.getCurrentProjectDTO().getId());
              parameters.put("String_Node_Str",((Number)value1).doubleValue());
              dispatcher.execute(new CreateEntity("String_Node_Str",parameters),null,new AsyncCallback<CreateResult>(){
                @Override public void onFailure(                Throwable e){
                  Log.error("String_Node_Str",e);
                  MessageBox.alert(I18N.CONSTANTS.createProjectTypeFundingCreationError(),I18N.CONSTANTS.createProjectTypeFundingCreationDetails(),null);
                }
                @Override public void onSuccess(                CreateResult result){
                  Notification.show(I18N.CONSTANTS.infoConfirmation(),I18N.CONSTANTS.createProjectTypeFundingSelectOk());
                  final ProjectFundingDTO r=(ProjectFundingDTO)result.getEntity();
                  if (result.getNewId() != -1) {
                    view.getFinancialProjectGrid().getStore().update(r);
                  }
 else {
                    view.getFinancialProjectGrid().getStore().add(r);
                  }
                  projectPresenter.getCurrentProjectDTO().addFunding(r);
                }
              }
);
            }
          }
);
          window.show(I18N.CONSTANTS.createProjectTypeFunding(),I18N.CONSTANTS.createProjectTypeFundingSelectDetails() + "String_Node_Str" + projectPresenter.getCurrentProjectDTO().getName()+ "String_Node_Str");
        }
      }
);
    }
  }
);
  view.getCreateFinancialProjectButton().addListener(Events.OnClick,new Listener<ButtonEvent>(){
    private final CreateProjectWindow window=new CreateProjectWindow(dispatcher,authentication,cache);
{
      window.addListener(new CreateProjectListener(){
        @Override public void projectCreated(        ProjectDTOLight project){
        }
        @Override public void projectCreatedAsFunding(        ProjectDTOLight project,        double percentage){
          final HashMap<String,Object> parameters=new HashMap<String,Object>();
          parameters.put("String_Node_Str",project.getId());
          parameters.put("String_Node_Str",projectPresenter.getCurrentProjectDTO().getId());
          parameters.put("String_Node_Str",percentage);
          dispatcher.execute(new CreateEntity("String_Node_Str",parameters),null,new AsyncCallback<CreateResult>(){
            @Override public void onFailure(            Throwable e){
              Log.error("String_Node_Str",e);
              MessageBox.alert(I18N.CONSTANTS.createProjectTypeFundingCreationError(),I18N.CONSTANTS.createProjectTypeFundingCreationDetails(),null);
            }
            @Override public void onSuccess(            CreateResult result){
              Notification.show(I18N.CONSTANTS.infoConfirmation(),I18N.CONSTANTS.createProjectTypeFundingSelectOk());
              final ProjectFundingDTO r=(ProjectFundingDTO)result.getEntity();
              view.getFinancialProjectGrid().getStore().add(r);
              projectPresenter.getCurrentProjectDTO().addFunding(r);
            }
          }
);
        }
        @Override public void projectCreatedAsFunded(        ProjectDTOLight project,        double percentage){
        }
        @Override public void projectCreatedAsTest(        ProjectDTOLight project){
        }
        @Override public void projectDeletedAsTest(        ProjectDTOLight project){
        }
      }
);
    }
    @Override public void handleEvent(    ButtonEvent be){
      window.show(Mode.FUNDING,projectPresenter.getCurrentProjectDTO().light());
    }
  }
);
  view.getAddLocalPartnerProjectButton().addListener(Events.OnClick,new Listener<ButtonEvent>(){
    final FormWindow window=new FormWindow();
    @Override public void handleEvent(    ButtonEvent be){
      final GetProjects cmd=new GetProjects();
      cmd.setViewOwnOrManage(true);
      dispatcher.execute(cmd,null,new AsyncCallback<ProjectListResult>(){
        @Override public void onFailure(        Throwable e){
          Log.error("String_Node_Str" + null + "String_Node_Str",e);
          MessageBox.alert(I18N.CONSTANTS.createProjectTypeError(),I18N.CONSTANTS.createProjectTypeErrorDetails(),null);
        }
        @Override public void onSuccess(        ProjectListResult result){
          final List<ProjectDTOLight> resultList=result.getOrderedList(ProjectListResult.CODE_COMPARATOR);
          resultList.remove(projectPresenter.getCurrentProjectDTO().light());
          if (resultList.isEmpty()) {
            MessageBox.alert(I18N.CONSTANTS.createProjectTypePartnerSelectNone(),I18N.CONSTANTS.createProjectTypePartnerSelectNoneDetails(),null);
            return;
          }
          for (          final ProjectDTOLight p : resultList) {
            p.generateCompleteName();
          }
          window.clear();
          final ComboBox<ProjectDTOLight> projects=window.addChoicesList(I18N.CONSTANTS.createProjectTypePartner(),resultList,false,"String_Node_Str");
          final LabelField modelTypeLabel=window.addLabelField(I18N.CONSTANTS.createProjectType());
          modelTypeLabel.setHeight(25);
          final NumberField amountField=window.addNumberField(I18N.MESSAGES.projectFinancesDetails(projectPresenter.getCurrentProjectDTO().getName()) + "String_Node_Str" + I18N.CONSTANTS.currencyEuro()+ ')',true);
          final LabelField percentageField=window.addLabelField(I18N.CONSTANTS.createProjectPercentage());
          percentageField.setValue("String_Node_Str");
          projects.addListener(Events.Select,new Listener<BaseEvent>(){
            @Override public void handleEvent(            BaseEvent be){
              final ProjectModelType type=projects.getSelection().get(0).getProjectModelType(authentication.getOrganizationId());
              final Grid iconGrid=new Grid(1,2);
              iconGrid.setCellPadding(0);
              iconGrid.setCellSpacing(0);
              iconGrid.setWidget(0,0,FundingIconProvider.getProjectTypeIcon(type,IconSize.MEDIUM).createImage());
              DOM.setStyleAttribute(iconGrid.getCellFormatter().getElement(0,0),"String_Node_Str","String_Node_Str");
              iconGrid.setText(0,1,ProjectModelType.getName(type));
              DOM.setStyleAttribute(iconGrid.getCellFormatter().getElement(0,1),"String_Node_Str","String_Node_Str");
              modelTypeLabel.setText(iconGrid.getElement().getString());
            }
          }
);
          amountField.addListener(Events.Change,new Listener<BaseEvent>(){
            @Override public void handleEvent(            BaseEvent be){
              if (amountField.getValue() == null) {
                amountField.setValue(0);
              }
              final List<ProjectDTOLight> selection=projects.getSelection();
              if (selection == null || selection.isEmpty()) {
                percentageField.setText(I18N.CONSTANTS.createProjectPercentageNotAvailable());
              }
 else {
                percentageField.setText(NumberUtils.ratioAsString(amountField.getValue(),selection.get(0).getPlannedBudget()));
              }
            }
          }
);
          window.addFormSubmitListener(new FormSubmitListener(){
            @Override public void formSubmitted(            Object... values){
              if (values == null || values.length < 2) {
                return;
              }
              final Object value0=values[0];
              if (!(value0 instanceof ProjectDTOLight)) {
                return;
              }
              final Object value1=values[2];
              if (!(value1 instanceof Number)) {
                return;
              }
              final ProjectDTOLight p=(ProjectDTOLight)value0;
              final HashMap<String,Object> parameters=new HashMap<String,Object>();
              parameters.put("String_Node_Str",projectPresenter.getCurrentProjectDTO().getId());
              parameters.put("String_Node_Str",p.getId());
              parameters.put("String_Node_Str",((Number)value1).doubleValue());
              dispatcher.execute(new CreateEntity("String_Node_Str",parameters),null,new AsyncCallback<CreateResult>(){
                @Override public void onFailure(                Throwable e){
                  Log.error("String_Node_Str",e);
                  MessageBox.alert(I18N.CONSTANTS.createProjectTypeFundingCreationError(),I18N.CONSTANTS.createProjectTypeFundingCreationDetails(),null);
                }
                @Override public void onSuccess(                CreateResult result){
                  Notification.show(I18N.CONSTANTS.infoConfirmation(),I18N.CONSTANTS.createProjectTypePartnerSelectOk());
                  final ProjectFundingDTO r=(ProjectFundingDTO)result.getEntity();
                  if (result.getNewId() != -1) {
                    view.getLocalPartnerProjectGrid().getStore().update(r);
                  }
 else {
                    view.getLocalPartnerProjectGrid().getStore().add(r);
                  }
                  projectPresenter.getCurrentProjectDTO().addFunded(r);
                }
              }
);
            }
          }
);
          window.show(I18N.CONSTANTS.createProjectTypePartner(),I18N.CONSTANTS.createProjectTypePartnerSelectDetails() + "String_Node_Str" + projectPresenter.getCurrentProjectDTO().getName()+ "String_Node_Str");
        }
      }
);
    }
  }
);
  view.getCreateLocalPartnerProjectButton().addListener(Events.OnClick,new Listener<ButtonEvent>(){
    private final CreateProjectWindow window=new CreateProjectWindow(dispatcher,authentication,cache);
{
      window.addListener(new CreateProjectListener(){
        @Override public void projectCreated(        ProjectDTOLight project){
        }
        @Override public void projectCreatedAsFunding(        ProjectDTOLight project,        double percentage){
        }
        @Override public void projectCreatedAsFunded(        ProjectDTOLight project,        double percentage){
          final HashMap<String,Object> parameters=new HashMap<String,Object>();
          parameters.put("String_Node_Str",projectPresenter.getCurrentProjectDTO().getId());
          parameters.put("String_Node_Str",project.getId());
          parameters.put("String_Node_Str",percentage);
          dispatcher.execute(new CreateEntity("String_Node_Str",parameters),null,new AsyncCallback<CreateResult>(){
            @Override public void onFailure(            Throwable e){
              Log.error("String_Node_Str",e);
              MessageBox.alert(I18N.CONSTANTS.createProjectTypeFundingCreationError(),I18N.CONSTANTS.createProjectTypeFundingCreationDetails(),null);
            }
            @Override public void onSuccess(            CreateResult result){
              Notification.show(I18N.CONSTANTS.infoConfirmation(),I18N.CONSTANTS.createProjectTypePartnerSelectOk());
              final ProjectFundingDTO r=(ProjectFundingDTO)result.getEntity();
              view.getLocalPartnerProjectGrid().getStore().add(r);
              projectPresenter.getCurrentProjectDTO().addFunded(r);
            }
          }
);
        }
        @Override public void projectCreatedAsTest(        ProjectDTOLight project){
        }
        @Override public void projectDeletedAsTest(        ProjectDTOLight project){
        }
      }
);
    }
    @Override public void handleEvent(    ButtonEvent be){
      window.show(Mode.FUNDED,projectPresenter.getCurrentProjectDTO().light());
    }
  }
);
}