/** * Get the next field and fill it with data from this buffer. * You must override this method. * @param field The field to set. * @param bDisplayOption The display option for setting the field. * @param iMoveMove The move mode for setting the field. * @return The error code. */ public int getNextField(FieldInfo field, boolean bDisplayOption, int iMoveMode) // Must be to call right Get calls { String string = this.getNextString(); if (string == null) return Constants.ERROR_RETURN; if (string == DATA_SKIP) return Constants.NORMAL_RETURN; // Don't set this field return field.setString(string, bDisplayOption, iMoveMode); } /**
/** * Set the data in this field to true or false. */ public int setState(boolean bState, boolean bDisplayOption, int iMoveMode) { Boolean objData = new Boolean(bState); if (this.getDataClass() == Boolean.class) return this.setData(objData, bDisplayOption, iMoveMode); else if (Number.class.isAssignableFrom(this.getDataClass())) return this.setValue(objData.booleanValue() ? 1 : 0, bDisplayOption, iMoveMode); else if (this.getDataClass() == String.class) return this.setString(objData.booleanValue() ? Constants.TRUE : Constants.FALSE, bDisplayOption, iMoveMode); return super.setState(bState, bDisplayOption, iMoveMode); } /**
/** * Set this field back to the original value. * @param bDisplayOption If true, display the data. * @return The error code. */ public int initField(boolean bDisplayOption) // Init this field override for other value { if ((this.getDefault() == null) || (this.getDefault() instanceof String)) return this.setString((String)this.getDefault(), bDisplayOption, Constants.INIT_MOVE); // zero out the field return this.setData(this.getDefault(), bDisplayOption, Constants.INIT_MOVE); } /**
/** * 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) { // User selected an item... Read it in! int iErrorCode = this.moveToIndex(index); if (iErrorCode == DBConstants.NORMAL_RETURN) m_record.handleRecordChange(null, DBConstants.SELECT_TYPE, bDisplayOption); // Record selected!!! // These next lines causes the FieldBehaviors with SCREEN_MOVE to be executed!!! FieldInfo field = this.getField(); if (iErrorCode == DBConstants.NORMAL_RETURN) if (field != null) { if (field instanceof ReferenceField) ((ReferenceField)field).setReference(m_record, bDisplayOption, iMoveMode); else if (field instanceof StringField) { { if (displayFieldName != null) return field.setString(m_record.getField(displayFieldName).toString()); else return field.setString(m_record.getField(m_iFieldSeq).toString()); } } } return iErrorCode; } /**
/** * 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) { // User selected an item... Read it in! int iErrorCode = this.moveToIndex(index); if (iErrorCode == DBConstants.NORMAL_RETURN) m_record.handleRecordChange(null, DBConstants.SELECT_TYPE, bDisplayOption); // Record selected!!! // These next lines causes the FieldBehaviors with SCREEN_MOVE to be executed!!! FieldInfo field = this.getField(); if (iErrorCode == DBConstants.NORMAL_RETURN) if (field != null) { if (field instanceof ReferenceField) ((ReferenceField)field).setReference(m_record, bDisplayOption, iMoveMode); else if (field instanceof StringField) field.setString(m_record.getField(m_iFieldSeq).toString()); } return iErrorCode; } /**
/** * 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()); } } /**
/** * 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()); } } /**
/** * 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) { // User selected an item... Read it in! int iErrorCode = this.moveToIndex(index); if (iErrorCode == DBConstants.NORMAL_RETURN) m_record.handleRecordChange(null, DBConstants.SELECT_TYPE, bDisplayOption); // Record selected!!! // These next lines causes the FieldBehaviors with SCREEN_MOVE to be executed!!! FieldInfo field = this.getField(); if (iErrorCode == DBConstants.NORMAL_RETURN) if (field != null) { if (field instanceof ReferenceField) ((ReferenceField)field).setReference(m_record, bDisplayOption, iMoveMode); else if (field instanceof StringField) field.setString(m_record.getField(m_iFieldSeq).toString()); } return iErrorCode; } /**
/** * Get the next record (return a null at EOF). * Note: Remember to set the data source before returning a NORMAL_RETURN. * @param iRelPosition The relative records to move. * @return A record status (NORMAL_RETURN means the move was successful). */ public int doMove(int iRelPosition) throws DBException { if (m_iCurrentRecord == -1) { // Send fake "New Booking" Icon only on the first access. addNew(); FieldList recBooking = getRecord(); recBooking.getField(Booking.ID).setValue(0, Constants.DISPLAY, Constants.READ_MOVE); recBooking.getField(Booking.DESCRIPTION).setString("New Booking", Constants.DISPLAY, Constants.READ_MOVE); fieldsToData(recBooking); m_iCurrentRecord++; m_iRecordsAccessed++; return Constants.NORMAL_RETURN; // This is already the current record } return super.doMove(iRelPosition); } };
/** * Move the data in this record to the thin version. * @param fieldList. */ public void moveDataToThin(Record record, FieldList fieldList) { if (!record.getField(OTACodes.VALUE).isNull()) fieldList.getField(record.getField(OTACode.ID).getFieldName()).setString(record.getField(OTACodes.VALUE).toString()); this.moveFieldToThin(fieldList.getField(record.getField(OTACodes.NAME).getFieldName()), null, record); } /**
/** * Run Method. */ public void run() { String strID = this.getProperty(DBParams.ID); if ((strID != null) && (strID.length() > 0)) { Record recCalendarEntry = this.getMainRecord(); recCalendarEntry.getCounterField().setString(strID); try { if (recCalendarEntry.seek(null)) { recCalendarEntry.edit(); boolean[] rgbEnabled = recCalendarEntry.setEnableListeners(false); // I need to do this since a change in properties will reschedule the jobs. ((PropertiesField)recCalendarEntry.getField(CalendarEntry.kProperties)).setProperty(TASK_COMPLETED, DBConstants.TRUE); recCalendarEntry.setEnableListeners(rgbEnabled); recCalendarEntry.set(); } } catch (DBException ex) { ex.printStackTrace(); } } }
m_model.getFieldTable().getRecord().getField(BookingDetail.PRODUCT_TYPE).setString(strAction); JBookingDetailMainScreen mainScreen = (JBookingDetailMainScreen)this.getTargetScreen(JBookingDetailMainScreen.class); mainScreen.setSource(this);
/** * Move the data in this record to the thin version. * @param fieldList. */ public void moveDataToThin(Record record, FieldList fieldList) { if (!record.getField(OTACodes.VALUE).isNull()) fieldList.getField(record.getField(OTACode.ID).getFieldName()).setString(record.getField(OTACodes.VALUE).toString()); this.moveFieldToThin(fieldList.getField(record.getField(OTACodes.NAME).getFieldName()), null, record); } /**
/** * GetContactTypeFromID Method. */ public String getContactTypeFromID(String strContactTypeID) { if (Utility.isNumeric(strContactTypeID)) { int iOldKeyArea = this.getDefaultOrder(); this.setKeyArea(ContactType.kIDKey); this.getCounterField().setString(strContactTypeID); try { if (this.seek(null)) strContactTypeID = this.getField(ContactType.kCode).toString(); } catch (DBException ex) { ex.printStackTrace(); } finally { this.setKeyArea(iOldKeyArea); } } return strContactTypeID; } /**
/** * GetContactTypeFromID Method. */ public String getContactTypeFromID(String strContactTypeID) { if (Utility.isNumeric(strContactTypeID)) { int iOldKeyArea = this.getDefaultOrder(); this.setKeyArea(ContactType.ID_KEY); this.getCounterField().setString(strContactTypeID); try { if (this.seek(null)) strContactTypeID = this.getField(ContactType.CODE).toString(); } catch (DBException ex) { ex.printStackTrace(); } finally { this.setKeyArea(iOldKeyArea); } } return strContactTypeID; } /**
&& (strID.length() > 0)) record.getField(BookingDetail.ID).setString(strID); String strKeyName = record.getKeyName(); record.setKeyName(Constants.PRIMARY_KEY);
recBooking.getField(strKeyField).setString(strKeyValue); String strOldKeyArea = recBooking.getKeyName(); recBooking.setKeyArea(strKeyField);
/** * Add the behaviors. */ public void addListeners() { super.addListeners(); Record record = this.getMainRecord(); record.setKeyArea(DBConstants.MAIN_KEY_AREA); record.getCounterField().setString(this.getProperty(DBConstants.OBJECT_ID)); try { if (!record.seek(null)) return; // Never; ContactType recContactType = (ContactType)this.getRecord(ContactType.kContactTypeFile); recContactType = recContactType.getContactType(record); Record recMessageDetail = this.getRecord(MessageDetail.kMessageDetailFile); recMessageDetail.setKeyArea(MessageDetail.kContactTypeIDKey); recMessageDetail.addListener(new SubFileFilter(recContactType.getField(ContactType.kID), MessageDetail.kContactTypeID, (BaseField)record.getCounterField(), MessageDetail.kPersonID, null, -1)); } catch (DBException e) { e.printStackTrace(); return; } MessageTransport recMessageTransport = (MessageTransport)this.getRecord(MessageTransport.kMessageTransportFile); recMessageTransport = recMessageTransport.getMessageTransport(MessageTransport.SOAP); // For now - Only SOAP } /**
record.getCounterField().setString(strReferenceID); if (record.seek(null))