/** * This Constructor moves this string to the dest field on valid on optionally on new. * @param pfldDest tour.field.BaseField The destination field. * @param strSource The source string. * @param bMoveOnNew If true, move on new also. */ public MoveOnValidHandler(BaseField fldDest, String strSource, boolean bMoveOnNew) { this(); this.init(null, fldDest, null, null, bMoveOnNew, true, false, false, false, strSource, false); } /**
/** * This method is specifically for making sure a handle is moved to this field on valid. * The field must be a ReferenceField. * @param iFieldSeq int On valid, move to this field. */ public MoveOnValidHandler addFieldSeqPair(int iFieldSeq) { m_bMoveBehavior = true; MoveOnValidHandler moveBehavior = new MoveOnValidHandler(this.getOwner().getRecord().getField(iFieldSeq)); m_record.addListener(moveBehavior); return moveBehavior; } /**
|| (listener2.getSourceField() != recordKeyField)) record.addListener(new MoveOnValidHandler(this, recordKeyField)); MainReadOnlyHandler listener3 = (MainReadOnlyHandler)recordKeyField.getListener(MainReadOnlyHandler.class.getName()); if (listener3 == null)
/** * Called when a change is the record status is about to happen/has happened. * @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 (Move the header record data down) if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; if ((iChangeType == DBConstants.AFTER_ADD_TYPE) || (iChangeType == DBConstants.AFTER_UPDATE_TYPE)) { double dControlValue = m_fldSource.getValue(); double dFieldValue = m_fldDest.getValue(); if (dControlValue == dFieldValue) iErrorCode = m_fldSource.setValue(dFieldValue + this.getBumpValue(), bDisplayOption, DBConstants.SCREEN_MOVE); else if (dControlValue < dFieldValue) iErrorCode = m_fldSource.moveFieldToThis(m_fldDest, bDisplayOption, DBConstants.SCREEN_MOVE); } return iErrorCode; } /**
/** * AddSecondProfile Method. */ public void addSecondProfile(Record recProfile) { ReadSecondaryHandler behavior = new ReadSecondaryHandler(recProfile, Profile.PROFILE_CODE_KEY); behavior.setRespondsToMode(DBConstants.READ_MOVE, false); this.getField(Booking.PROFILE_CODE).addListener(behavior); behavior.addFieldSeqPair(Booking.PROFILE_ID, Profile.ID, DBConstants.MOVE_TO_DEPENDENT, DBConstants.DONT_MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.PROFILE_CODE, Profile.PROFILE_CODE, DBConstants.MOVE_TO_DEPENDENT, DBConstants.DONT_MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.GENERIC_NAME, Profile.GENERIC_NAME, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.ADDRESS_LINE_1, Profile.ADDRESS_LINE_1, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.ADDRESS_LINE_2, Profile.ADDRESS_LINE_2, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.CITY_OR_TOWN, Profile.CITY_OR_TOWN, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.COUNTRY, Profile.COUNTRY, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.STATE_OR_REGION, Profile.STATE_OR_REGION, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.POSTAL_CODE, Profile.POSTAL_CODE, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.TEL, Profile.TEL, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.FAX, Profile.FAX, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.EMAIL, Profile.EMAIL, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.LANGUAGE_ID, Profile.PRIMARY_LANGUAGE_ID, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.CURRENCYS_ID, Profile.CURRENCYS_ID, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); // Only move contact if not blank Converter convTrueIfContactNotBlank = new RadioConverter(this.getField(Booking.CONTACT), DBConstants.BLANK, true); recProfile.addListener(new RemoveConverterOnCloseHandler(convTrueIfContactNotBlank)); MoveOnValidHandler moveHandler = behavior.addFieldSeqPair(Booking.CONTACT, Profile.CONTACT, DBConstants.MOVE_TO_DEPENDENT, DBConstants.DONT_MOVE_DEPENDENT_BACK, convTrueIfContactNotBlank, null); moveHandler.setDisableOnMove(false); } /**
/** * This method is specifically for making sure a handle is moved to this field on valid. * The field must be a ReferenceField. * @param iFieldSeq int On valid, move to this field. */ public MoveOnValidHandler addFieldSeqPair(int iFieldSeq) { m_bMoveBehavior = true; MoveOnValidHandler moveBehavior = new MoveOnValidHandler(this.getOwner().getRecord().getField(iFieldSeq)); m_record.addListener(moveBehavior); return moveBehavior; } /**
|| (listener2.getSourceField() != recordKeyField)) record.addListener(new MoveOnValidHandler(this, recordKeyField)); MainReadOnlyHandler listener3 = (MainReadOnlyHandler)recordKeyField.getListener(MainReadOnlyHandler.class.getName()); if (listener3 == null)
/** * Called when a change is the record status is about to happen/has happened. * @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 (Move the header record data down) if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; if ((iChangeType == DBConstants.AFTER_ADD_TYPE) || (iChangeType == DBConstants.AFTER_UPDATE_TYPE)) { double dControlValue = m_fldSource.getValue(); double dFieldValue = m_fldDest.getValue(); if (dControlValue == dFieldValue) iErrorCode = m_fldSource.setValue(dFieldValue + this.getBumpValue(), bDisplayOption, DBConstants.SCREEN_MOVE); else if (dControlValue < dFieldValue) iErrorCode = m_fldSource.moveFieldToThis(m_fldDest, bDisplayOption, DBConstants.SCREEN_MOVE); } return iErrorCode; } /**
/** * AddSecondProfile Method. */ public void addSecondProfile(Record recProfile) { ReadSecondaryHandler behavior = new ReadSecondaryHandler(recProfile, Profile.PROFILE_CODE_KEY); behavior.setRespondsToMode(DBConstants.READ_MOVE, false); this.getField(Booking.PROFILE_CODE).addListener(behavior); behavior.addFieldSeqPair(Booking.PROFILE_ID, Profile.ID, DBConstants.MOVE_TO_DEPENDENT, DBConstants.DONT_MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.PROFILE_CODE, Profile.PROFILE_CODE, DBConstants.MOVE_TO_DEPENDENT, DBConstants.DONT_MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.GENERIC_NAME, Profile.GENERIC_NAME, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.ADDRESS_LINE_1, Profile.ADDRESS_LINE_1, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.ADDRESS_LINE_2, Profile.ADDRESS_LINE_2, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.CITY_OR_TOWN, Profile.CITY_OR_TOWN, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.COUNTRY, Profile.COUNTRY, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.STATE_OR_REGION, Profile.STATE_OR_REGION, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.POSTAL_CODE, Profile.POSTAL_CODE, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.TEL, Profile.TEL, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.FAX, Profile.FAX, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.EMAIL, Profile.EMAIL, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.LANGUAGE_ID, Profile.PRIMARY_LANGUAGE_ID, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); behavior.addFieldSeqPair(Booking.CURRENCYS_ID, Profile.CURRENCYS_ID, DBConstants.MOVE_TO_DEPENDENT, DBConstants.MOVE_DEPENDENT_BACK); // Only move contact if not blank Converter convTrueIfContactNotBlank = new RadioConverter(this.getField(Booking.CONTACT), DBConstants.BLANK, true); recProfile.addListener(new RemoveConverterOnCloseHandler(convTrueIfContactNotBlank)); MoveOnValidHandler moveHandler = behavior.addFieldSeqPair(Booking.CONTACT, Profile.CONTACT, DBConstants.MOVE_TO_DEPENDENT, DBConstants.DONT_MOVE_DEPENDENT_BACK, convTrueIfContactNotBlank, null); moveHandler.setDisableOnMove(false); } /**
/** * This method is specifically for making sure a handle is moved to this field on valid. * The field must be a ReferenceField. * @param iFieldSeq int On valid, move to this field. */ public MoveOnValidHandler addFieldSeqPair(int iFieldSeq) { m_bMoveBehavior = true; MoveOnValidHandler moveBehavior = new MoveOnValidHandler(this.getOwner().getRecord().getField(iFieldSeq)); m_record.addListener(moveBehavior); return moveBehavior; } /**
|| (listener2.getSourceField() != recordKeyField)) record.addListener(new MoveOnValidHandler(this, recordKeyField)); MainReadOnlyHandler listener3 = (MainReadOnlyHandler)recordKeyField.getListener(MainReadOnlyHandler.class.getName()); if (listener3 == null)
/** * This Constructor moves the source field to the dest field on valid. * @param record My owner (usually passed as null, and set on addListener in setOwner()). * @param pfldDest tour.field.BaseField The destination field. * @param fldSource The source field. */ public void init(Record record, BaseField fldDest, BaseField fldSource) { super.init(record, fldDest, fldSource, null, true, false, false, false, false, null, false); } /**
/** * Called when a change is the record status is about to happen/has happened. * @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 (Move the header record data down) if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; if ((iChangeType == DBConstants.AFTER_ADD_TYPE) || (iChangeType == DBConstants.AFTER_UPDATE_TYPE)) { double dControlValue = m_fldSource.getValue(); double dFieldValue = m_fldDest.getValue(); if (dControlValue == dFieldValue) iErrorCode = m_fldSource.setValue(dFieldValue + this.getBumpValue(), bDisplayOption, DBConstants.SCREEN_MOVE); else if (dControlValue < dFieldValue) iErrorCode = m_fldSource.moveFieldToThis(m_fldDest, bDisplayOption, DBConstants.SCREEN_MOVE); } return iErrorCode; } /**
/** * This method is specifically for making sure a handle is moved to this field on valid. * The field must be a ReferenceField. * @param iFieldSeq int On valid, move to this field. */ public MoveOnValidHandler addFieldSeqPair(String iFieldSeq) { m_bMoveBehavior = true; MoveOnValidHandler moveBehavior = new MoveOnValidHandler(this.getOwner().getRecord().getField(iFieldSeq)); m_record.addListener(moveBehavior); return moveBehavior; } /**
/** * This Constructor moves this string to the dest field on valid. * @param pfldDest tour.field.BaseField The destination field. * @param strSource The source string. */ public MoveOnValidHandler(BaseField fldDest, String strSource) { this(); this.init(null, fldDest, null, null, false, true, false, false, false, strSource, false); } /**
record.getField(TourHeaderDetail.PRODUCT_ID).addListener(new ReadSecondaryHandler(recProduct)); BaseField fldProductDesc = recProduct.getField(Product.DESCRIPTION); recProduct.addListener(new MoveOnValidHandler(field, fldProductDesc));
/** * This Constructor moves the source field to the dest field on valid. * @param record My owner (usually passed as null, and set on addListener in setOwner()). * @param pfldDest tour.field.BaseField The destination field. * @param fldSource The source field. */ public void init(Record record, BaseField fldDest, BaseField fldSource) { super.init(record, fldDest, fldSource, null, true, false, false, false, false, null, false); } /**
record.getField(TourHeaderDetail.PRODUCT_ID).addListener(new ReadSecondaryHandler(recProduct)); BaseField fldProductDesc = recProduct.getField(Product.DESCRIPTION); recProduct.addListener(new MoveOnValidHandler(field, fldProductDesc));
/** * This Constructor moves the current Handle to the (Reference or FullReference) dest field on valid. * @param pfldDest tour.field.BaseField */ public MoveOnValidHandler(BaseField fldDest) { this(); this.init(null, fldDest, null, null, false, true, false, false, false, null, false); } /**
moveBehavior = new MoveOnValidHandler(fldDest, fldSource, convCheckMark, true, true); m_record.addListener(moveBehavior);