/** * For binary fields, return the current state. * @retrun The state. */ public boolean getState() { if (this.getValue() == 0) return false; else return true; } /**
/** * For binary fields, set the current state. * @param state The state to set this field. * @param bDisplayOption Display changed fields if true. * @param iMoveMode The move mode. * @return The error code (or NORMAL_RETURN). */ public int setState(boolean state, boolean bDisplayOption, int moveMode) { double value = 0; if (state) value = 1; return this.setValue(value, bDisplayOption, moveMode); // Move value to this field } /**
/** * Retrieve (in string format) from this field. * Data is already in binary format, so convert it and return the string. * @return This field as a string. */ public String getString() { Object tempBinary = this.getData(); // Get the physical data if (tempBinary != null) return this.binaryToString(tempBinary); else return Constants.BLANK; // Clear BaseField } /**
/** * Convert the display's index to the field value and move to field. * @param index The index to convert an set this field to. * @param bDisplayOption If true, display the change in the converters. * @param iMoveMove The type of move. */ public int convertIndexToField(int index, boolean bDisplayOption, int iMoveMode) { return this.setValue(this.convertIndexToValue(index), bDisplayOption, iMoveMode); // Convert to value and move to this field } /**
/** * Convert the field's code to the display's index (for popup). * @return The value in this field to a 0 based index in a table. */ public int convertFieldToIndex() { return this.convertValueToIndex(this.getValue()); // Convert this field to an index and return } /**
Record screenQuery = this.getScreenRecord(); if (((NumberField)screenQuery.getField(TourHeaderScreenRecord.KEY_ORDER)).getValue() > 2) ((NumberField)screenQuery.getField(TourHeaderScreenRecord.KEY_ORDER)).setValue(0); FieldListener behCheckRange = new CheckRangeHandler(0, 2); screenQuery.getField(TourHeaderScreenRecord.KEY_ORDER).addListener(behCheckRange);
field.displayField(); return DBConstants.NORMAL_RETURN; // Must type a zero, if you want a zero Object tempBinary = field.stringToBinary(string); double dValue = ((Double)tempBinary).doubleValue(); tempBinary = new Double(-dValue); // Positive representation return field.setData(tempBinary, bDisplayOption, moveMode); } catch (Exception ex) { String strError = ex.getMessage();
/** * Compare field to this and return < > or = (-,+,0). * @return compare value. */ public int compareTo(Field field) { if (field instanceof BaseField) if (!this.isSameType((BaseField)field)) return super.compareTo(field); m_calendar.set(DBConstants.FIRST_YEAR, Calendar.JANUARY, 1, 0, 0, 0); java.util.Date dateSmall = m_calendar.getTime(); java.util.Date time1 = dateSmall; java.util.Date time2 = dateSmall; java.util.Date dateValue = (java.util.Date)this.getData(); // Get the physical data if (dateValue != null) time1 = dateValue; dateValue = (java.util.Date)field.getData(); // Get the physical data if (dateValue != null) time2 = dateValue; return time1.compareTo(time2); } /**
/** * Convert and move string to this field. * Convert this string to an index and set the index value. * Override this method to convert the String to the actual Physical Data Type. * @param strString 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 fieldPtr, boolean bDisplayOption, int moveMode) // init this field override for other value { int index = ((NumberField)this.getNextConverter()).convertStringToIndex(fieldPtr); return this.getNextConverter().setValue(index, bDisplayOption, moveMode); } }
/** * 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. */ public String getString() { String string = super.getString(); // By default, get the data as-is if (this.getField() instanceof NumberField) { double dValue = this.getField().getValue(); if (m_bDebit) { if (dValue < 0) string = Constants.BLANK; // For debit/negative, return a null } else { // Credit if (dValue >= 0) string = Constants.BLANK; // For credit/positive, return a null else string = ((NumberField)this.getField()).binaryToString(new Double(-dValue)); // Positive representation } } return string; } /**
Record screenQuery = this.getScreenRecord(); if (((NumberField)screenQuery.getField(TourHeaderScreenRecord.KEY_ORDER)).getValue() > 2) ((NumberField)screenQuery.getField(TourHeaderScreenRecord.KEY_ORDER)).setValue(0); FieldListener behCheckRange = new CheckRangeHandler(0, 2); screenQuery.getField(TourHeaderScreenRecord.KEY_ORDER).addListener(behCheckRange);
/** * Convert the display's index to the field value and move to field. * @param index The index to convert an set this field to. * @param bDisplayOption If true, display the change in the converters. * @param iMoveMove The type of move. */ public int convertIndexToField(int index, boolean bDisplayOption, int iMoveMode) { return this.setValue(this.convertIndexToValue(index), bDisplayOption, iMoveMode); // Convert to value and move to this field } /**
/** * Convert the field's code to the display's index (for popup). * @return The value in this field to a 0 based index in a table. */ public int convertFieldToIndex() { return this.convertValueToIndex(this.getValue()); // Convert this field to an index and return } /**
field.displayField(); return DBConstants.NORMAL_RETURN; // Must type a zero, if you want a zero Object tempBinary = field.stringToBinary(string); double dValue = ((Double)tempBinary).doubleValue(); tempBinary = new Double(-dValue); // Positive representation return field.setData(tempBinary, bDisplayOption, moveMode); } catch (Exception ex) { String strError = ex.getMessage();
/** * Compare field to this and return < > or = (-,+,0). * @return compare value. */ public int compareTo(Field field) { if (field instanceof BaseField) if (!this.isSameType((BaseField)field)) return super.compareTo(field); m_calendar.set(DBConstants.FIRST_YEAR, Calendar.JANUARY, 1, 0, 0, 0); java.util.Date dateSmall = m_calendar.getTime(); java.util.Date time1 = dateSmall; java.util.Date time2 = dateSmall; java.util.Date dateValue = (java.util.Date)this.getData(); // Get the physical data if (dateValue != null) time1 = dateValue; dateValue = (java.util.Date)field.getData(); // Get the physical data if (dateValue != null) time2 = dateValue; return time1.compareTo(time2); } /**
/** * Convert and move string to this field. * Convert this string to an index and set the index value. * Override this method to convert the String to the actual Physical Data Type. * @param strString 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 fieldPtr, boolean bDisplayOption, int moveMode) // init this field override for other value { int index = ((NumberField)this.getNextConverter()).convertStringToIndex(fieldPtr); return this.getNextConverter().setValue(index, bDisplayOption, moveMode); } }
/** * 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. */ public String getString() { String string = super.getString(); // By default, get the data as-is if (this.getField() instanceof NumberField) { double dValue = this.getField().getValue(); if (m_bDebit) { if (dValue < 0) string = Constants.BLANK; // For debit/negative, return a null } else { // Credit if (dValue >= 0) string = Constants.BLANK; // For credit/positive, return a null else string = ((NumberField)this.getField()).binaryToString(new Double(-dValue)); // Positive representation } } return string; } /**
/** * For binary fields, return the current state. * @retrun The state. */ public boolean getState() { if (this.getValue() == 0) return false; else return true; } /**