private void reloadSettings() {

    String sql = "Select * from experiment where id = " + expId;

    // Initialize the service remote procedure call
    if (databaseAccessSvc == null) {
      databaseAccessSvc = GWT.create(DatabaseAccess.class);
    }

    AsyncCallback<String[][]> callback =
        new AsyncCallback<String[][]>() {
          public void onFailure(Throwable caught) {}

          public void onSuccess(String[][] result) {
            // update settings
            ssLang = result[0][8];
            mtSrc = result[0][9];
            mtTrg = result[0][10];
            mtoSrc = result[0][11];
            mtoTrg = result[0][12];
            asrLang = result[0][13];
            reloadLTCs();
          }
        };

    databaseAccessSvc.retrieveData(sql, callback);
  }
  private void getSettings() {
    String sql = "Select * from experiment where id = " + expId;

    // Initialize the service remote procedure call
    if (databaseAccessSvc == null) {
      databaseAccessSvc = GWT.create(DatabaseAccess.class);
    }

    AsyncCallback<String[][]> callback =
        new AsyncCallback<String[][]>() {
          public void onFailure(Throwable caught) {}

          public void onSuccess(String[][] result) {

            // SRC Lang
            for (int i = 0; i < srcLangList.getItemCount(); i++) {
              if (result[0][11].equals(srcLangList.getItemText(i))) {
                srcLangList.setItemSelected(i, true);
                break;
              }
            }

            // TRG Lang
            for (int i = 0; i < trgLangList.getItemCount(); i++) {
              if (result[0][12].equals(trgLangList.getItemText(i))) {
                trgLangList.setItemSelected(i, true);
                break;
              }
            }
          }
        };

    databaseAccessSvc.retrieveData(sql, callback);
  }
  // reload LTCs
  private void reloadLTCs() {
    String sql =
        "Select * from experimentcomponent where experimentid = " + expId + " order by rank asc";

    // Initialize the service remote procedure call
    if (databaseAccessSvc == null) {
      databaseAccessSvc = GWT.create(DatabaseAccess.class);
    }

    AsyncCallback<String[][]> callback =
        new AsyncCallback<String[][]>() {
          public void onFailure(Throwable caught) {}

          public void onSuccess(String[][] result) {

            if (result != null) {
              components = null;
              components = new int[result.length][3];
              for (int i = 0; i < result.length; i++) {
                // add components to local array
                components[i][0] = Integer.parseInt(result[i][2]);
                components[i][1] = Integer.parseInt(result[i][3]);
                components[i][2] = Integer.parseInt(result[i][4]);
              }

              clearComponents();

            } else {
              // System.out.println("No components defined for this experiment!");
            }
          }
        };

    databaseAccessSvc.retrieveData(sql, callback);
  }
  private void changeComponent(final int comp) {
    String sql = "Update experimentcomponent set component = " + comp + " where id = " + compID;

    // Initialize the service remote procedure call
    if (databaseAccessSvc == null) {
      databaseAccessSvc = GWT.create(DatabaseAccess.class);
    }

    AsyncCallback<String> callback =
        new AsyncCallback<String>() {
          public void onFailure(Throwable caught) {}

          public void onSuccess(String result) {

            if (comp > 0) {
              WebWOZWizard.changeVisiblility(6);
            } else {
              WebWOZWizard.changeVisiblility(7);
            }
            reloadSettings();

            checkVisibility();
          }
        };

    databaseAccessSvc.storeData(sql, callback);
  }
  private void changeLang(int type) {

    String sql = "";

    switch (type) {
      case 1:
        sql =
            "Update experiment set mtoutsrc = '"
                + srcLangList.getValue(srcLangList.getSelectedIndex())
                + "' where id = "
                + expId;
        mtoSrc = srcLangList.getValue(srcLangList.getSelectedIndex());
        break;
      case 2:
        sql =
            "Update experiment set mtouttrg = '"
                + trgLangList.getValue(trgLangList.getSelectedIndex())
                + "' where id = "
                + expId;
        mtoTrg = trgLangList.getValue(trgLangList.getSelectedIndex());
        break;

      default:
        break;
    }

    // Initialize the service remote procedure call
    if (databaseAccessSvc == null) {
      databaseAccessSvc = GWT.create(DatabaseAccess.class);
    }

    AsyncCallback<String> callback =
        new AsyncCallback<String>() {
          public void onFailure(Throwable caught) {}

          public void onSuccess(String result) {
            reloadSettings();
          }
        };

    databaseAccessSvc.storeData(sql, callback);
  }
  public void turnOffComponent() {
    String sql =
        "Update experimentcomponent set component = 0 and componentmode = 0 where id = " + compID;

    // Initialize the service remote procedure call
    if (databaseAccessSvc == null) {
      databaseAccessSvc = GWT.create(DatabaseAccess.class);
    }

    AsyncCallback<String> callback =
        new AsyncCallback<String>() {
          public void onFailure(Throwable caught) {}

          public void onSuccess(String result) {
            reloadLTCs();
            compList.setItemSelected(0, true);
            checkVisibility();
          }
        };

    databaseAccessSvc.storeData(sql, callback);
  }