/** * Constructor. * @param field The basefield owner of this listener (usually null and set on setOwner()). * @param fldDest The destination field. * @param fldSource The source field. * @param bClearIfThisNull If this listener's owner is set to null, set the destination field to null. * @param bOnlyIfDestNull Move only if the destination field is null. */ public void init(BaseField field, Converter fldDest, Converter fldSource, boolean bClearIfThisNull, boolean bOnlyIfDestNull, boolean bDontMoveNull) { super.init(field); this.setRespondsToMode(DBConstants.INIT_MOVE, false); this.setRespondsToMode(DBConstants.READ_MOVE, false); // By default, only respond to screen moves m_fldDest = fldDest; m_fldSource = fldSource; m_bClearIfThisNull = bClearIfThisNull; m_bOnlyIfDestNull = bOnlyIfDestNull; m_bDontMoveNull = bDontMoveNull; } /**
/** * Constructor. * @param field The basefield owner of this listener (usually null and set on setOwner()). * @param fldDest The destination field. * @param fldSource The source field. * @param bClearIfThisNull If this listener's owner is set to null, set the destination field to null. * @param bOnlyIfDestNull Move only if the destination field is null. */ public void init(BaseField field, Converter fldDest, Converter fldSource, boolean bClearIfThisNull, boolean bOnlyIfDestNull, boolean bDontMoveNull) { super.init(field); this.setRespondsToMode(DBConstants.INIT_MOVE, false); this.setRespondsToMode(DBConstants.READ_MOVE, false); // By default, only respond to screen moves m_fldDest = fldDest; m_fldSource = fldSource; m_bClearIfThisNull = bClearIfThisNull; m_bOnlyIfDestNull = bOnlyIfDestNull; m_bDontMoveNull = bDontMoveNull; } /**
/** * Constructor. * @param field The basefield owner of this listener (usually null and set on setOwner()). * @param fldDest The destination field. * @param fldSource The source field. * @param bClearIfThisNull If this listener's owner is set to null, set the destination field to null. * @param bOnlyIfDestNull Move only if the destination field is null. */ public void init(BaseField field, Converter fldDest, Converter fldSource, boolean bClearIfThisNull, boolean bOnlyIfDestNull, boolean bDontMoveNull) { super.init(field); this.setRespondsToMode(DBConstants.INIT_MOVE, false); this.setRespondsToMode(DBConstants.READ_MOVE, false); // By default, only respond to screen moves m_fldDest = fldDest; m_fldSource = fldSource; m_bClearIfThisNull = bClearIfThisNull; m_bOnlyIfDestNull = bOnlyIfDestNull; m_bDontMoveNull = bDontMoveNull; } /**
/** * Add behaviors to this session. */ public void addListeners() { super.addListeners(); Record recBooking = this.getRecord(Booking.BOOKING_FILE); this.getMainRecord().addListener(new SubFileFilter(recBooking)); BookingDetail recBookingDetail = (BookingDetail)this.getMainRecord(); Record recProduct = (Record)recBookingDetail.getProduct(); recBookingDetail.getField(BookingDetail.PRODUCT_ID).addListener(new ReadSecondaryHandler(recProduct)); Record recVendor = ((ReferenceField)recProduct.getField(Product.VENDOR_ID)).getReferenceRecord(this); recProduct.getField(Product.VENDOR_ID).addListener(new ReadSecondaryHandler(recVendor)); Record recCurrencys = ((ReferenceField)recVendor.getField(Vendor.CURRENCYS_ID)).getReferenceRecord(this); recVendor.getField(Vendor.CURRENCYS_ID).addListener(new ReadSecondaryHandler(recCurrencys)); // This code read the currency CODE into a virtual field for use in displays MoveOnChangeHandler moveListener = new MoveOnChangeHandler(recBookingDetail.getField(BookingDetail.CURRENCY_CODE), recCurrencys.getField(Currencys.CURRENCY_CODE)); moveListener.setRespondsToMode(DBConstants.INIT_MOVE, true); moveListener.setRespondsToMode(DBConstants.READ_MOVE, true); recBookingDetail.getField(BookingDetail.PRODUCT_ID).addListener(moveListener); }
recBooking.getField(Booking.CURRENCYS_ID).addListener(new ReadSecondaryHandler(recCurrencys)); MoveOnChangeHandler moveListener = new MoveOnChangeHandler(recBooking.getField(Booking.CURRENCY_CODE), recCurrencys.getField(Currencys.CURRENCY_CODE)); moveListener.setRespondsToMode(DBConstants.INIT_MOVE, true); moveListener.setRespondsToMode(DBConstants.READ_MOVE, true); recBooking.getField(Booking.CURRENCYS_ID).addListener(moveListener);