/**
   * * Enregistrer les paramètres liés à chaque Element (titre) Params: Les positions de l'elements
   * (X,Y) et son emplacement dans la liste des elements
   *
   * @param last **
   */
  @SuppressWarnings("rawtypes")
  private void ajouterParametre(int emplacement, String name, String option) {

    ArrayList params = (ArrayList) parametres.get(emplacement);
    int k = 0;
    for (int i = 0; i < params.size(); i++) {

      final ArrayList p = (ArrayList) params.get(i);

      /** ****** */
      JSONObject paramAsJSONObjectBis =
          BuildJsonObject.buildJSONObjectParametreBis(
              "-1", "" + p.get(0), "" + p.get(1), "" + emplacement);
      /** ****** */
      formAsJSONObjectBis.put("parametre" + emplacement + i, paramAsJSONObjectBis);
      k = i + 1;
    }
    if (((ArrayList) elements.get(emplacement)).get(0).equals("checkbox")
        || ((ArrayList) elements.get(emplacement)).get(0).equals("radio")) {
      JSONObject paramAsJSONObjectBis =
          BuildJsonObject.buildJSONObjectParametreBis(
              "-1", "libelles", "" + choices.get(Integer.parseInt(name)), "" + emplacement);
      formAsJSONObjectBis.put("parametre" + emplacement + k, paramAsJSONObjectBis);

    } else if (((ArrayList) elements.get(emplacement)).get(0).equals("combobox")) {
      JSONObject paramAsJSONObjectBis =
          BuildJsonObject.buildJSONObjectParametreBis(
              "-1", "libelles", "" + options.get(Integer.parseInt(option)), "" + emplacement);
      formAsJSONObjectBis.put("parametre" + emplacement + k, paramAsJSONObjectBis);
    }

    /** ********* */
  }
  @SuppressWarnings("rawtypes")
  public void ajoutFormulaireDirect() {
    for (int i = 0; i < elements.size(); i++) {
      JSONObject elementAsJSONObject =
          BuildJsonObject.buildJSONObjectElementBis(
              "" + i,
              ((ArrayList) elements.get(i)).get(0).toString(),
              ((ArrayList) elements.get(i)).get(1).toString(),
              ((ArrayList) elements.get(i)).get(2).toString());
      formAsJSONObjectBis.put("element" + i, elementAsJSONObject);

      ajouterParametre(
          i,
          ((ArrayList) elements.get(i)).get(3).toString(),
          ((ArrayList) elements.get(i)).get(4).toString());
    }

    FormulaireController.allouerFormulaireBis(dualListBox, formAsJSONObjectBis);
    try {
      RequestBuilder builder =
          new RequestBuilder(RequestBuilder.PUT, FORMULAIRE_URL + "updateForm");
      builder.setHeader("Content-Type", "application/json");
      builder.sendRequest(
          formAsJSONObjectBis.toString(),
          new RequestCallback() {
            public void onError(Request request, Throwable exception) {
              Window.alert("Erreur d'ajout");
            }

            public void onResponseReceived(Request request, Response response) {
              RootPanel.get("button_Enregistrer").remove(enregistrer);
              Window.alert("Formulaire: Ajout avec succès");
              Window.Location.reload();
            }
          });
    } catch (RequestException e) {
      System.out.println("RequestException");
    }
  }