/** * Constructor. * @param converter The converter to remove on close. */ public RemoveConverterOnCloseHandler(Converter converter) { this(); this.init(null, converter); } /**
/** * Free this listener and free this converter if it doesn't belong to a record. */ public void free() { this.removeConverter(); super.free(); } /**
/** * Initialize this object. * @param record The merge record for this column. * @param strLinkedRecord The name of the record this field sequence is in. * @param iFieldSeq The field sequence of the field for this column. */ public void init(Record record, String strLinkedRecord, int iFieldSeq) { super.init(null); m_MergeRecord = record; m_strLinkedRecord = strLinkedRecord; m_FieldSeq = iFieldSeq; if (record != null) record.addListener(new RemoveConverterOnCloseHandler(this)); // Because this is a converter (not a fieldConverter) } /**
/** * Initialize this object. * @param record The merge record for this column. * @param strLinkedRecord The name of the record this field sequence is in. * @param iFieldSeq The field sequence of the field for this column. */ public void init(Record record, String strLinkedRecord, int iFieldSeq) { super.init(null); m_MergeRecord = record; m_strLinkedRecord = strLinkedRecord; m_FieldSeq = iFieldSeq; if (record != null) record.addListener(new RemoveConverterOnCloseHandler(this)); // Because this is a converter (not a fieldConverter) } /**
/** * Initialize this object. * @param record The merge record for this column. * @param strLinkedRecord The name of the record this field sequence is in. * @param iFieldSeq The field sequence of the field for this column. */ public void init(Record record, String strLinkedRecord, int iFieldSeq) { super.init(null); m_MergeRecord = record; m_strLinkedRecord = strLinkedRecord; m_FieldSeq = iFieldSeq; if (record != null) record.addListener(new RemoveConverterOnCloseHandler(this)); // Because this is a converter (not a fieldConverter) } /**
/** * Free this listener and free this converter if it doesn't belong to a record. */ public void free() { this.removeConverter(); super.free(); } /**
/** * Constructor. * @param converter The converter to remove on close. */ public RemoveConverterOnCloseHandler(Converter converter) { this(); this.init(null, converter); } /**
/** * Decode and read this field from the stream. * Will create a new field, init it and set the data if the field is not passed in. * @param daIn The input stream to unmarshal the data from. * @param fldCurrent The field to unmarshall the data into (optional). */ public BaseField readField(ObjectInputStream daIn, BaseField fldCurrent) throws IOException, ClassNotFoundException { String strFieldName = daIn.readUTF(); Object objData = daIn.readObject(); if (fldCurrent == null) if (strFieldName.length() > 0) { fldCurrent = (BaseField)ClassServiceUtility.getClassService().makeObjectFromClassName(strFieldName); if (fldCurrent != null) { fldCurrent.init(null, null, DBConstants.DEFAULT_FIELD_LENGTH, null, null); if (this.getOwner() != null) // Make sure it is cleaned up this.getOwner().addListener(new RemoveConverterOnCloseHandler(fldCurrent)); } } if (fldCurrent != null) fldCurrent.setData(objData); return fldCurrent; } /**
/** * Free this listener and free this converter if it doesn't belong to a record. */ public void free() { this.removeConverter(); super.free(); } /**
/** * Constructor. * @param converter The converter to remove on close. */ public RemoveConverterOnCloseHandler(Converter converter) { this(); this.init(null, converter); } /**
/** * Decode and read this field from the stream. * Will create a new field, init it and set the data if the field is not passed in. * @param daIn The input stream to unmarshal the data from. * @param fldCurrent The field to unmarshall the data into (optional). */ public BaseField readField(ObjectInputStream daIn, BaseField fldCurrent) throws IOException, ClassNotFoundException { String strFieldName = daIn.readUTF(); Object objData = daIn.readObject(); if (fldCurrent == null) if (strFieldName.length() > 0) { fldCurrent = (BaseField)ClassServiceUtility.getClassService().makeObjectFromClassName(strFieldName); if (fldCurrent != null) { fldCurrent.init(null, null, DBConstants.DEFAULT_FIELD_LENGTH, null, null); if (this.getOwner() != null) // Make sure it is cleaned up this.getOwner().addListener(new RemoveConverterOnCloseHandler(fldCurrent)); } } if (fldCurrent != null) fldCurrent.setData(objData); return fldCurrent; } /**
/** * Decode and read this field from the stream. * Will create a new field, init it and set the data if the field is not passed in. * @param daIn The input stream to unmarshal the data from. * @param fldCurrent The field to unmarshall the data into (optional). */ public BaseField readField(ObjectInputStream daIn, BaseField fldCurrent) throws IOException, ClassNotFoundException { String strFieldName = daIn.readUTF(); Object objData = daIn.readObject(); if (fldCurrent == null) if (strFieldName.length() > 0) { fldCurrent = (BaseField)ClassServiceUtility.getClassService().makeObjectFromClassName(strFieldName); if (fldCurrent != null) { fldCurrent.init(null, null, DBConstants.DEFAULT_FIELD_LENGTH, null, null); if (this.getOwner() != null) // Make sure it is cleaned up this.getOwner().addListener(new RemoveConverterOnCloseHandler(fldCurrent)); } } if (fldCurrent != null) fldCurrent.setData(objData); return fldCurrent; } /**
/** * Initialize. * @param itsLocation The location of this component within the parent. * @param parentScreen The parent screen. * @param fieldConverter The field this screen field is linked to. * @param iDisplayFieldDesc Do I display the field desc? * @param strValue The value to set the field on button press. * @param strDesc The description of this button. * @param strImage The image filename for this button. * @param strCommand The command to send on button press. * @param strToolTip The tooltip for this button. * @param record The (optional) record. * @param field The (optional) field. */ public void init(ScreenLocation itsLocation, BasePanel parentScreen, Converter fieldConverter, int iDisplayFieldDesc, String strValue, String strDesc, String strImage, String strCommand, String strToolTip, Record record, BaseField field) { m_record = record; m_field = field; m_strValue = strValue; m_iDisplayFieldDesc = iDisplayFieldDesc; if (record != null) if (fieldConverter == null) if (this.getDisplayFieldDesc(this)) { // Use the record name as the desc fieldConverter = new FieldDescConverter(null, record.getRecordName()); record.addListener(new RemoveConverterOnCloseHandler(fieldConverter)); // Remove on close } super.init(itsLocation, parentScreen, fieldConverter, iDisplayFieldDesc, strValue, strDesc, strImage, strCommand, strToolTip); } /**
/** * Initialize. * @param itsLocation The location of this component within the parent. * @param parentScreen The parent screen. * @param fieldConverter The field this screen field is linked to. * @param iDisplayFieldDesc Do I display the field desc? * @param strValue The value to set the field on button press. * @param strDesc The description of this button. * @param strImage The image filename for this button. * @param strCommand The command to send on button press. * @param strToolTip The tooltip for this button. * @param record The (optional) record. * @param field The (optional) field. */ public void init(ScreenLocation itsLocation, BasePanel parentScreen, Converter fieldConverter, int iDisplayFieldDesc, String strValue, String strDesc, String strImage, String strCommand, String strToolTip, Record record, BaseField field) { m_record = record; m_field = field; m_strValue = strValue; m_iDisplayFieldDesc = iDisplayFieldDesc; if (record != null) if (fieldConverter == null) if (this.getDisplayFieldDesc(this)) { // Use the record name as the desc fieldConverter = new FieldDescConverter(null, record.getRecordName()); record.addListener(new RemoveConverterOnCloseHandler(fieldConverter)); // Remove on close } super.init(itsLocation, parentScreen, fieldConverter, iDisplayFieldDesc, strValue, strDesc, strImage, strCommand, strToolTip); } /**
/** * Init. * @param record The merge record. * @param iFieldSeq The sequence of the field in the target records. */ public void init(Record record, int iFieldSeq, int iSecondaryFieldSeq) { Converter converter = null; m_recMerge = record; m_iFieldSeq = iFieldSeq; m_iSecondaryFieldSeq = iSecondaryFieldSeq; if (record != null) converter = this.getTargetField(null); super.init(converter, null); if (record != null) record.addListener(new RemoveConverterOnCloseHandler(this)); // Because this is a converter (not a fieldConverter) if (m_recMerge != null) if (m_recMerge.getTable() instanceof MultiTable) { // Add all the fields in the sub-records MultiTable multiTable = (MultiTable)m_recMerge.getTable(); Iterator<BaseTable> iterator = multiTable.getTables(); while (iterator.hasNext()) { BaseTable table = (BaseTable)iterator.next(); Converter field = this.getTargetField(table.getRecord()); this.addConverterToPass(field); // Add it, and } } } /**
/** * Init. * @param record The merge record. * @param iFieldSeq The sequence of the field in the target records. */ public void init(Record record, int iFieldSeq, int iSecondaryFieldSeq) { Converter converter = null; m_recMerge = record; m_iFieldSeq = iFieldSeq; m_iSecondaryFieldSeq = iSecondaryFieldSeq; if (record != null) converter = this.getTargetField(null); super.init(converter, null); if (record != null) record.addListener(new RemoveConverterOnCloseHandler(this)); // Because this is a converter (not a fieldConverter) if (m_recMerge != null) if (m_recMerge.getTable() instanceof MultiTable) { // Add all the fields in the sub-records MultiTable multiTable = (MultiTable)m_recMerge.getTable(); Iterator<BaseTable> iterator = multiTable.getTables(); while (iterator.hasNext()) { BaseTable table = (BaseTable)iterator.next(); Converter field = this.getTargetField(table.getRecord()); this.addConverterToPass(field); // Add it, and } } } /**
super.init(converter, null); if (record != null) record.addListener(new RemoveConverterOnCloseHandler(this)); // Because this is a converter (not a fieldConverter) if (m_recMerge != null) if (m_recMerge.getTable() instanceof MultiTable)
/** * 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); } /**
/** * 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); } /**