コード例 #1
0
  /**
   * Method invoked when the user has clicked on save button and the grid is in INSERT mode.
   *
   * @param rowNumbers row indexes related to the new rows to save
   * @param newValueObjects list of new value objects to save
   * @return an ErrorResponse value object in case of errors, VOListResponse if the operation is
   *     successfully completed
   */
  public Response insertRecords(int[] rowNumbers, ArrayList newValueObjects) throws Exception {
    ItemDiscountVO vo = null;
    Response response = null;
    DetailItemVO itemVO = (DetailItemVO) frame.getFormPanel().getVOModel().getValueObject();

    for (int i = 0; i < newValueObjects.size(); i++) {
      vo = (ItemDiscountVO) newValueObjects.get(i);
      response = validateDiscount(vo);
      if (response.isError()) return response;

      vo.setCompanyCodeSys01SAL03(itemVO.getCompanyCodeSys01ITM01());
      vo.setItemCodeItm01SAL04(itemVO.getItemCodeITM01());
    }

    response = ClientUtils.getData("insertItemDiscounts", newValueObjects);
    return response;
  }
コード例 #2
0
  /**
   * Callback method invoked when the user has clicked on the insert button
   *
   * @param valueObject empty value object just created: the user can manage it to fill some
   *     attribute values
   */
  public void createValueObject(ValueObject valueObject) throws Exception {
    ItemDiscountVO vo = (ItemDiscountVO) valueObject;
    vo.setMinQtySAL03(new BigDecimal(1));
    vo.setMultipleQtySAL03(Boolean.FALSE);

    DetailItemVO itemVO = (DetailItemVO) frame.getFormPanel().getVOModel().getValueObject();
    itemVO.setCompanyCodeSys01ITM01(itemVO.getCompanyCodeSys01());
    Response res = ClientUtils.getData("loadCompany", itemVO.getCompanyCodeSys01());
    if (!res.isError()) {
      OrganizationVO compVO = (OrganizationVO) ((VOResponse) res).getVo();
      if (compVO.getCurrencyCodeReg03() != null && !compVO.getCurrencyCodeReg03().equals("")) {
        vo.setCurrencyCodeReg03SAL03(compVO.getCurrencyCodeReg03());
        frame
            .getColCurrencyCode()
            .forceValidate(
                frame.getDiscountsGrid().getSelectedRow() == -1
                    ? 0
                    : frame.getDiscountsGrid().getSelectedRow());
      }
    }
  }