/** * Constructor. * @param pfldDest tour.field.BaseField The destination field. * @param fldSource The source field. * @param pCheckMark If is field if false, don't move the data. * @param bMoveOnNew If true, move on new also. * @param bMoveOnValid If true, move on valid also. */ public void init(Record record, BaseField fldDest, BaseField fldSource, Converter convCheckMark, boolean bMoveOnNew, boolean bMoveOnValid, boolean bMoveOnSelect, boolean bMoveOnAdd, boolean bMoveOnUpdate, String strSource, boolean bDontMoveNullSource) { super.init(record, fldDest, fldSource, convCheckMark, bMoveOnNew, bMoveOnValid, bMoveOnSelect, bMoveOnAdd, bMoveOnUpdate, strSource, bDontMoveNullSource); } }
/** * Called when a valid record is read from the table/query. * @param bDisplayOption If true, display any changes. */ public void doValidRecord(boolean bDisplayOption) { // Copy the key field to the master file and BYPASS the BEHAVIORS super.doValidRecord(bDisplayOption); if (m_bMoveOnValid) { int iMoveType = DBConstants.SCREEN_MOVE; // Do trigger a record change. this.moveTheData(bDisplayOption, iMoveType); } } /**
/** * Set the field or file that owns this listener. * @param owner My owner. */ public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (this.getOwner() == null) return; if (m_fldDest.getRecord() != this.getOwner()) // If field is not in this file, remember to remove it m_fldDest.addListener(new FieldRemoveBOnCloseHandler(this)); if (m_fldSource != null) if (m_fldSource.getRecord() != this.getOwner()) if (m_fldSource.getRecord() != m_fldDest.getRecord()) m_fldSource.addListener(new FieldRemoveBOnCloseHandler(this)); if ((this.getOwner().getEditMode() == DBConstants.EDIT_CURRENT) || (this.getOwner().getEditMode() == DBConstants.EDIT_IN_PROGRESS)) if (m_bMoveOnValid) this.moveTheData(DBConstants.DISPLAY, DBConstants.INIT_MOVE); // Do trigger a record change. if (this.getOwner().getEditMode() == DBConstants.EDIT_ADD) if (m_bMoveOnNew) this.moveTheData(DBConstants.DISPLAY, DBConstants.INIT_MOVE); // Do trigger a record change. } /**
/** * Actually move the data. * @param bDisplayOption If true, display any changes. */ public void moveTheData(boolean bDisplayOption, int iMoveType) { if (m_convCheckMark != null) if (m_bDisableOnMove) m_fldDest.setEnabled(!m_convCheckMark.getState()); if ((m_convCheckMark == null) || (m_convCheckMark.getState())) { if ((this.getSourceField() != null) && ((!this.getSourceField().isNull()) || (!m_bDontMoveNullSource))) m_fldDest.moveFieldToThis(this.getSourceField(), bDisplayOption, iMoveType); // Move dependent field to here else if (m_strSource != null) m_fldDest.setString(m_strSource, bDisplayOption, iMoveType); // Move dependent field to here else if (m_fldDest instanceof ReferenceField) ((ReferenceField)m_fldDest).setReference(this.getOwner(), bDisplayOption, iMoveType); } else { if (bDisplayOption) m_fldDest.displayField(); // Redisplay based on this check mark } } /**
this.addListener(new MoveOnEventHandler(screenRecord.getField(BookingScreenRecord.LAST_CITY_ID), ((TransportProduct)recProduct).getField(TransportProduct.TO_CITY_ID), null, false, false, false, true, true, null, true)); this.addListener(new MoveOnEventHandler(screenRecord.getField(BookingScreenRecord.LAST_CITY_ID), recProduct.getField(Product.CITY_ID), null, false, false, false, true, true, null, false)); this.addListener(new MoveOnEventHandler(screenRecord.getField(BookingScreenRecord.LAST_DATE), this.getField(BookingDetail.DETAIL_DATE), null, false, false, false, true, true, null, false)); this.addListener(new MoveOnEventHandler(screenRecord.getField(BookingScreenRecord.LAST_DATE), this.getField(BookingDetail.DETAIL_END_DATE), null, false, false, false, true, true, null, true));
/** * Set the field or file that owns this listener. * @param owner My owner. */ public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (this.getOwner() == null) return; if (m_fldDest.getRecord() != this.getOwner()) // If field is not in this file, remember to remove it m_fldDest.addListener(new FieldRemoveBOnCloseHandler(this)); if (m_fldSource != null) if (m_fldSource.getRecord() != this.getOwner()) if (m_fldSource.getRecord() != m_fldDest.getRecord()) m_fldSource.addListener(new FieldRemoveBOnCloseHandler(this)); if ((this.getOwner().getEditMode() == DBConstants.EDIT_CURRENT) || (this.getOwner().getEditMode() == DBConstants.EDIT_IN_PROGRESS)) if (m_bMoveOnValid) this.moveTheData(DBConstants.DISPLAY, DBConstants.INIT_MOVE); // Do trigger a record change. if (this.getOwner().getEditMode() == DBConstants.EDIT_ADD) if (m_bMoveOnNew) this.moveTheData(DBConstants.DISPLAY, DBConstants.INIT_MOVE); // Do trigger a record change. } /**
/** * Actually move the data. * @param bDisplayOption If true, display any changes. */ public void moveTheData(boolean bDisplayOption, int iMoveType) { if (m_convCheckMark != null) if (m_bDisableOnMove) m_fldDest.setEnabled(!m_convCheckMark.getState()); if ((m_convCheckMark == null) || (m_convCheckMark.getState())) { if ((this.getSourceField() != null) && ((!this.getSourceField().isNull()) || (!m_bDontMoveNullSource))) m_fldDest.moveFieldToThis(this.getSourceField(), bDisplayOption, iMoveType); // Move dependent field to here else if (m_strSource != null) m_fldDest.setString(m_strSource, bDisplayOption, iMoveType); // Move dependent field to here else if (m_fldDest instanceof ReferenceField) ((ReferenceField)m_fldDest).setReference(this.getOwner(), bDisplayOption, iMoveType); } else { if (bDisplayOption) m_fldDest.displayField(); // Redisplay based on this check mark } } /**
this.addListener(new MoveOnEventHandler(screenRecord.getField(BookingScreenRecord.LAST_CITY_ID), ((TransportProduct)recProduct).getField(TransportProduct.TO_CITY_ID), null, false, false, false, true, true, null, true)); this.addListener(new MoveOnEventHandler(screenRecord.getField(BookingScreenRecord.LAST_CITY_ID), recProduct.getField(Product.CITY_ID), null, false, false, false, true, true, null, false)); this.addListener(new MoveOnEventHandler(screenRecord.getField(BookingScreenRecord.LAST_DATE), this.getField(BookingDetail.DETAIL_DATE), null, false, false, false, true, true, null, false)); this.addListener(new MoveOnEventHandler(screenRecord.getField(BookingScreenRecord.LAST_DATE), this.getField(BookingDetail.DETAIL_END_DATE), null, false, false, false, true, true, null, true));
/** * Set the field or file that owns this listener. * @param owner My owner. */ public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (this.getOwner() == null) return; if (m_fldDest.getRecord() != this.getOwner()) // If field is not in this file, remember to remove it m_fldDest.addListener(new FieldRemoveBOnCloseHandler(this)); if (m_fldSource != null) if (m_fldSource.getRecord() != this.getOwner()) if (m_fldSource.getRecord() != m_fldDest.getRecord()) m_fldSource.addListener(new FieldRemoveBOnCloseHandler(this)); if ((this.getOwner().getEditMode() == DBConstants.EDIT_CURRENT) || (this.getOwner().getEditMode() == DBConstants.EDIT_IN_PROGRESS)) if (m_bMoveOnValid) this.moveTheData(DBConstants.DISPLAY, DBConstants.INIT_MOVE); // Do trigger a record change. if (this.getOwner().getEditMode() == DBConstants.EDIT_ADD) if (m_bMoveOnNew) this.moveTheData(DBConstants.DISPLAY, DBConstants.INIT_MOVE); // Do trigger a record change. } /**
/** * Actually move the data. * @param bDisplayOption If true, display any changes. */ public void moveTheData(boolean bDisplayOption, int iMoveType) { if (m_convCheckMark != null) if (m_bDisableOnMove) m_fldDest.setEnabled(!m_convCheckMark.getState()); if ((m_convCheckMark == null) || (m_convCheckMark.getState())) { if ((this.getSourceField() != null) && ((!this.getSourceField().isNull()) || (!m_bDontMoveNullSource))) m_fldDest.moveFieldToThis(this.getSourceField(), bDisplayOption, iMoveType); // Move dependent field to here else if (m_strSource != null) m_fldDest.setString(m_strSource, bDisplayOption, iMoveType); // Move dependent field to here else if (m_fldDest instanceof ReferenceField) ((ReferenceField)m_fldDest).setReference(this.getOwner(), bDisplayOption, iMoveType); } else { if (bDisplayOption) m_fldDest.displayField(); // Redisplay based on this check mark } } /**
/** * Called when a valid record is read from the table/query. * @param bDisplayOption If true, display any changes. */ public void doValidRecord(boolean bDisplayOption) { // Copy the key field to the master file and BYPASS the BEHAVIORS super.doValidRecord(bDisplayOption); if (m_bMoveOnValid) { int iMoveType = DBConstants.SCREEN_MOVE; // Do trigger a record change. this.moveTheData(bDisplayOption, iMoveType); } } /**
/** * Constructor. * @param pfldDest tour.field.BaseField The destination field. * @param fldSource The source field. * @param pCheckMark If is field if false, don't move the data. * @param bMoveOnNew If true, move on new also. * @param bMoveOnValid If true, move on valid also. */ public void init(Record record, BaseField fldDest, BaseField fldSource, Converter convCheckMark, boolean bMoveOnNew, boolean bMoveOnValid, boolean bMoveOnSelect, boolean bMoveOnAdd, boolean bMoveOnUpdate, String strSource, boolean bDontMoveNullSource) { super.init(record, fldDest, fldSource, convCheckMark, bMoveOnNew, bMoveOnValid, bMoveOnSelect, bMoveOnAdd, bMoveOnUpdate, strSource, bDontMoveNullSource); } }
listener.setRespondsToMode(DBConstants.READ_MOVE, true); m_recVendor.addListener(new MoveOnEventHandler(this, m_recVendor.getField(Company.ID), null, true, true, false, false, false, null, false)); m_recVendor.addListener(new MoveOnValidHandler(this.getContactTypeField(), VENDOR_CONTACT_TYPE_ID)); listener.setRespondsToMode(DBConstants.READ_MOVE, true); m_recProfile.addListener(new MoveOnEventHandler(this, m_recProfile.getField(Company.ID), null, true, true, false, false, false, null, false)); m_recProfile.addListener(new MoveOnValidHandler(this.getContactTypeField(), PROFILE_CONTACT_TYPE_ID));
/** * Called when a valid record is read from the table/query. * @param bDisplayOption If true, display any changes. */ public void doValidRecord(boolean bDisplayOption) { // Copy the key field to the master file and BYPASS the BEHAVIORS super.doValidRecord(bDisplayOption); if (m_bMoveOnValid) { int iMoveType = DBConstants.SCREEN_MOVE; // Do trigger a record change. this.moveTheData(bDisplayOption, iMoveType); } } /**
/** * Constructor. * @param pfldDest tour.field.BaseField The destination field. * @param fldSource The source field. * @param pCheckMark If is field if false, don't move the data. * @param bMoveOnNew If true, move on new also. * @param bMoveOnValid If true, move on valid also. */ public void init(Record record, BaseField fldDest, BaseField fldSource, Converter convCheckMark, boolean bMoveOnNew, boolean bMoveOnValid, boolean bMoveOnSelect, boolean bMoveOnAdd, boolean bMoveOnUpdate, String strSource, boolean bDontMoveNullSource) { super.init(record, fldDest, fldSource, convCheckMark, bMoveOnNew, bMoveOnValid, bMoveOnSelect, bMoveOnAdd, bMoveOnUpdate, strSource, bDontMoveNullSource); } }
listener.setRespondsToMode(DBConstants.READ_MOVE, true); m_recVendor.addListener(new MoveOnEventHandler(this, m_recVendor.getField(Company.kID), null, true, true, false, false, false, null, false)); m_recVendor.addListener(new MoveOnValidHandler(this.getContactTypeField(), VENDOR_CONTACT_TYPE_ID)); listener.setRespondsToMode(DBConstants.READ_MOVE, true); m_recProfile.addListener(new MoveOnEventHandler(this, m_recProfile.getField(Company.kID), null, true, true, false, false, false, null, false)); m_recProfile.addListener(new MoveOnValidHandler(this.getContactTypeField(), PROFILE_CONTACT_TYPE_ID));
/** * Called when a change is the record status is about to happen/has happened. * If this file is selected (opened) move the field. * @param field If this file change is due to a field, this is the field. * @param iChangeType The type of change that occurred. * @param bDisplayOption If true, display any changes. * @return an error code. */ public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Read a valid record int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; if (((iChangeType == DBConstants.SELECT_TYPE) && (m_bMoveOnSelect)) || ((iChangeType == DBConstants.AFTER_ADD_TYPE) && (m_bMoveOnAdd)) || ((iChangeType == DBConstants.AFTER_UPDATE_TYPE) && (m_bMoveOnUpdate))) this.moveTheData(bDisplayOption, DBConstants.SCREEN_MOVE); // Do trigger a record change. return iErrorCode; } /**
/** * Constructor. * @param pfldDest tour.field.BaseField The destination field. * @param fldSource The source field. * @param pCheckMark If is field if false, don't move the data. * @param bMoveOnNew If true, move on new also. * @param bMoveOnValid If true, move on valid also. */ public void init(Record record, BaseField fldDest, BaseField fldSource, Converter convCheckMark, boolean bMoveOnNew, boolean bMoveOnValid, boolean bMoveOnSelect, boolean bMoveOnAdd, boolean bMoveOnUpdate, String strSource, boolean bDontMoveNullSource) { super.init(record, fldDest, fldSource, convCheckMark, bMoveOnNew, bMoveOnValid, bMoveOnSelect, bMoveOnAdd, bMoveOnUpdate, strSource, bDontMoveNullSource); } }
/** * Called when a change is the record status is about to happen/has happened. * If this file is selected (opened) move the field. * @param field If this file change is due to a field, this is the field. * @param iChangeType The type of change that occurred. * @param bDisplayOption If true, display any changes. * @return an error code. */ public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Read a valid record int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; if (((iChangeType == DBConstants.SELECT_TYPE) && (m_bMoveOnSelect)) || ((iChangeType == DBConstants.AFTER_ADD_TYPE) && (m_bMoveOnAdd)) || ((iChangeType == DBConstants.AFTER_UPDATE_TYPE) && (m_bMoveOnUpdate))) this.moveTheData(bDisplayOption, DBConstants.SCREEN_MOVE); // Do trigger a record change. return iErrorCode; } /**
/** * Constructor. * @param pfldDest tour.field.BaseField The destination field. * @param fldSource The source field. * @param pCheckMark If is field if false, don't move the data. * @param bMoveOnNew If true, move on new also. * @param bMoveOnValid If true, move on valid also. */ public MoveOnEventHandler(BaseField fldDest, BaseField fldSource, Converter convCheckMark, boolean bMoveOnNew, boolean bMoveOnValid, boolean bMoveOnSelect, boolean bMoveOnAdd, boolean bMoveOnUpdate, String strSource, boolean bDontMoveNullSource) { this(); this.init(null, fldDest, fldSource, convCheckMark, bMoveOnNew, bMoveOnValid, bMoveOnSelect, bMoveOnAdd, bMoveOnUpdate, strSource, bDontMoveNullSource); } /**