Example #1
0
  /**
   * Descripción de Método
   *
   * @param e
   * @throws PropertyVetoException
   */
  public void vetoableChange(PropertyChangeEvent e) throws PropertyVetoException {
    log.config(
        "En vetoableChange("
            + m_mTab.toString()
            + ") "
            + e.getPropertyName()
            + "="
            + e.getNewValue()
            + " ("
            + e.getOldValue()
            + ") "
            + ((e.getOldValue() == null) ? "" : e.getOldValue().getClass().getName()));

    // Save Confirmation dialog    MTable-RowSave

    if (e.getPropertyName().equals(MTable.PROPERTY)) {

      // throw new PropertyVetoException calls this method (??) again

      if (m_vetoActive) {
        m_vetoActive = false;

        return;
      }

      if (!Env.isAutoCommit(Env.getCtx(), m_WindowNo) || (m_mTab.getCommitWarning().length() > 0)) {
        if (!ADialog.ask(m_WindowNo, this, "SaveChanges?", m_mTab.getCommitWarning())) {
          m_vetoActive = true;

          throw new PropertyVetoException("UserDeniedSave", e);
        }
      }

      return;
    } // saveConfirmation

    // Get Row/Col Info

    MTable mTable = m_mTab.getTableModel();
    int row = m_mTab.getCurrentRow();
    int col = mTable.findColumn(e.getPropertyName());

    //

    // Modificado por Disytel - Franco Bonafine
    // Cuando un editor devuelve null, la ejecución entra por esta rama del if
    // haciendo que no se guarde el valor null en el MTable. Esto produce que
    // al asignar un null a un editor, y luego guardar los cambios (desde una ventana)
    // el APanel dispare el mensaje "No Guardado", dado que no se detectan
    // modificaciones en la fila.
    // Por esto, por mas que el valor sea null, se debe guardar el valor en la MTable.

    // ****************
    // Codigo Original
    // if((e.getNewValue() == null) && (e.getOldValue() != null) &&
    // (e.getOldValue().toString().length() > 0) ) {    // some editors return "" instead of null
    //  mTable.setChanged( true );
    // } else {
    // *****************

    // mTable.setValueAt (e.getNewValue(), row, col, true);

    mTable.setValueAt(e.getNewValue(), row, col); // -> dataStatusChanged -> dynamicDisplay

    // Force Callout

    if (e.getPropertyName().equals("S_ResourceAssignment_ID")) {
      MField mField = m_mTab.getField(col);

      if ((mField != null) /*&& (mField.getCallout().length() > 0)*/) {
        m_mTab.processFieldChange(mField); // Dependencies & Callout
      }
    }
    // }

    // log.config( "GridController.vetoableChange (" + m_mTab.toString() + ") - fini",
    // e.getPropertyName() + "=" + e.getNewValue());

  } // vetoableChange