Пример #1
0
  /**
   * Callback method invoked each time a cell is edited: this method define if the new value if
   * valid. This method is invoked ONLY if: - the edited value is not equals to the old value OR it
   * has exmplicitely called setCellAt or setValueAt - the cell is editable Default behaviour: cell
   * value is valid.
   *
   * @param rowNumber selected row index
   * @param attributeName attribute name related to the column currently selected
   * @param oldValue old cell value (before cell editing)
   * @param newValue new cell value (just edited)
   * @return <code>true</code> if cell value is valid, <code>false</code> otherwise
   */
  public boolean validateCell(
      int rowNumber, String attributeName, Object oldValue, Object newValue) {
    VatVO vo = (VatVO) gridFrame.getGrid().getVOListTableModel().getObjectForRow(rowNumber);
    if (attributeName.equals("valueREG01")
        && newValue != null
        && newValue.equals(new BigDecimal(0))) vo.setDeductibleREG01(new BigDecimal(100));
    if ("valueREG01".equals(attributeName)
        && newValue != null
        && ((BigDecimal) newValue).doubleValue() > 100) return false;
    if ("deductibleREG01".equals(attributeName)
        && newValue != null
        && ((BigDecimal) newValue).doubleValue() > 100) return false;

    return true;
  }
Пример #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 {
   VatVO vo = (VatVO) valueObject;
   vo.setValueREG01(new BigDecimal(0));
   vo.setDeductibleREG01(new BigDecimal(0));
 }