Beispiel #1
0
  public void setData(String[] data) {
    final int baseName = 12;
    final int basePrice = baseName + Constants.NO_OF_EXTRAS_IN_UI;
    final int basePriceValue = basePrice + Constants.NO_OF_EXTRAS_IN_UI;
    tbKeyId.setText(data[0]);
    String imageKey = data[1];
    if (imageKey != null) {
      imgItem.setUrl(GWT.getHostPageBaseURL() + "serveBlob?id=" + data[1]);
      imgItem.setVisible(true);
    }
    tbName.setText(data[2]);
    taDescription.setText(data[3]);
    editingExistingData = true;
    if (data[4] != null) {
      rbSinglePrice.setValue(true);
      rbSinglePrice.setFormValue("single");
      dbSinglePrice.setValue(Double.parseDouble(data[basePriceValue]));
    } else {
      rbMultiplePrice.setValue(true);
      rbMultiplePrice.setFormValue("multiple");
      if (data[5] != null) {
        cbSmall.setValue(true);
        dbSmallPrice.setValue(Double.parseDouble(data[basePriceValue + 1]));
      }
      if (data[6] != null) {
        cbMedium.setValue(true);
        dbMediumPrice.setValue(Double.parseDouble(data[basePriceValue + 2]));
      }
      if (data[7] != null) {
        cbLarge.setValue(true);
        dbLargePrice.setValue(Double.parseDouble(data[basePriceValue + 3]));
      }
      if (data[8] != null) {
        cbTapa.setValue(true);
        dbTapaPrice.setValue(Double.parseDouble(data[basePriceValue + 4]));
      }
      if (data[9] != null) {
        cbHalf.setValue(true);
        dbHalfPrice.setValue(Double.parseDouble(data[basePriceValue + 5]));
      }
      if (data[10] != null) {
        cbFull.setValue(true);
        dbFullPrice.setValue(Double.parseDouble(data[basePriceValue + 6]));
      }
    }
    if (data[11] != null) {
      tbExtrasName.setText(data[11]);
    }

    for (int i = 0; i < Constants.NO_OF_EXTRAS_IN_UI; i++) {
      String name = data[baseName + i];
      if (name != null) {
        tbExtras[i].setText(name);
        tbExtrasPrices[i].setText(data[basePrice + i]);
      }
    }
  }