/** * Creates a new object of the same class as this object. * @return a clone of this instance. * @exception CloneNotSupportedException if the object's class does not support the <code>Cloneable</code> interface. * @see java.lang.Cloneable */ public Object clone() throws CloneNotSupportedException { DisplayReadHandler listener = new DisplayReadHandler(); listener.init(null, m_iMainField, m_FileToRead, m_iFileKeyField); return listener; } /**
/** * Set the object that owns this listener. * @owner The object 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) { m_pBookingComm.addListener(new FieldRemoveBOnCloseHandler(this)); m_pAmAffil = new Affiliation(null); // Make sure close in screen change FileListener pSecondary = new DisplayReadHandler(Profile.AFFILIATION_ID, m_pAmAffil, Affiliation.ID); Record pAmAgcy = this.getOwner(); pAmAgcy.addListener(pSecondary); } else { if (m_pAmAffil != null) { m_pAmAffil.free(); m_pAmAffil = null; } } } /**
/** * Constructor. * @param iMainField The field to use as a key in the file to read. * @param fileToRead The secondary file to read when I read a record from the owner (onvalidrecord). * @param iFileKeyField The key field in the secondary file. */ public DisplayReadHandler(String mainFieldName, Record fileToRead, String fileKeyAreaName) { this(); this.init(null, mainFieldName, fileToRead, -1, fileKeyAreaName); } /**
/** * Set the record that owns this listener. * If a record is passed in, this method makes sure the correct key area is set on this record. * @param owner My owner. */ public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (owner != null) { if (m_iMainField == -1) m_fldMain = this.getOwner().getReferenceField(m_FileToRead); m_FileToRead.setKeyArea(m_FileToRead.getField(m_iFileKeyField)); } } /**
recTour.addListener(new TourChangeHandler(recBooking)); recTour.addListener(new DisplayReadHandler(Tour.TOUR_HEADER_ID, recTourHdr, TourHeader.ID)); recTour.getField(Tour.TOUR_HEADER_ID).addListener(new MainReadOnlyHandler(null)); recBooking.addControlDefaults(recBookingControl, recProfileControl);
/** * Constructor. * @param iMainField The field to use as a key in the file to read. * @param fileToRead The secondary file to read when I read a record from the owner (onvalidrecord). * @param iFileKeyField The key field in the secondary file. */ public DisplayReadHandler(int iMainField, Record fileToRead, int iFileKeyField) { this(); this.init(null, iMainField, fileToRead, iFileKeyField); } /**
/** * Set the record that owns this listener. * If a record is passed in, this method makes sure the correct key area is set on this record. * @param owner My owner. */ public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (owner != null) { if (m_iMainField == -1) m_fldMain = this.getOwner().getReferenceField(m_FileToRead); m_FileToRead.setKeyArea(m_FileToRead.getField(m_iFileKeyField)); } } /**
/** * Creates a new object of the same class as this object. * @return a clone of this instance. * @exception CloneNotSupportedException if the object's class does not support the <code>Cloneable</code> interface. * @see java.lang.Cloneable */ public Object clone() throws CloneNotSupportedException { DisplayReadHandler listener = new DisplayReadHandler(); listener.init(null, mainFieldName, m_FileToRead, m_iFileKeyField, fileKeyFieldName); return listener; } /**
recTour.addListener(new DisplayReadHandler(Tour.TOUR_HEADER_ID, recTourHdr, TourHeader.ID)); recTour.getField(Tour.TOUR_HEADER_ID).addListener(new MainReadOnlyHandler(null)); recBooking.addControlDefaults(recBookingControl, recProfileControl);
/** * Constructor. * @param iMainField The field to use as a key in the file to read. * @param fileToRead The secondary file to read when I read a record from the owner (onvalidrecord). * @param iFileKeyField The key field in the secondary file. */ public DisplayReadHandler(Record fileToRead) { this(); this.init(null, null, fileToRead, DBConstants.MAIN_FIELD, null); } /**
/** * Set the record that owns this listener. * If a record is passed in, this method makes sure the correct key area is set on this record. * @param owner My owner. */ public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (owner != null) { if (mainFieldName == null) m_fldMain = this.getOwner().getReferenceField(m_FileToRead); if (fileKeyFieldName != null) m_FileToRead.setKeyArea(m_FileToRead.getField(fileKeyFieldName)); else m_FileToRead.setKeyArea(m_FileToRead.getField(m_iFileKeyField)); } } /**
/** * Creates a new object of the same class as this object. * @return a clone of this instance. * @exception CloneNotSupportedException if the object's class does not support the <code>Cloneable</code> interface. * @see java.lang.Cloneable */ public Object clone() throws CloneNotSupportedException { DisplayReadHandler listener = new DisplayReadHandler(); listener.init(null, m_iMainField, m_FileToRead, m_iFileKeyField); return listener; } /**
recTourHeader.addListener(fileBeh = new DisplayReadHandler(TourHeader.TOUR_CLASS_ID, this.getRecord(TourClass.TOUR_CLASS_FILE), TourClass.ID)); recInventory.addListener(new FileRemoveBOnCloseHandler(fileBeh)); fileBeh = new EnableOnValidHandler(true, false);
/** * Constructor. * @param iMainField The field to use as a key in the file to read. * @param fileToRead The secondary file to read when I read a record from the owner (onvalidrecord). * @param iFileKeyField The key field in the secondary file. */ public DisplayReadHandler(Record fileToRead) { this(); this.init(null, -1, fileToRead, DBConstants.MAIN_FIELD); } /**
/** * Called when a valid record is read from the table/query. * Reads the secondary record and set's the record not found message if not found. * @param bDisplayOption If true, display any changes. */ public void doValidRecord(boolean bDisplayOption) { if (m_fldMain == null) m_fldMain = this.getOwner().getField(m_iMainField); if (m_fldMain == null) return; // Error - Field not found? m_FileToRead.getField(m_iFileKeyField).moveFieldToThis(m_fldMain, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // SCREEN_MOVE says this is coming from here try { boolean bSuccess = m_FileToRead.seek("="); if (!bSuccess) { m_FileToRead.initRecord(bDisplayOption); // Put's record in an indeterminate state (so this record won't be written) and clears the fields. BaseField nextField = m_FileToRead.getField(m_iFileKeyField+1); String strRecNotFound = this.getOwner().getTable().getString(RECORD_NOT_FOUND_MESSAGE); if (nextField instanceof StringField) nextField.setString(strRecNotFound, bDisplayOption, DBConstants.SCREEN_MOVE); } } catch (DBException ex) { ex.printStackTrace(); } super.doValidRecord(bDisplayOption); } /**
/** * Constructor. * @param iMainField The field to use as a key in the file to read. * @param fileToRead The secondary file to read when I read a record from the owner (onvalidrecord). * @param iFileKeyField The key field in the secondary file. */ public DisplayReadHandler(int iMainField, Record fileToRead, int iFileKeyField) { this(); this.init(null, iMainField, fileToRead, iFileKeyField); } /**
/** * Called when a valid record is read from the table/query. * Reads the secondary record and set's the record not found message if not found. * @param bDisplayOption If true, display any changes. */ public void doValidRecord(boolean bDisplayOption) { if (m_fldMain == null) m_fldMain = this.getOwner().getField(m_iMainField); if (m_fldMain == null) return; // Error - Field not found? m_FileToRead.getField(m_iFileKeyField).moveFieldToThis(m_fldMain, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // SCREEN_MOVE says this is coming from here try { boolean bSuccess = m_FileToRead.seek("="); if (!bSuccess) { m_FileToRead.initRecord(bDisplayOption); // Put's record in an indeterminate state (so this record won't be written) and clears the fields. BaseField nextField = m_FileToRead.getField(m_iFileKeyField+1); String strRecNotFound = this.getOwner().getTable().getString(RECORD_NOT_FOUND_MESSAGE); if (nextField instanceof StringField) nextField.setString(strRecNotFound, bDisplayOption, DBConstants.SCREEN_MOVE); } } catch (DBException ex) { ex.printStackTrace(); } super.doValidRecord(bDisplayOption); } /**
/** * Constructor. * @param iMainField The field to use as a key in the file to read. * @param fileToRead The secondary file to read when I read a record from the owner (onvalidrecord). * @param iFileKeyField The key field in the secondary file. */ public DisplayReadHandler(Record fileToRead) { this(); this.init(null, -1, fileToRead, DBConstants.MAIN_FIELD); } /**
m_fldMain = this.getOwner().getField(mainFieldName); if (m_fldMain == null) return; // Error - Field not found? String strRecNotFound = this.getOwner().getTable().getString(RECORD_NOT_FOUND_MESSAGE); if (nextField instanceof StringField) nextField.setString(strRecNotFound, bDisplayOption, DBConstants.SCREEN_MOVE);