Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions

:
#)SyncArTrxStatusHandler. Copyright © 2012 tourapp.com. All rights reserved. GPL3 Open Source Software License.
  
  package com.tourapp.tour.acctrec.screen.mco;
  
  import java.util.*;
  
SyncArTrxStatusHandler - Synchronize the A/R Trx file with this BaseArPay record..
 
 public class SyncArTrxStatusHandler extends FileListener
 {
     protected BaseField m_fldTrxStatusID = null;
     protected ArTrx m_recArTrx = null;
    
Default constructor.
 
     public SyncArTrxStatusHandler()
     {
         super();
     }
    
SyncArTrxStatusHandler Method.
 
     public SyncArTrxStatusHandler(Record record)
     {
         this();
         this.init(record);
     }
    
Initialize class fields.
 
     public void init(Record record)
     {
          = null;
          = null;
         super.init(record);
     }
    
Free Method.
 
     public void free()
     {
         if ( != null)
             .free();
          = null;
         if ( != null)
             .free();
          = null;
         super.free();
     }
    
Called when a valid record is read from the table/query.

Parameters:
bDisplayOption If true, display any changes.
 
     public void doValidRecord(boolean bDisplayOption)
     {
         Record recBaseArTrx = this.getOwner();
         if ( == null)
         {
             try {
                  = (BaseField)recBaseArTrx.getField(.).clone();
             } catch (CloneNotSupportedException ex) {
                 ex.printStackTrace();
             }
         }
         // Save the (previous) status, so you can change the status if updated.
         super.doValidRecord(bDisplayOption);
     }
    
Called when a change is the record status is about to happen/has happened.

Parameters:
field If this file change is due to a field, this is the field.
iChangeType The type of change that occurred.
bDisplayOption If true, display any changes.
Returns:
an error code. ADD_TYPE - Before a write. UPDATE_TYPE - Before an update. DELETE_TYPE - Before a delete. AFTER_UPDATE_TYPE - After a write or update. LOCK_TYPE - Before a lock. SELECT_TYPE - After a select. DESELECT_TYPE - After a deselect. MOVE_NEXT_TYPE - After a move. AFTER_REQUERY_TYPE - Record opened. SELECT_EOF_TYPE - EOF Hit.
    public int doRecordChange(FieldInfo fieldint iChangeTypeboolean bDisplayOption)
    {
        if (iChangeType == .)
        {
             if ( == null)
            {
                RecordOwner recordOwner = this.getOwner().findRecordOwner();
                 = new ArTrx(recordOwner);
                if (recordOwner != null)
                    recordOwner.removeRecord();
            }
            Record recBaseArTrx = this.getOwner();
            if (.getListener(SubFileFilter.class.getName()) == null)
            {
                .setKeyArea(.);
                .addListener(new SubFileFilter(.recBaseArTrx.getField(.), .nullnull));
            }
            try {
                .close();
                while (.hasNext())
                {
                    .next();
                    .edit();
                    .getField(.).moveFieldToThis(recBaseArTrx.getField(.));
                    .set();
                }
            } catch (DBException ex)    {
                ex.printStackTrace();
            }
        }
        return super.doRecordChange(fieldiChangeTypebDisplayOption);
    }
New to GrepCode? Check out our FAQ X