/** * This method was created by a SmartGuide. * @param converter The field that controls this grid query (should be a reference field). * @param record tour.db.Record The record to control (note, this converter adds a GridTable to the record's table). * @param iDisplayFieldSeq int The description field sequence in the grid record. * @param bIncludeBlankOption boolean Include a blank line in the popup? */ public QueryConverter(Converter converter, Record record, int iDisplayFieldSeq, boolean bIncludeBlankOption) { this(); this.init(converter, record, iDisplayFieldSeq, bIncludeBlankOption); } /**
/** * Convert this index value to a display string. * @param index The index of the display string to retrieve. * @return The display string. */ public String convertIndexToDisStr(int index) { int iErrorCode = this.moveToIndex(index); if (iErrorCode == DBConstants.NORMAL_RETURN) return m_record.getField(m_iFieldSeq).getString(); else return Constants.BLANK; } /**
/** * 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; } /**
if (iDisplayFieldSeq == null) iDisplayFieldSeq = ((Record)record).getDefaultDisplayFieldName(); FieldConverter convert = new QueryConverter((Converter)converter, (Record)record, iDisplayFieldSeq, bIncludeBlankOption); ScreenComponent screenField = createScreenComponent(ScreenModel.POPUP_BOX, itsLocation, targetScreen, convert, iDisplayFieldDesc, null); if (bIncludeFormButton)
/** * Retrieve (in string format) from this field. * @return The display field of the grid record. */ public String getString() { FieldInfo field = this.getField(); if (field instanceof StringField) return field.toString(); return m_record.getField(m_iFieldSeq).getString(); // Return the desc string } /**
/** * 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; } /**
/** * Add a popup for the table tied to this field. * Key must be the first and primary and only key. * @param record Record to display in a popup * @param iQueryKeySeq Order to display the record (-1 = Primary field) * @param iDisplayFieldSeq Description field for the popup (-1 = second field) * @param bIncludeBlankOption Include a blank option in the popup? * @return Return the component or ScreenField that is created for this field. */ public ScreenField setupTablePopup(ScreenLocation itsLocation, BasePanel targetScreen, Converter converter, int iDisplayFieldDesc, Record record, int iQueryKeySeq, int iDisplayFieldSeq, boolean bIncludeBlankOption, boolean bIncludeFormButton) { if ((!(this instanceof ReferenceField)) && (!(this instanceof CounterField))) Debug.doAssert(false); // error, wrong field type record.setKeyArea(iQueryKeySeq); record.close(); if (converter == null) converter = this; if (iDisplayFieldSeq == -1) iDisplayFieldSeq = record.getDefaultDisplayFieldSeq(); FieldConverter convert = new QueryConverter(converter, record, iDisplayFieldSeq, bIncludeBlankOption); ScreenField screenField = new SPopupBox(itsLocation, targetScreen, convert, iDisplayFieldDesc); if (bIncludeFormButton) if (!(targetScreen instanceof BaseGridScreen)) new SCannedBox(targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), targetScreen, converter, ThinMenuConstants.FORM, ScreenConstants.DONT_DISPLAY_FIELD_DESC, record); record.selectScreenFields(); // Only select fields that you will display return screenField; } /**
/** * Retrieve (in string format) from this field. * @return The display field of the grid record. */ public String getString() { FieldInfo field = this.getField(); if (field instanceof StringField) return field.toString(); return m_record.getField(m_iFieldSeq).getString(); // Return the desc string } /**
/** * 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; } /**
/** * Add a popup for the table tied to this field. * Key must be the first and primary and only key. * @param record Record to display in a popup * @param iQueryKeySeq Order to display the record (-1 = Primary field) * @param iDisplayFieldSeq Description field for the popup (-1 = second field) * @param bIncludeBlankOption Include a blank option in the popup? * @return Return the component or ScreenField that is created for this field. */ public ScreenField setupTablePopup(ScreenLocation itsLocation, BasePanel targetScreen, Converter converter, int iDisplayFieldDesc, Record record, int iQueryKeySeq, int iDisplayFieldSeq, boolean bIncludeBlankOption, boolean bIncludeFormButton) { if ((!(this instanceof ReferenceField)) && (!(this instanceof CounterField))) Debug.doAssert(false); // error, wrong field type record.setKeyArea(iQueryKeySeq); record.close(); if (converter == null) converter = this; if (iDisplayFieldSeq == -1) iDisplayFieldSeq = record.getDefaultDisplayFieldSeq(); FieldConverter convert = new QueryConverter(converter, record, iDisplayFieldSeq, bIncludeBlankOption); ScreenField screenField = new SPopupBox(itsLocation, targetScreen, convert, iDisplayFieldDesc); if (bIncludeFormButton) if (!(targetScreen instanceof BaseGridScreen)) new SCannedBox(targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), targetScreen, converter, ThinMenuConstants.FORM, ScreenConstants.DONT_DISPLAY_FIELD_DESC, record); record.selectScreenFields(); // Only select fields that you will display return screenField; } /**
/** * This method was created by a SmartGuide. * @param converter The field that controls this grid query (should be a reference field). * @param record tour.db.Record The record to control (note, this converter adds a GridTable to the record's table). * @param iDisplayFieldSeq int The description field sequence in the grid record. * @param bIncludeBlankOption boolean Include a blank line in the popup? */ public QueryConverter(Converter converter, Record record, int iDisplayFieldSeq, boolean bIncludeBlankOption) { this(); this.init(converter, record, iDisplayFieldSeq, null, bIncludeBlankOption); } /**
/** * Retrieve (in string format) from this field. * @return The display field of the grid record. */ public String getString() { FieldInfo field = this.getField(); if (field instanceof StringField) return field.toString(); if (displayFieldName != null) return m_record.getField(displayFieldName).getString(); // Return the desc string else return m_record.getField(m_iFieldSeq).getString(); // Return the desc string } /**
/** * Convert this index value to a display string. * @param index The index of the display string to retrieve. * @return The display string. */ public String convertIndexToDisStr(int index) { int iErrorCode = this.moveToIndex(index); if (iErrorCode == DBConstants.NORMAL_RETURN) return m_record.getField(m_iFieldSeq).getString(); else return Constants.BLANK; } /**
FieldInfo field = this.getField(); if (field != null) this.moveToIndex(-1); // Move off any valid record if (m_bIncludeBlankOption) if (field != null)
/** * Add the tour departure toolbar. */ public ToolScreen addTourToolbar(BasePanel parentScreen) { ToolScreen toolScreen = new EmptyToolbar(null, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null); this.getField(LookupScreenRecord.TOUR_HDR_END_DATE).setupDefaultView(toolScreen.getNextLocation(ScreenConstants.NEXT_INPUT_LOCATION, ScreenConstants.AT_ANCHOR), toolScreen, ScreenConstants.DEFAULT_DISPLAY); this.getField(LookupScreenRecord.TOUR_HDR_TOUR_TYPE).setupDefaultView(toolScreen.getNextLocation(ScreenConstants.RIGHT_WITH_DESC, ScreenConstants.AT_ANCHOR), toolScreen, ScreenConstants.DEFAULT_DISPLAY); TourHeader recTourHeader = (TourHeader)((ReferenceField)this.getField(LookupScreenRecord.TOUR_HEADER_ID)).getReferenceRecord(); QueryConverter tourHdrConv = new QueryConverter((ReferenceField)this.getField(LookupScreenRecord.TOUR_HEADER_ID), recTourHeader, TourHeader.DESCRIPTION, true); BaseField fldDepartureDate = this.getField(LookupScreenRecord.DEPARTURE_DATE); BaseField fldStartDate = this.getField(LookupScreenRecord.START_TARGET_DATE); BaseField fldEndDate = this.getField(LookupScreenRecord.END_TARGET_DATE); recTourHeader.createTourHeaderPopup(toolScreen.getNextLocation(ScreenConstants.NEXT_INPUT_LOCATION, ScreenConstants.ANCHOR_DEFAULT), toolScreen, tourHdrConv, ScreenConstants.DEFAULT_DISPLAY, fldDepartureDate, fldStartDate, fldEndDate, null); this.getField(LookupScreenRecord.TOUR_STATUS_ID).setupDefaultView(toolScreen.getNextLocation(ScreenConstants.RIGHT_WITH_DESC, ScreenConstants.AT_ANCHOR), toolScreen, ScreenConstants.DEFAULT_DISPLAY); return toolScreen; } /**
/** * This method was created by a SmartGuide. * @param converter The field that controls this grid query (should be a reference field). * @param record tour.db.Record The record to control (note, this converter adds a GridTable to the record's table). * @param iDisplayFieldSeq int The description field sequence in the grid record. * @param bIncludeBlankOption boolean Include a blank line in the popup? */ public QueryConverter(Converter converter, Record record, String displayFieldName, boolean bIncludeBlankOption) { this(); this.init(converter, record, -1, displayFieldName, bIncludeBlankOption); } /**
/** * Convert this index value to a display string. * @param index The index of the display string to retrieve. * @return The display string. */ public String convertIndexToDisStr(int index) { int iErrorCode = this.moveToIndex(index); if (iErrorCode == DBConstants.NORMAL_RETURN) { if (displayFieldName != null) return m_record.getField(displayFieldName).getString(); else return m_record.getField(m_iFieldSeq).getString(); } else return Constants.BLANK; } /**
FieldInfo field = this.getField(); if (field != null) this.moveToIndex(-1); // Move off any valid record if (m_bIncludeBlankOption) if (field != null)
QueryConverter tourHdrConv = new QueryConverter((ReferenceField)this.getScreenRecord().getField(TourEntryScreenRecord.TOUR_HEADER_ID), recTourHeader, TourHeader.DESCRIPTION, true); recTourHeader.createTourHeaderPopup(this.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.ANCHOR_DEFAULT), this, tourHdrConv, ScreenConstants.DONT_DISPLAY_FIELD_DESC, fldDepartureDate, fldStartDate, fldEndDate, recBookingControl.getField(BookingControl.TOUR_HEADER_TOUR_TYPE));
/** * This method was created by a SmartGuide. * @param converter The field that controls this grid query (should be a reference field). * @param record tour.db.Record The record to control (note, this converter adds a GridTable to the record's table). * @param iDisplayFieldSeq int The description field sequence in the grid record. * @param bIncludeBlankOption boolean Include a blank line in the popup? */ public QueryConverter(Converter converter, Record record, int iDisplayFieldSeq, boolean bIncludeBlankOption) { this(); this.init(converter, record, iDisplayFieldSeq, bIncludeBlankOption); } /**