/** * 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 } /**
/** * Get this field's name. * @return The name of the field on the end of the converter chain. */ public String getFieldName() { if (this.getField() == null) return null; else return this.getField().getFieldName(false, false); } /**
/** * Get the short field description. * @return The field desc. If null, return the resource from the record's resouce file. * If not available, return the field name. */ public String getFieldDesc() { String strFieldDesc = null; if (m_strFieldDesc != null) // Field desc null? (using default) strFieldDesc = m_strFieldDesc; else { // Get the description from the resource file if (this.getRecord() != null) strFieldDesc = this.getRecord().getString(this.getFieldName()); } return strFieldDesc; } /**
/** * Get this field's name. * @param bAddQuotes Add quotes if this field contains a space. * @param bIncludeFileName include the file name as file.field. * @return The field name. */ public String getFieldName(boolean bAddQuotes, boolean bIncludeFileName) { if (!bAddQuotes) if (!bIncludeFileName) return super.getFieldName(bAddQuotes, bIncludeFileName); // Return m_sFieldName String strFieldName = Constants.BLANK; if (bIncludeFileName) if (this.getRecord() != null) { strFieldName = this.getRecord().getTableNames(bAddQuotes); if (strFieldName.length() != 0) strFieldName += "."; } strFieldName += Record.formatTableNames(m_strFieldName, bAddQuotes); return strFieldName; } /**
if (converter == null) converter = this; if ((this.getFieldName().equals(this.getNameByReflection(component))) || (converter.getField() == this))
/** * Get this field's name. * @param bAddQuotes Add quotes if this field contains a space. * @param bIncludeFileName include the file name as file.field. * @return The field name. */ public String getFieldName(boolean bAddQuotes, boolean bIncludeFileName) { if (!bAddQuotes) if (!bIncludeFileName) return super.getFieldName(bAddQuotes, bIncludeFileName); // Return m_sFieldName String strFieldName = Constants.BLANK; if (bIncludeFileName) if (this.getRecord() != null) { strFieldName = this.getRecord().getTableNames(bAddQuotes); if (strFieldName.length() != 0) strFieldName += "."; } strFieldName += Record.formatTableNames(m_strFieldName, bAddQuotes); return strFieldName; } /**
/** * Get this field's name. * @param bAddQuotes Add quotes if this field contains a space. * @param bIncludeFileName include the file name as file.field. * @return The field name. */ public String getFieldName(boolean bAddQuotes, boolean bIncludeFileName) { if (!bAddQuotes) if (!bIncludeFileName) return super.getFieldName(bAddQuotes, bIncludeFileName); // Return m_sFieldName String strFieldName = Constants.BLANK; if (bIncludeFileName) if (this.getRecord() != null) { strFieldName = this.getRecord().getTableNames(bAddQuotes); if (strFieldName.length() != 0) strFieldName += "."; } strFieldName += Record.formatTableNames(m_strFieldName, bAddQuotes); return strFieldName; } /**
/** * A field changed on this screen. */ public void propertyChange(PropertyChangeEvent evt) { String strFieldName = evt.getPropertyName(); FieldList fieldList = this.getFieldList(); FieldInfo field = fieldList.getField(strFieldName); if (field != null) { if (BookingHotel.NIGHTS.equals(field.getFieldName())) { Short shNights = (Short)field.getData(); Date date = (Date)fieldList.getField(BookingDetail.DETAIL_DATE).getData(); if (date != null) if (shNights != null) { Converter.initGlobals(); Calendar calendar = Converter.gCalendar; calendar.setTime(date); calendar.add(Calendar.DATE, shNights.shortValue()); fieldList.getField(BookingDetail.DETAIL_END_DATE).setData(calendar.getTime()); } } } super.propertyChange(evt); } }
/** * Move the data in this record to the thin version. * @param fieldInfo The destination thin field. * @param field The source field (or null to auto-find) * @param record The source record (or null if field supplied) */ public void moveFieldToThin(FieldInfo fieldInfo, BaseField field, Record record) { if ((field == null) || (!field.getFieldName().equals(fieldInfo.getFieldName()))) { field = null; if (record != null) field = record.getField(fieldInfo.getFieldName()); } if (field != null) { if (field.getDataClass() == fieldInfo.getDataClass()) fieldInfo.setData(field.getData()); else fieldInfo.setString(field.toString()); } } /**
/** * Get the long field description tip. * Look in the resource for the long description, if not found, return the field desc. * @return The field tip. */ public String getFieldTip() { String strTipKey = this.getFieldName() + Constants.TIP; String strFieldTip = strTipKey; if (this.getRecord() != null) strFieldTip = this.getRecord().getString(strTipKey); if (strFieldTip == strTipKey) return this.getFieldDesc(); return strFieldTip; } /**
/** * Move the data in this record to the thin version. * @param fieldInfo The destination thin field. * @param field The source field (or null to auto-find) * @param record The source record (or null if field supplied) */ public void moveFieldToThin(FieldInfo fieldInfo, BaseField field, Record record) { if ((field == null) || (!field.getFieldName().equals(fieldInfo.getFieldName()))) { field = null; if (record != null) field = record.getField(fieldInfo.getFieldName()); } if (field != null) { if (field.getDataClass() == fieldInfo.getDataClass()) fieldInfo.setData(field.getData()); else fieldInfo.setString(field.toString()); } } /**
/** * Move the data in this record to the thin version. * @param fieldInfo The destination thin field. * @param field The source field (or null to auto-find) * @param record The source record (or null if field supplied) */ public void moveFieldToThin(FieldInfo fieldInfo, BaseField field, Record record) { if ((field == null) || (!field.getFieldName().equals(fieldInfo.getFieldName()))) { field = null; if (record != null) field = record.getField(fieldInfo.getFieldName()); } if (field != null) { if (field.getDataClass() == fieldInfo.getDataClass()) fieldInfo.setData(field.getData()); else fieldInfo.setString(field.toString()); } } /**
if (field != null) if ((BookingDetail.DETAIL_DATE.equals(field.getFieldName())) || (BookingDetail.DETAIL_END_DATE.equals(field.getFieldName()))) FieldInfo fieldCalendar = item.getField(field.getFieldName()); fieldCalendar.setData(field.getData()); try {
/** * */ 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; } /**
FieldInfo field = new FieldInfo(recBookingDetailCalendarItem, fieldActual.getFieldName(), fieldActual.getMaxLength(), fieldActual.getFieldDesc(), fieldActual.getDefault()); field.setDataClass(fieldActual.getDataClass());