/** * Constructor. * @param numberField The converter to display the recriprical of. */ public RecipFieldConverter(NumberField numberField) { this(); this.init(numberField); } /**
/** * Retrieve (in string format) from this field. * @return The string of the recriprical of this field's value. */ public String getString() { String string = Constants.BLANK; NumberField numberField = (NumberField)this.getField(); if (this.getNextConverter().getLength() != 0) { double dValue = this.getValue(); if (dValue != 0) dValue = 1 / dValue; if (m_mfRecip == null) m_mfRecip = NumberFormat.getInstance(); m_mfRecip.setMinimumFractionDigits(numberField.getScale()); m_mfRecip.setMaximumFractionDigits(numberField.getScale()); string = m_mfRecip.format(dValue); } return string; } /**
/** * Convert and move string to this field. * Get the recriprical of this string and set the string. * @param bState the state to set the data to. * @param bDisplayOption Display the data on the screen if true. * @param iMoveMode INIT, SCREEN, or READ move mode. * @return The error code (or NORMAL_RETURN). */ public int setString( String strField, boolean bDisplayOption, int iMoveMode) { NumberField numberField = (NumberField)this.getNextConverter(); int iErrorCode = super.setString(strField, DBConstants.DONT_DISPLAY, iMoveMode); if (strField.length() == 0) numberField.displayField(); // Special Case (because we return immediately) if ((iErrorCode != DBConstants.NORMAL_RETURN) || strField.length() == 0) return iErrorCode; double doubleValue = this.getValue(); if (doubleValue != 0) doubleValue = 1 / doubleValue; iErrorCode = this.setValue(doubleValue, bDisplayOption, DBConstants.SCREEN_MOVE); return iErrorCode; } }
/** * Set up all the screen fields. */ public void setupSFields() { this.getRecord(Currencys.CURRENCYS_FILE).getField(Currencys.CURRENCY_CODE).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY); this.getRecord(Currencys.CURRENCYS_FILE).getField(Currencys.DESCRIPTION).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY); Record query = this.getMainRecord(); for (int fieldSeq = query.getFieldSeq(Currencys.LAST_RATE); fieldSeq <= query.getFieldSeq(Currencys.LANGUAGE_ID); fieldSeq++) { query.getField(fieldSeq).setupFieldView(this); if ((fieldSeq == query.getFieldSeq(Currencys.LAST_RATE)) || (fieldSeq == query.getFieldSeq(Currencys.COSTING_RATE))) { ScreenLocation lastFieldPosition = this.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR); RecipFieldConverter converter = new RecipFieldConverter((NumberField)query.getField(fieldSeq)); SEditText nameView = new SEditText(lastFieldPosition, this, converter, ScreenConstants.DONT_DISPLAY_FIELD_DESC); } } }
/** * Retrieve (in string format) from this field. * @return The string of the recriprical of this field's value. */ public String getString() { String string = Constants.BLANK; NumberField numberField = (NumberField)this.getField(); if (this.getNextConverter().getLength() != 0) { double dValue = this.getValue(); if (dValue != 0) dValue = 1 / dValue; if (m_mfRecip == null) m_mfRecip = NumberFormat.getInstance(); m_mfRecip.setMinimumFractionDigits(numberField.getScale()); m_mfRecip.setMaximumFractionDigits(numberField.getScale()); string = m_mfRecip.format(dValue); } return string; } /**
/** * Convert and move string to this field. * Get the recriprical of this string and set the string. * @param bState the state to set the data to. * @param bDisplayOption Display the data on the screen if true. * @param iMoveMode INIT, SCREEN, or READ move mode. * @return The error code (or NORMAL_RETURN). */ public int setString( String strField, boolean bDisplayOption, int iMoveMode) { NumberField numberField = (NumberField)this.getNextConverter(); int iErrorCode = super.setString(strField, DBConstants.DONT_DISPLAY, iMoveMode); if (strField.length() == 0) numberField.displayField(); // Special Case (because we return immediately) if ((iErrorCode != DBConstants.NORMAL_RETURN) || strField.length() == 0) return iErrorCode; double doubleValue = this.getValue(); if (doubleValue != 0) doubleValue = 1 / doubleValue; iErrorCode = this.setValue(doubleValue, bDisplayOption, DBConstants.SCREEN_MOVE); return iErrorCode; } }
/** * Retrieve (in string format) from this field. * @return The string of the recriprical of this field's value. */ public String getString() { String string = Constants.BLANK; NumberField numberField = (NumberField)this.getField(); if (this.getNextConverter().getLength() != 0) { double dValue = this.getValue(); if (dValue != 0) dValue = 1 / dValue; if (m_mfRecip == null) m_mfRecip = NumberFormat.getInstance(); m_mfRecip.setMinimumFractionDigits(numberField.getScale()); m_mfRecip.setMaximumFractionDigits(numberField.getScale()); string = m_mfRecip.format(dValue); } return string; } /**
/** * Convert and move string to this field. * Get the recriprical of this string and set the string. * @param bState the state to set the data to. * @param bDisplayOption Display the data on the screen if true. * @param iMoveMode INIT, SCREEN, or READ move mode. * @return The error code (or NORMAL_RETURN). */ public int setString( String strField, boolean bDisplayOption, int iMoveMode) { NumberField numberField = (NumberField)this.getNextConverter(); int iErrorCode = super.setString(strField, DBConstants.DONT_DISPLAY, iMoveMode); if (strField.length() == 0) numberField.displayField(); // Special Case (because we return immediately) if ((iErrorCode != DBConstants.NORMAL_RETURN) || strField.length() == 0) return iErrorCode; double doubleValue = this.getValue(); if (doubleValue != 0) doubleValue = 1 / doubleValue; iErrorCode = this.setValue(doubleValue, bDisplayOption, DBConstants.SCREEN_MOVE); return iErrorCode; } }
/** * Constructor. * @param numberField The converter to display the recriprical of. */ public RecipFieldConverter(NumberField numberField) { this(); this.init(numberField); } /**
/** * Constructor. * @param numberField The converter to display the recriprical of. */ public RecipFieldConverter(NumberField numberField) { this(); this.init(numberField); } /**