/** * Number of Fields in this record. * @return The current field count. */ public int size() { return this.getFieldCount(); } /**
/** * Get this field in the record. * @param strFieldName The field name to find. * @return The field at this position (Or null if past end of records). */ public FieldInfo getField(String strFieldName) // Lookup this field { boolean bAddQuotes = false; if (strFieldName != null) if (strFieldName.length() > 0) if (strFieldName.charAt(0) == '\"') bAddQuotes = true; for (int i = 0; i < this.getFieldCount(); i++) { FieldInfo field = this.getField(i); if (field.getFieldName(bAddQuotes, false).toString().equalsIgnoreCase(strFieldName)) // Don't add quotes on compare return field; } return null; // Not found } /**
/** * Convert this record to a string. * @return A string of all the fields. */ public String toString() { String string = Constants.BLANK; for (int iFieldSeq = Constants.MAIN_FIELD; iFieldSeq <= this.getFieldCount() + Constants.MAIN_FIELD - 1; iFieldSeq++) { FieldInfo field = this.getField(iFieldSeq); string += field.toString() + '\n'; } string += '\n'; return string; } /**
/** * Copy the data in this record to the thin version. * @param fieldList */ public final void copyAllFields(Record record, FieldList fieldList) { for (int i = 0; i < fieldList.getFieldCount(); i++) { FieldInfo fieldInfo = fieldList.getField(i); BaseField field = record.getField(i); this.moveFieldToThin(fieldInfo, field, record); } } /**
/** * Copy the data in this record to the thin version. * @param fieldList */ public final void copyAllFields(Record record, FieldList fieldList) { for (int i = 0; i < fieldList.getFieldCount(); i++) { FieldInfo fieldInfo = fieldList.getField(i); BaseField field = record.getField(i); this.moveFieldToThin(fieldInfo, field, record); } } /**
/** * Copy the data in this record to the thin version. * @param fieldList */ public final void copyAllFields(Record record, FieldList fieldList) { for (int i = 0; i < fieldList.getFieldCount(); i++) { FieldInfo fieldInfo = fieldList.getField(i); BaseField field = record.getField(i); this.moveFieldToThin(fieldInfo, field, record); } } /**
/** * Reset all the fields to their default value. * <p />NOTE: After executing, this records edit mode is set to NONE. * @param bDisplay The the new values (on work in the thick model). * @throws Exception An exception on initing a field. */ public void initRecord(boolean bDisplay) throws DBException { int iFieldCount = this.getFieldCount(); // Number of fields to read in for (int iFieldSeq = Constants.MAIN_FIELD; iFieldSeq < iFieldCount + Constants.MAIN_FIELD; iFieldSeq++) { FieldInfo field = this.getField(iFieldSeq); field.initField(bDisplay); } this.setEditMode(Constants.EDIT_NONE); } /**
/** * */ private void copyFieldList(FieldList fieldList, FieldList item) { for (int i = 0; i < item.getFieldCount(); i++) { FieldInfo fldSource = item.getField(i); FieldInfo fldDest = fieldList.getField(i); fldDest.setData(fldSource.getData(), Constants.DISPLAY, Constants.READ_MOVE); } } /**
/** * Compare this output buffer to all the fields. * This is a utility method that compares the record. * @param record The target record. * @return True if they are equal. */ public boolean compareToBuffer(FieldList record) { boolean bBufferEqual = true; this.resetPosition(); // Start at the first field int iFieldCount = record.getFieldCount(); // Number of fields to read in for (int iFieldSeq = Constants.MAIN_FIELD; iFieldSeq <= iFieldCount + Constants.MAIN_FIELD - 1; iFieldSeq++) { FieldInfo field = record.getField(iFieldSeq); if (!this.skipField(field)) bBufferEqual = this.compareNextToField(field); if (!bBufferEqual) break; } return bBufferEqual; } /**
/** * Move the output buffer to all the fields. * This is a utility method that populates the record. * @param record The target record. * @param bDisplayOption The display option for the movetofield call. * @param iMoveMove The move mode for the movetofield call. * @return The error code. */ public int bufferToFields(FieldList record, boolean bDisplayOption, int iMoveMode) { this.resetPosition(); // Start at the first field int iFieldCount = record.getFieldCount(); // Number of fields to read in int iErrorCode = Constants.NORMAL_RETURN; int iTempError; for (int iFieldSeq = Constants.MAIN_FIELD; iFieldSeq <= iFieldCount + Constants.MAIN_FIELD - 1; iFieldSeq++) { FieldInfo field = record.getField(iFieldSeq); if (this.skipField(field)) iTempError = field.initField(bDisplayOption); else iTempError = this.getNextField(field, bDisplayOption, iMoveMode); if (iTempError != Constants.NORMAL_RETURN) iErrorCode = iTempError; } return iErrorCode; } /**
/** * Move all the fields to the output buffer. * This is the same as the fieldsToBuffer method, specifying the fieldTypes to move. * @param record The target record. * @param iFieldTypes The field types to move. */ public void fieldsToBuffer(FieldList record, int iFieldsTypes) { m_iFieldsTypes = iFieldsTypes; if (this.getHeaderCount() == 0) this.clearBuffer(); // Being careful. (Remember to call this at the start anyway) int fieldCount = record.getFieldCount(); // Number of fields to write out for (int iFieldSeq = Constants.MAIN_FIELD; iFieldSeq <= fieldCount + Constants.MAIN_FIELD - 1; iFieldSeq++) { FieldInfo field = record.getField(iFieldSeq); if (!this.skipField(field)) this.addNextField(field); } this.finishBuffer(); //pDestBuff, recordLength, physicalFieldCount); // two bytes for record length, two for field count } /**
/** * */ private FieldList cloneFieldList(FieldList item) { FieldList fieldList = new FieldList(null); for (int i = 0; i < item.getFieldCount(); i++) { FieldInfo fldSource = item.getField(i); FieldInfo fldDest = new FieldInfo(fieldList, fldSource.getFieldName(), fldSource.getMaxLength(), fldSource.getFieldDesc(), fldSource.getDefault()); fldDest.setDataClass(fldSource.getDataClass()); } return fieldList; } /**
/** * Free. */ public void free() { if (this.getFieldList(MealPlan.MEAL_PLAN_FILE) != null) { // Since the meal plan popup record is shared, I need to free it then disconnect it from the controls. this.getFieldList(MealPlan.MEAL_PLAN_FILE).free(); FieldList fieldList = this.getFieldList(); for (int iFieldSeq = 0; iFieldSeq < fieldList.getFieldCount(); iFieldSeq++) { FieldInfo field = fieldList.getField(iFieldSeq); Component component = null; int iIndex = 0; while ((component = (Component)field.getComponent(iIndex)) != null) { if (component instanceof JRemoteComboBox) if (((JRemoteComboBox)component).getRecord() == this.getFieldList(MealPlan.MEAL_PLAN_FILE)) ((JRemoteComboBox)component).setRecord(null); iIndex++; // Bump counter } } this.removeFieldList(this.getFieldList(MealPlan.MEAL_PLAN_FILE)); } super.free(); } /**
rgbModified = new boolean[this.getFieldCount()]; for (int iFieldSeq = 0; iFieldSeq < this.getFieldCount(); iFieldSeq++) this.getTable().edit(); // If I haven't changed any data, just refresh it. buffer.resetPosition(); for (int iFieldSeq = 0; iFieldSeq < this.getFieldCount(); iFieldSeq++) for (int iFieldSeq = 0; iFieldSeq < this.getFieldCount(); iFieldSeq++)
field.free(); for (int iFieldSeq = 0; iFieldSeq < recBookingDetail.getFieldCount(); iFieldSeq++)