/** * Set the field that owns this listener. * @owner The field that this listener is being added to (if null, this listener is being removed). */ public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (this.getOwner() != null) { if (m_fldSource != null) if (m_fldSource.getRecord() != this.getOwner().getRecord()) m_fldSource.getRecord().addListener(new FileRemoveBOnCloseHandler(this)); // Not same file, if target file closes, remove this listener! InitOnceFieldHandler behavior = (InitOnceFieldHandler)this.getOwner().getListener(InitOnceFieldHandler.class.getName()); if (this.getOwner().getRecord().getEditMode() == DBConstants.EDIT_CURRENT) behavior = null; // Special case - if there is a current record, make sure initonce works. if (behavior != null) behavior.setFirstTime(true); // If this listener exists it doesn't init initially everything up, so disable for a sec. this.syncBehaviorToRecord(null); // Init now if (this.getOwner() instanceof ReferenceField) if (this.getOwner().getListener(ReadSecondaryHandler.class.getName()) != null) { if (behavior != null) behavior.setEnabledListener(false); // If this listener exists it doesn't init initially everything up, so disable for a sec. ((FieldListener)this.getOwner().getListener(ReadSecondaryHandler.class.getName())).syncBehaviorToRecord(null); } } } /**
/** * Set this cloned listener to the same state at this listener. * @param field The field this new listener will be added to. * @param The new listener to sync to this. * @param Has the init method been called? * @return True if I called init. */ public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled) { if (!bInitCalled) { BaseField fldSource = this.getSyncedListenersField(m_fldSource, listener); ((InitFieldHandler)listener).init(null, fldSource, m_objSource, m_bInitIfSourceNull, m_bOnlyInitIfDestNull); } return super.syncClonedListener(field, listener, true); } /**
/** * Add all the screen listeners. */ public void addListeners() { super.addListeners(); this.getMainRecord().getField(LandPricing.RATE_ID).addListener(new InitFieldHandler(this.getRecord(ProductControl.PRODUCT_CONTROL_FILE).getField(ProductControl.LAND_RATE_ID))); this.getMainRecord().getField(LandPricing.CLASS_ID).addListener(new InitFieldHandler(this.getRecord(ProductControl.PRODUCT_CONTROL_FILE).getField(ProductControl.LAND_CLASS_ID))); this.getMainRecord().getField(LandPricing.LAND_VARIES_ID).addListener(new InitFieldHandler(this.getRecord(ProductControl.PRODUCT_CONTROL_FILE).getField(ProductControl.VARIES_ON))); this.getMainRecord().getField(LandPricing.PRODUCT_TERMS_ID).addListener(new InitFieldHandler(this.getRecord(ProductControl.PRODUCT_CONTROL_FILE).getField(ProductControl.PRODUCT_TERMS_ID))); } /**
/** * Constructor. * @param objSource The source string to initialize the field owner to. */ public InitFieldHandler(Object objSource) { this(); this.init(null, null, objSource, true, false); } /**
|| (m_bOnlyInitIfDestNull == true) && (this.getOwner().isNull()))) boolean bModified = this.getOwner().isModified(); int iErrorCode = this.getOwner().moveFieldToThis(m_fldSource, bDisplayOption, iMoveMode); this.getOwner().setModified(bModified); return iErrorCode; return this.getOwner().setString(m_objSource.toString(), bDisplayOption, iMoveMode); else return this.getOwner().setData(m_objSource, bDisplayOption, iMoveMode);
return super.fieldChanged(bDisplayOption, iMoveMode);
/** * Add all the screen listeners. */ public void addListeners() { super.addListeners(); this.getMainRecord().getField(LandPricing.RATE_ID).addListener(new InitFieldHandler(this.getRecord(ProductControl.PRODUCT_CONTROL_FILE).getField(ProductControl.LAND_RATE_ID))); this.getMainRecord().getField(LandPricing.CLASS_ID).addListener(new InitFieldHandler(this.getRecord(ProductControl.PRODUCT_CONTROL_FILE).getField(ProductControl.LAND_CLASS_ID))); this.getMainRecord().getField(LandPricing.LAND_VARIES_ID).addListener(new InitFieldHandler(this.getRecord(ProductControl.PRODUCT_CONTROL_FILE).getField(ProductControl.VARIES_ON))); this.getMainRecord().getField(LandPricing.PRODUCT_TERMS_ID).addListener(new InitFieldHandler(this.getRecord(ProductControl.PRODUCT_CONTROL_FILE).getField(ProductControl.PRODUCT_TERMS_ID))); } /**
/** * Constructor. * @param sourceField The source field to initialize the field owner to. */ public InitFieldHandler(BaseField sourceField, boolean bInitIfSourceNull) { this(); this.init(null, sourceField, null, bInitIfSourceNull, false); } /**
|| (m_bOnlyInitIfDestNull == true) && (this.getOwner().isNull()))) boolean bModified = this.getOwner().isModified(); int iErrorCode = this.getOwner().moveFieldToThis(m_fldSource, bDisplayOption, iMoveMode); this.getOwner().setModified(bModified); return iErrorCode; return this.getOwner().setString(m_objSource.toString(), bDisplayOption, iMoveMode); else return this.getOwner().setData(m_objSource, bDisplayOption, iMoveMode);
return super.fieldChanged(bDisplayOption, iMoveMode);
/** * Add all the screen listeners. */ public void addListeners() { super.addListeners(); this.getMainRecord().getField(Appointment.kCalendarCategoryID).addListener(new InitFieldHandler(this.getRecord(CalendarControl.kCalendarControlFile).getField(CalendarControl.kAppointmentCategoryID))); } /**
/** * Constructor. * @param sourceField The source field to initialize the field owner to. */ public InitFieldHandler(BaseField sourceField, boolean bInitIfSourceNull, boolean bOnlyInitIfDestNull) { this(); this.init(null, sourceField, null, bInitIfSourceNull, bOnlyInitIfDestNull); } /**
/** * Set this cloned listener to the same state at this listener. * @param field The field this new listener will be added to. * @param The new listener to sync to this. * @param Has the init method been called? * @return True if I called init. */ public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled) { if (!bInitCalled) { BaseField fldSource = this.getSyncedListenersField(m_fldSource, listener); ((InitFieldHandler)listener).init(null, fldSource, m_objSource, m_bInitIfSourceNull, m_bOnlyInitIfDestNull); } return super.syncClonedListener(field, listener, true); } /**
/** * Set the field that owns this listener. * @owner The field that this listener is being added to (if null, this listener is being removed). */ public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (this.getOwner() != null) { if (m_fldSource != null) if (m_fldSource.getRecord() != this.getOwner().getRecord()) m_fldSource.getRecord().addListener(new FileRemoveBOnCloseHandler(this)); // Not same file, if target file closes, remove this listener! InitOnceFieldHandler behavior = (InitOnceFieldHandler)this.getOwner().getListener(InitOnceFieldHandler.class.getName()); if (this.getOwner().getRecord().getEditMode() == DBConstants.EDIT_CURRENT) behavior = null; // Special case - if there is a current record, make sure initonce works. if (behavior != null) behavior.setFirstTime(true); // If this listener exists it doesn't init initially everything up, so disable for a sec. this.syncBehaviorToRecord(null); // Init now if (this.getOwner() instanceof ReferenceField) if (this.getOwner().getListener(ReadSecondaryHandler.class.getName()) != null) { if (behavior != null) behavior.setEnabledListener(false); // If this listener exists it doesn't init initially everything up, so disable for a sec. ((FieldListener)this.getOwner().getListener(ReadSecondaryHandler.class.getName())).syncBehaviorToRecord(null); } } } /**
|| (m_bOnlyInitIfDestNull == true) && (this.getOwner().isNull()))) boolean bModified = this.getOwner().isModified(); int iErrorCode = this.getOwner().moveFieldToThis(m_fldSource, bDisplayOption, iMoveMode); this.getOwner().setModified(bModified); return iErrorCode; return this.getOwner().setString(m_objSource.toString(), bDisplayOption, iMoveMode); else return this.getOwner().setData(m_objSource, bDisplayOption, iMoveMode);
return super.fieldChanged(bDisplayOption, iMoveMode);
/** * Add all the screen listeners. */ public void addListeners() { super.addListeners(); this.getMainRecord().getField(AnnivMaster.kCalendarCategoryID).addListener(new InitFieldHandler(this.getRecord(CalendarControl.kCalendarControlFile).getField(CalendarControl.kAnniversaryCategoryID))); }
/** * Constructor. * @param objSource The source string to initialize the field owner to. */ public InitFieldHandler(Object objSource) { this(); this.init(null, null, objSource, true, false); } /**
/** * Set this cloned listener to the same state at this listener. * @param field The field this new listener will be added to. * @param The new listener to sync to this. * @param Has the init method been called? * @return True if I called init. */ public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled) { if (!bInitCalled) { BaseField fldSource = this.getSyncedListenersField(m_fldSource, listener); ((InitFieldHandler)listener).init(null, fldSource, m_objSource, m_bInitIfSourceNull, m_bOnlyInitIfDestNull); } return super.syncClonedListener(field, listener, true); } /**
/** * Set the field that owns this listener. * @owner The field that this listener is being added to (if null, this listener is being removed). */ public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (this.getOwner() != null) { if (m_fldSource != null) if (m_fldSource.getRecord() != this.getOwner().getRecord()) m_fldSource.getRecord().addListener(new FileRemoveBOnCloseHandler(this)); // Not same file, if target file closes, remove this listener! InitOnceFieldHandler behavior = (InitOnceFieldHandler)this.getOwner().getListener(InitOnceFieldHandler.class.getName()); if (this.getOwner().getRecord().getEditMode() == DBConstants.EDIT_CURRENT) behavior = null; // Special case - if there is a current record, make sure initonce works. if (behavior != null) behavior.setFirstTime(true); // If this listener exists it doesn't init initially everything up, so disable for a sec. this.syncBehaviorToRecord(null); // Init now if (this.getOwner() instanceof ReferenceField) if (this.getOwner().getListener(ReadSecondaryHandler.class.getName()) != null) { if (behavior != null) behavior.setEnabledListener(false); // If this listener exists it doesn't init initially everything up, so disable for a sec. ((FieldListener)this.getOwner().getListener(ReadSecondaryHandler.class.getName())).syncBehaviorToRecord(null); } } } /**