/** * Constructor. * @param field The basefield owner of this listener (usually null and set on setOwner()). * @param iTargetFieldSeq The date field sequence in this owner to use to calc the difference. * @param fldOtherDate The other date field to use in calculating the date difference. If null, uses the current time. */ public void init(BaseField field, String targetFieldName, NumberField fldTimeField) { m_fldTimeField = fldTimeField; super.init(field, targetFieldName, null); } /**
/** * 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 (owner != null) { if (m_fldTarget != null) if (m_fldTarget.getRecord() != this.getOwner().getRecord()) m_fldTarget.addListener(new FieldRemoveBOnCloseHandler(this)); // Not same file, if target file closes, remove this listener! if (this.getFieldTarget() != null) if (!(this.getFieldTarget().isVirtual()) && (!(this.getFieldTarget().getRecord() instanceof ScreenRecord))) if (this.respondsToMode(DBConstants.READ_MOVE) == true) if (this.respondsToMode(DBConstants.INIT_MOVE) == true) { // This is a performance issue if the field I'm updating is connected to a file this.setRespondsToMode(DBConstants.READ_MOVE, false); // Usually, you only want to recompute on screen change this.setRespondsToMode(DBConstants.INIT_MOVE, false); // Usually, you only want to recompute on screen change } } } /**
/** * The Field has Changed. * Get the value of this listener's owner, pass it to the computeValue method and * set the returned value to the target field. * @param bDisplayOption If true, display the change. * @param iMoveMode The type of move being done (init/read/screen). * @return The error code (or NORMAL_RETURN if okay). * Field changed, re-compute the value in this field. */ public int fieldChanged(boolean bDisplayOption, int iMoveMode) { double srcValue = ((NumberField)this.getOwner()).getValue(); BaseField fldTarget = this.getFieldTarget(); if (this.getOwner().isNull()) // If null, set the target to null return fldTarget.moveFieldToThis(this.getOwner(), bDisplayOption, iMoveMode); // zero out the field boolean[] rgbListeners = null; if (m_bDisableTarget) rgbListeners = fldTarget.setEnableListeners(false); int iErrorCode = fldTarget.setValue(this.computeValue(srcValue), bDisplayOption, iMoveMode); if (m_bDisableTarget) fldTarget.setEnableListeners(rgbListeners); return iErrorCode; } /**
/** * Get the field target. */ public BaseField getFieldTarget() { BaseField fldTarget = m_fldTarget; if (fldTarget == null) if (m_iTargetFieldSeq != -1) fldTarget = (NumberField)(this.getOwner().getRecord().getField(m_iTargetFieldSeq)); if (fldTarget == null) fldTarget = this.getOwner(); return fldTarget; } /**
/** * 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 (owner != null) { if (m_fldValue1 != null) if (m_fldValue1.getRecord() != this.getOwner().getRecord()) m_fldValue1.addListener(new FieldRemoveBOnCloseHandler(this)); // Not same file, if target file closes, remove this listener! if (m_fldValue2 != null) if (m_fldValue2.getRecord() != this.getOwner().getRecord()) if (m_fldValue2.getRecord() != m_fldValue1.getRecord()) m_fldValue2.addListener(new FieldRemoveBOnCloseHandler(this)); // Not same file, if target file closes, remove this listener! } } /**
/** * 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 (owner != null) { if (m_fldTarget != null) if (m_fldTarget.getRecord() != this.getOwner().getRecord()) m_fldTarget.addListener(new FieldRemoveBOnCloseHandler(this)); // Not same file, if target file closes, remove this listener! if (this.getFieldTarget() != null) if (!(this.getFieldTarget().isVirtual()) && (!(this.getFieldTarget().getRecord() instanceof ScreenRecord))) if (this.respondsToMode(DBConstants.READ_MOVE) == true) if (this.respondsToMode(DBConstants.INIT_MOVE) == true) { // This is a performance issue if the field I'm updating is connected to a file this.setRespondsToMode(DBConstants.READ_MOVE, false); // Usually, you only want to recompute on screen change this.setRespondsToMode(DBConstants.INIT_MOVE, false); // Usually, you only want to recompute on screen change } } } /**
/** * The Field has Changed. * Get the value of this listener's owner, pass it to the computeValue method and * set the returned value to the target field. * @param bDisplayOption If true, display the change. * @param iMoveMode The type of move being done (init/read/screen). * @return The error code (or NORMAL_RETURN if okay). * Field changed, re-compute the value in this field. */ public int fieldChanged(boolean bDisplayOption, int iMoveMode) { double srcValue = ((NumberField)this.getOwner()).getValue(); BaseField fldTarget = this.getFieldTarget(); if (this.getOwner().isNull()) // If null, set the target to null return fldTarget.moveFieldToThis(this.getOwner(), bDisplayOption, iMoveMode); // zero out the field boolean[] rgbListeners = null; if (m_bDisableTarget) rgbListeners = fldTarget.setEnableListeners(false); int iErrorCode = fldTarget.setValue(this.computeValue(srcValue), bDisplayOption, iMoveMode); if (m_bDisableTarget) fldTarget.setEnableListeners(rgbListeners); return iErrorCode; } /**
/** * Get the field target. */ public BaseField getFieldTarget() { BaseField fldTarget = m_fldTarget; if (fldTarget == null) if (targetFieldName != null) fldTarget = (NumberField)(this.getOwner().getRecord().getField(targetFieldName)); if (fldTarget == null) fldTarget = this.getOwner(); return fldTarget; } /**
/** * 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 (owner != null) { if (m_fldValue1 != null) if (m_fldValue1.getRecord() != this.getOwner().getRecord()) m_fldValue1.addListener(new FieldRemoveBOnCloseHandler(this)); // Not same file, if target file closes, remove this listener! if (m_fldValue2 != null) if (m_fldValue2.getRecord() != this.getOwner().getRecord()) if (m_fldValue2.getRecord() != m_fldValue1.getRecord()) m_fldValue2.addListener(new FieldRemoveBOnCloseHandler(this)); // Not same file, if target file closes, remove this listener! } } /**
/** * Constructor. * @param fldTarget The target field to recompute on field change. */ public ReComputeFieldHandler(BaseField fldTarget) { this(); this.init(null, null, fldTarget); } /**
/** * 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 (owner != null) { if (m_fldTarget != null) if (m_fldTarget.getRecord() != this.getOwner().getRecord()) m_fldTarget.addListener(new FieldRemoveBOnCloseHandler(this)); // Not same file, if target file closes, remove this listener! if (this.getFieldTarget() != null) if (!(this.getFieldTarget().isVirtual()) && (!(this.getFieldTarget().getRecord() instanceof ScreenRecord))) if (this.respondsToMode(DBConstants.READ_MOVE) == true) if (this.respondsToMode(DBConstants.INIT_MOVE) == true) { // This is a performance issue if the field I'm updating is connected to a file this.setRespondsToMode(DBConstants.READ_MOVE, false); // Usually, you only want to recompute on screen change this.setRespondsToMode(DBConstants.INIT_MOVE, false); // Usually, you only want to recompute on screen change } } } /**
/** * The Field has Changed. * Get the value of this listener's owner, pass it to the computeValue method and * set the returned value to the target field. * @param bDisplayOption If true, display the change. * @param iMoveMode The type of move being done (init/read/screen). * @return The error code (or NORMAL_RETURN if okay). * Field changed, re-compute the value in this field. */ public int fieldChanged(boolean bDisplayOption, int iMoveMode) { double srcValue = ((NumberField)this.getOwner()).getValue(); BaseField fldTarget = this.getFieldTarget(); if (this.getOwner().isNull()) // If null, set the target to null return fldTarget.moveFieldToThis(this.getOwner(), bDisplayOption, iMoveMode); // zero out the field boolean[] rgbListeners = null; if (m_bDisableTarget) rgbListeners = fldTarget.setEnableListeners(false); int iErrorCode = fldTarget.setValue(this.computeValue(srcValue), bDisplayOption, iMoveMode); if (m_bDisableTarget) fldTarget.setEnableListeners(rgbListeners); return iErrorCode; } /**
/** * Get the field target. */ public BaseField getFieldTarget() { BaseField fldTarget = m_fldTarget; if (fldTarget == null) if (m_iTargetFieldSeq != -1) fldTarget = (NumberField)(this.getOwner().getRecord().getField(m_iTargetFieldSeq)); if (fldTarget == null) fldTarget = this.getOwner(); return fldTarget; } /**
/** * 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 (owner != null) { if (m_fldValue1 != null) if (m_fldValue1.getRecord() != this.getOwner().getRecord()) m_fldValue1.addListener(new FieldRemoveBOnCloseHandler(this)); // Not same file, if target file closes, remove this listener! if (m_fldValue2 != null) if (m_fldValue2.getRecord() != this.getOwner().getRecord()) if (m_fldValue2.getRecord() != m_fldValue1.getRecord()) m_fldValue2.addListener(new FieldRemoveBOnCloseHandler(this)); // Not same file, if target file closes, remove this listener! } } /**
/** * Initialize class fields. */ public void init(BaseField field) { super.init(field); m_bInitMove = false; // Only respond to screen m_bReadMove = false; } /**
/** * Constructor. * @param field The basefield owner of this listener (usually null and set on setOwner()). * @param iTargetFieldSeq The date field sequence in this owner to use to calc the difference. * @param fldOtherDate The other date field to use in calculating the date difference. If null, uses the current time. */ public void init(BaseField field, String targetFieldName, DateTimeField fldOtherDate) { m_fldOtherDate = fldOtherDate; super.init(field, targetFieldName, null); } /**
/** * Constructor. * @param field The basefield owner of this listener (usually null and set on setOwner()). * @param iTargetFieldSeq The date field sequence in this owner to use to calc the difference. * @param fldOtherDate The other date field to use in calculating the date difference. If null, uses the current time. */ public void init(BaseField field, int iTargetFieldSeq, DateTimeField fldOtherDate) { m_fldOtherDate = fldOtherDate; super.init(field, iTargetFieldSeq, null); } /**
/** * Constructor. * @param fldTarget The target field to recompute on field change. */ public ReComputeFieldHandler(BaseField fldTarget) { this(); this.init(null, -1, fldTarget); } /**
/** * Constructor. * @param iTargetFieldSeq The target field sequence to recompute on field change. */ public ReComputeFieldHandler(String targetFieldName) { this(); this.init(null, targetFieldName, null); } /**
/** * Constructor. * @param field The basefield owner of this listener (usually null and set on setOwner()). * @param iTargetFieldSeq The date field sequence in this owner to use to calc the difference. * @param fldOtherDate The other date field to use in calculating the date difference. If null, uses the current time. */ public void init(BaseField field, int iTargetFieldSeq, NumberField fldTimeField) { m_fldTimeField = fldTimeField; super.init(field, iTargetFieldSeq, null); } /**