/** * Constructor (calculates the difference between field1 and field2). * @param fldTargetValue The destination field. * @param fldValue1 Source field 1. * @param fldValue2 Source field 2. */ public CalcBalanceHandler(BaseField fldTargetValue, BaseField fldValue1, BaseField fldValue2) { this(); this.init(fldTargetValue, fldValue1, fldValue2, null, false); } /**
/** * Initialize class fields. * @param fldTargetValue The destination field. * @param fldValue1 Source field 1. * @param fldValue2 Source field 2. * @param strOperator The arithmetic operator to use to calculate the destination field. * @param bUseAbsoluteValue Use the absolute value of the two values. */ public void init(BaseField fldTargetValue, BaseField fldValue1, BaseField fldValue2, String strOperator, boolean bUseAbsoluteValue) { m_fldValue1 = fldValue1; m_fldValue2 = fldValue2; m_bUseAbsoluteValue = bUseAbsoluteValue; m_strOperator = strOperator; super.init(null, -1, fldTargetValue); this.setRespondsToMode(DBConstants.READ_MOVE, false); this.setRespondsToMode(DBConstants.INIT_MOVE, true); } /**
/** * AddMasterListeners Method. */ public void addMasterListeners() { super.addMasterListeners(); this.getField(Inventory.BLOCKED).addListener(new CalcBalanceHandler(this.getField(Inventory.AVAILABLE), this.getField(Inventory.BLOCKED), this.getField(Inventory.USED), CalcBalanceHandler.MINUS, false)); this.getField(Inventory.USED).addListener(new CalcBalanceHandler(this.getField(Inventory.AVAILABLE), this.getField(Inventory.BLOCKED), this.getField(Inventory.USED), CalcBalanceHandler.MINUS, false)); } /**
/** * Set the field that owns this listener. * @owner The field that this listener is being added to (if null, this listener is being removed). */ public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (owner != null) { if (m_fldValue1 != null) if (m_fldValue1.getRecord() != this.getOwner().getRecord()) m_fldValue1.addListener(new FieldRemoveBOnCloseHandler(this)); // Not same file, if target file closes, remove this listener! if (m_fldValue2 != null) if (m_fldValue2.getRecord() != this.getOwner().getRecord()) if (m_fldValue2.getRecord() != m_fldValue1.getRecord()) m_fldValue2.addListener(new FieldRemoveBOnCloseHandler(this)); // Not same file, if target file closes, remove this listener! } } /**
/** * AddMasterListeners Method. */ public void addMasterListeners() { super.addMasterListeners(); this.getField(Inventory.BLOCKED).addListener(new CalcBalanceHandler(this.getField(Inventory.AVAILABLE), this.getField(Inventory.BLOCKED), this.getField(Inventory.USED), CalcBalanceHandler.MINUS, false)); this.getField(Inventory.USED).addListener(new CalcBalanceHandler(this.getField(Inventory.AVAILABLE), this.getField(Inventory.BLOCKED), this.getField(Inventory.USED), CalcBalanceHandler.MINUS, false)); } /**
/** * Set the field that owns this listener. * @owner The field that this listener is being added to (if null, this listener is being removed). */ public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (owner != null) { if (m_fldValue1 != null) if (m_fldValue1.getRecord() != this.getOwner().getRecord()) m_fldValue1.addListener(new FieldRemoveBOnCloseHandler(this)); // Not same file, if target file closes, remove this listener! if (m_fldValue2 != null) if (m_fldValue2.getRecord() != this.getOwner().getRecord()) if (m_fldValue2.getRecord() != m_fldValue1.getRecord()) m_fldValue2.addListener(new FieldRemoveBOnCloseHandler(this)); // Not same file, if target file closes, remove this listener! } } /**
/** * AddMasterListeners Method. */ public void addMasterListeners() { super.addMasterListeners(); this.getField(CreditCard.GROSS).addListener(new CalcBalanceHandler(this.getField(CreditCard.SVC_AMT), this.getField(CreditCard.GROSS), this.getField(CreditCard.SVC_PER), "*", false)); this.getField(CreditCard.SVC_PER).addListener(new CalcBalanceHandler(this.getField(CreditCard.SVC_AMT), this.getField(CreditCard.GROSS), this.getField(CreditCard.SVC_PER), "*", false)); this.getField(CreditCard.GROSS).addListener(new CalcBalanceHandler(this.getField(CreditCard.NET), this.getField(CreditCard.GROSS), this.getField(CreditCard.SVC_AMT), "-", false)); this.getField(CreditCard.SVC_AMT).addListener(new CalcBalanceHandler(this.getField(CreditCard.NET), this.getField(CreditCard.GROSS), this.getField(CreditCard.SVC_AMT), "-", false)); this.getField(CreditCard.NET).addListener(new MoveOnChangeHandler(this.getField(CreditCard.AMT_APPLY), this.getField(CreditCard.NET))); }
/** * Constructor (calculates the difference between field1 and field2). * @param fldTargetValue The destination field. * @param fldValue1 Source field 1. * @param fldValue2 Source field 2. */ public CalcBalanceHandler(BaseField fldTargetValue, BaseField fldValue1, BaseField fldValue2) { this(); this.init(fldTargetValue, fldValue1, fldValue2, null, false); } /**
/** * Initialize class fields. * @param fldTargetValue The destination field. * @param fldValue1 Source field 1. * @param fldValue2 Source field 2. * @param strOperator The arithmetic operator to use to calculate the destination field. * @param bUseAbsoluteValue Use the absolute value of the two values. */ public void init(BaseField fldTargetValue, BaseField fldValue1, BaseField fldValue2, String strOperator, boolean bUseAbsoluteValue) { m_fldValue1 = fldValue1; m_fldValue2 = fldValue2; m_bUseAbsoluteValue = bUseAbsoluteValue; m_strOperator = strOperator; super.init(null, null, fldTargetValue); this.setRespondsToMode(DBConstants.READ_MOVE, false); this.setRespondsToMode(DBConstants.INIT_MOVE, true); } /**
/** * Set the field that owns this listener. * @owner The field that this listener is being added to (if null, this listener is being removed). */ public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (owner != null) { if (m_fldValue1 != null) if (m_fldValue1.getRecord() != this.getOwner().getRecord()) m_fldValue1.addListener(new FieldRemoveBOnCloseHandler(this)); // Not same file, if target file closes, remove this listener! if (m_fldValue2 != null) if (m_fldValue2.getRecord() != this.getOwner().getRecord()) if (m_fldValue2.getRecord() != m_fldValue1.getRecord()) m_fldValue2.addListener(new FieldRemoveBOnCloseHandler(this)); // Not same file, if target file closes, remove this listener! } } /**
/** * AddMasterListeners Method. */ public void addMasterListeners() { super.addMasterListeners(); this.getField(CreditCard.GROSS).addListener(new CalcBalanceHandler(this.getField(CreditCard.SVC_AMT), this.getField(CreditCard.GROSS), this.getField(CreditCard.SVC_PER), "*", false)); this.getField(CreditCard.SVC_PER).addListener(new CalcBalanceHandler(this.getField(CreditCard.SVC_AMT), this.getField(CreditCard.GROSS), this.getField(CreditCard.SVC_PER), "*", false)); this.getField(CreditCard.GROSS).addListener(new CalcBalanceHandler(this.getField(CreditCard.NET), this.getField(CreditCard.GROSS), this.getField(CreditCard.SVC_AMT), "-", false)); this.getField(CreditCard.SVC_AMT).addListener(new CalcBalanceHandler(this.getField(CreditCard.NET), this.getField(CreditCard.GROSS), this.getField(CreditCard.SVC_AMT), "-", false)); this.getField(CreditCard.NET).addListener(new MoveOnChangeHandler(this.getField(CreditCard.AMT_APPLY), this.getField(CreditCard.NET))); }
/** * Constructor (calculates the difference between field1 and field2). * @param fldTargetValue The destination field. * @param fldValue1 Source field 1. * @param fldValue2 Source field 2. */ public CalcBalanceHandler(BaseField fldTargetValue, BaseField fldValue1, BaseField fldValue2) { this(); this.init(fldTargetValue, fldValue1, fldValue2, null, false); } /**
/** * Initialize class fields. * @param fldTargetValue The destination field. * @param fldValue1 Source field 1. * @param fldValue2 Source field 2. * @param strOperator The arithmetic operator to use to calculate the destination field. * @param bUseAbsoluteValue Use the absolute value of the two values. */ public void init(BaseField fldTargetValue, BaseField fldValue1, BaseField fldValue2, String strOperator, boolean bUseAbsoluteValue) { m_fldValue1 = fldValue1; m_fldValue2 = fldValue2; m_bUseAbsoluteValue = bUseAbsoluteValue; m_strOperator = strOperator; super.init(null, -1, fldTargetValue); this.setRespondsToMode(DBConstants.READ_MOVE, false); this.setRespondsToMode(DBConstants.INIT_MOVE, true); } /**
/** * Add all the screen listeners. */ public void addListeners() { super.addListeners(); BookingLand recBookingLand = (BookingLand)this.getMainRecord(); recBookingLand.getField(BookingLand.PMC_CUTOFF).setEnabled(true); // Display the USD equivalents BaseField fldExchange = recBookingLand.getField(BookingDetail.EXCHANGE); Record recBookingLandScreenRecord = this.getScreenRecord(); FieldListener fieldListener = null; recBookingLand.getField(BookingLand.PMC_COST).addListener(fieldListener = new CalcBalanceHandler(recBookingLandScreenRecord.getField(BookingLandScreenRecord.PMC_COST_LOCAL), recBookingLand.getField(BookingLand.PMC_COST), fldExchange, CalcBalanceHandler.MULTIPLY, false)); fieldListener.setRespondsToMode(DBConstants.READ_MOVE, true); recBookingLand.getField(BookingLand.SIC_COST).addListener(fieldListener = new CalcBalanceHandler(recBookingLandScreenRecord.getField(BookingLandScreenRecord.SIC_COST_LOCAL), recBookingLand.getField(BookingLand.SIC_COST), fldExchange, CalcBalanceHandler.MULTIPLY, false)); fieldListener.setRespondsToMode(DBConstants.READ_MOVE, true); recBookingLand.getField(BookingLand.PP_COST).addListener(fieldListener = new CalcBalanceHandler(recBookingLandScreenRecord.getField(BookingLandScreenRecord.PP_COST_LOCAL), recBookingLand.getField(BookingLand.PP_COST), fldExchange, CalcBalanceHandler.MULTIPLY, false)); fieldListener.setRespondsToMode(DBConstants.READ_MOVE, true); } /**
/** * Constructor (calculates the absolute value of the difference between field1 and field2). * @param fldTargetValue The destination field. * @param fldValue1 Source field 1. * @param fldValue2 Source field 2. * @param bUseAbsoluteValue Use the absolute value of the two values. */ public CalcBalanceHandler(BaseField fldTargetValue, BaseField fldValue1, BaseField fldValue2, boolean bUseAbsoluteValue) { this(); this.init(fldTargetValue, fldValue1, fldValue2, null, bUseAbsoluteValue); } /**
/** * AddMasterListeners Method. */ public void addMasterListeners() { super.addMasterListeners(); this.getField(Mco.GROSS).addListener(new CalcBalanceHandler(this.getField(Mco.COMM_AMT), this.getField(Mco.GROSS), this.getField(Mco.COMM_PER), "*", false)); this.getField(Mco.COMM_PER).addListener(new CalcBalanceHandler(this.getField(Mco.COMM_AMT), this.getField(Mco.GROSS), this.getField(Mco.COMM_PER), "*", false)); this.getField(Mco.GROSS).addListener(new CalcBalanceHandler(this.getField(Mco.SVC_AMT), this.getField(Mco.GROSS), this.getField(Mco.SVC_PER), "*", false)); this.getField(Mco.SVC_PER).addListener(new CalcBalanceHandler(this.getField(Mco.SVC_AMT), this.getField(Mco.GROSS), this.getField(Mco.SVC_PER), "*", false)); this.getField(Mco.GROSS).addListener(new CalcBalanceHandler(this.getField(Mco.TAX_AMT), this.getField(Mco.GROSS), this.getField(Mco.TAX_PER), "*", false)); this.getField(Mco.TAX_PER).addListener(new CalcBalanceHandler(this.getField(Mco.TAX_AMT), this.getField(Mco.GROSS), this.getField(Mco.TAX_PER), "*", false)); this.getField(Mco.GROSS).addListener(new CalcMcoHandler(null)); this.getField(Mco.COMM_AMT).addListener(new CalcMcoHandler(null)); this.getField(Mco.SVC_AMT).addListener(new CalcMcoHandler(null)); this.getField(Mco.TAX_AMT).addListener(new CalcMcoHandler(null)); this.getField(Mco.NET).addListener(new MoveOnChangeHandler(this.getField(Mco.AMT_APPLY), this.getField(Mco.NET))); }
/** * Constructor (calculates the arithmetic operation between field1 and field2). * @param fldTargetValue The destination field. * @param fldValue1 Source field 1. * @param fldValue2 Source field 2. * @param strOperator The arithmetic operator to use to calculate the destination field. * @param bUseAbsoluteValue Use the absolute value of the two values. */ public CalcBalanceHandler(BaseField fldTargetValue, BaseField fldValue1, BaseField fldValue2, String strOperator, boolean bUseAbsoluteValue) { this(); this.init(fldTargetValue, fldValue1, fldValue2, strOperator, bUseAbsoluteValue); } /**
/** * AddMasterListeners Method. */ public void addMasterListeners() { super.addMasterListeners(); this.getField(Mco.GROSS).addListener(new CalcBalanceHandler(this.getField(Mco.COMM_AMT), this.getField(Mco.GROSS), this.getField(Mco.COMM_PER), "*", false)); this.getField(Mco.COMM_PER).addListener(new CalcBalanceHandler(this.getField(Mco.COMM_AMT), this.getField(Mco.GROSS), this.getField(Mco.COMM_PER), "*", false)); this.getField(Mco.GROSS).addListener(new CalcBalanceHandler(this.getField(Mco.SVC_AMT), this.getField(Mco.GROSS), this.getField(Mco.SVC_PER), "*", false)); this.getField(Mco.SVC_PER).addListener(new CalcBalanceHandler(this.getField(Mco.SVC_AMT), this.getField(Mco.GROSS), this.getField(Mco.SVC_PER), "*", false)); this.getField(Mco.GROSS).addListener(new CalcBalanceHandler(this.getField(Mco.TAX_AMT), this.getField(Mco.GROSS), this.getField(Mco.TAX_PER), "*", false)); this.getField(Mco.TAX_PER).addListener(new CalcBalanceHandler(this.getField(Mco.TAX_AMT), this.getField(Mco.GROSS), this.getField(Mco.TAX_PER), "*", false)); this.getField(Mco.GROSS).addListener(new CalcMcoHandler(null)); this.getField(Mco.COMM_AMT).addListener(new CalcMcoHandler(null)); this.getField(Mco.SVC_AMT).addListener(new CalcMcoHandler(null)); this.getField(Mco.TAX_AMT).addListener(new CalcMcoHandler(null)); this.getField(Mco.NET).addListener(new MoveOnChangeHandler(this.getField(Mco.AMT_APPLY), this.getField(Mco.NET))); }
/** * Constructor (calculates the absolute value of the difference between field1 and field2). * @param fldTargetValue The destination field. * @param fldValue1 Source field 1. * @param fldValue2 Source field 2. * @param bUseAbsoluteValue Use the absolute value of the two values. */ public CalcBalanceHandler(BaseField fldTargetValue, BaseField fldValue1, BaseField fldValue2, boolean bUseAbsoluteValue) { this(); this.init(fldTargetValue, fldValue1, fldValue2, null, bUseAbsoluteValue); } /**
/** * Add all the screen listeners. */ public void addListeners() { super.addListeners(); this.getRecord(Mco.MCO_FILE).getField(Mco.ID).addListener(new FieldReSelectHandler(this)); this.getRecord(McoBatchDist.MCO_BATCH_DIST_FILE).addListener(new SubCountHandler(this.getScreenRecord().getField(CashBatchScreenRecord.CHANGE_BALANCE), McoBatchDist.AMOUNT, false, true)); this.getScreenRecord().getField(CashBatchScreenRecord.CHANGE_BALANCE).addListener(new CalcBalanceHandler(this.getScreenRecord().getField(CashBatchScreenRecord.END_BALANCE), this.getScreenRecord().getField(CashBatchScreenRecord.CHANGE_BALANCE), this.getRecord(Mco.MCO_FILE).getField(Mco.NET), true)); } /**