Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions

:
#)RefundCheckPost. Copyright © 2012 tourapp.com. All rights reserved. GPL3 Open Source Software License.
  
  package com.tourapp.tour.acctrec.screen.refund;
  
  import java.util.*;
  
RefundCheckPost - Refund check posting.
 
 public class RefundCheckPost extends BaseArTrxPostScreen
 {
    
Default constructor.
 
     public RefundCheckPost()
     {
         super();
     }
    
Constructor.

Parameters:
record The main record for this screen.
itsLocation The location of this component within the parent.
parentScreen The parent screen.
fieldConverter The field this screen field is linked to.
iDisplayFieldDesc Do I display the field desc?
properties Addition properties to pass to the screen.
 
     public RefundCheckPost(Record recordScreenLocation itsLocationBasePanel parentScreenConverter fieldConverterint iDisplayFieldDescMap<String,Objectproperties)
     {
         this();
         this.init(recorditsLocationparentScreenfieldConverteriDisplayFieldDescproperties);
     }
    
Initialize class fields.
 
     public void init(Record recordScreenLocation itsLocationBasePanel parentScreenConverter fieldConverterint iDisplayFieldDescMap<String,Objectproperties)
     {
         super.init(recorditsLocationparentScreenfieldConverteriDisplayFieldDescproperties);
     }
    
Get the screen display title.
 
     public String getTitle()
     {
         return "Refund check posting";
     }
    
Override this to open the main file.

You should pass this record owner to the new main file (ie., new MyNewTable(thisRecordOwner)).

Returns:
The new record.
 
     public Record openMainRecord()
     {
         return new ArTrx(this);
     }
    
Override this to open the other files in the query.
 
     public void openOtherRecords()
     {
         super.openOtherRecords();
         new BankTrx(this);
         new BankAcct(this);
         
         new TrxStatus(this);
         
         new ArControl(this);
         new Booking(this);
     }
    
Add the screen fields. Override this to create (and return) the screen record for this recordowner.

Returns:
The screen record.
    public Record addScreenRecord()
    {
        return new RefundScreenRecord(this);
    }
    
Add all the screen listeners.
    public void addListeners()
    {
        super.addListeners();
        
        TrxStatus recTrxStatus = (TrxStatus)this.getRecord(.);
        this.getMainRecord().addListener(new SubFileFilter(recTrxStatus.getField(.), .nullnullnullnull));
    }
    
Set up all the screen fields.
    public void setupSFields()
    {
    }
    
Process the command.
Step 1 - Process the command if possible and return true if processed.
Step 2 - If I can't process, pass to all children (with me as the source).
Step 3 - If children didn't process, pass to parent (with me as the source).
Note: Never pass to a parent or child that matches the source (to avoid an endless loop).

Parameters:
strCommand The command to process.
sourceSField The source screen field (to avoid echos).
iCommandOptions If this command creates a new screen, create in a new window?
Returns:
true if success.
    public boolean doCommand(String strCommandScreenField sourceSFieldint iCommandOptions)
    {
        if (strCommand.equalsIgnoreCase(.))
            return this.onPost();
        else
            return super.doCommand(strCommandsourceSFieldiCommandOptions);
    }
    
Post all the transactions in this batch.

Returns:
true if successful.
    public boolean onPost()
    {
        try   {
            TrxStatus recTrxStatus = (TrxStatus)this.getRecord(.);
            Object bookmark = recTrxStatus.getHandle(.);
            int iTrxPaidClassID = recTrxStatus.getTrxStatusID(...);
            recTrxStatus.setHandle(bookmark.);
            Record recArTrx = this.getMainRecord();
            recArTrx.close();
            while (recArTrx.hasNext())
            {
                recArTrx.next();
                recArTrx.edit();
                recArTrx.getField(.).setValue(iTrxPaidClassID);
                recArTrx.set();
            }
        } catch (DBException ex)    {
            ex.printStackTrace();
        }
        return true;
    }
New to GrepCode? Check out our FAQ X