Exemplo n.º 1
0
 /**
  * Set up the default control for this field.
  *
  * @param itsLocation Location of this component on screen (ie., GridBagConstraint).
  * @param targetScreen Where to place this component (ie., Parent screen or GridBagLayout).
  * @param iDisplayFieldDesc Display the label? (optional).
  * @return Return the component or ScreenField that is created for this field.
  */
 public ScreenComponent setupDefaultView(
     ScreenLoc itsLocation,
     ComponentParent targetScreen,
     Convert converter,
     int iDisplayFieldDesc,
     Map<String, Object> properties) // Add this view to the list
     {
   ScreenComponent sField = null;
   BaseField field = (BaseField) this.getField();
   if (field != null) {
     sField =
         field.setupDefaultView(
             itsLocation, targetScreen, converter, iDisplayFieldDesc, properties);
     if (sField != null) if (sField.getConverter() == null) sField.setConverter(this);
   } else
     sField =
         BaseField.createScreenComponent(
             ScreenModel.EDIT_TEXT,
             itsLocation,
             targetScreen,
             converter,
             iDisplayFieldDesc,
             properties);
   return sField;
 }
Exemplo n.º 2
0
 /** Add this field in the Record's field sequence. */
 public BaseField setupField(int iFieldSeq) {
   BaseField field = null;
   // if (iFieldSeq == 0)
   // {
   //  field = new CounterField(this, ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
   //  field.setHidden(true);
   // }
   // if (iFieldSeq == 1)
   // {
   //  field = new RecordChangedField(this, LAST_CHANGED, Constants.DEFAULT_FIELD_LENGTH, null,
   // null);
   //  field.setHidden(true);
   // }
   // if (iFieldSeq == 2)
   // {
   //  field = new BooleanField(this, DELETED, Constants.DEFAULT_FIELD_LENGTH, null, new
   // Boolean(false));
   //  field.setHidden(true);
   // }
   if (iFieldSeq == 3) field = new StringField(this, NAME, 40, null, null);
   if (iFieldSeq == 4) field = new StringField(this, CODE, 2, null, null);
   if (iFieldSeq == 5)
     field = new CurrencysField(this, CURRENCYS_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
   if (iFieldSeq == 6)
     field = new LanguageField(this, LANGUAGE_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
   if (iFieldSeq == 7) field = new StringField(this, ICAO_COUNTRY_CODE, 3, null, null);
   if (iFieldSeq == 8) {
     field = new StringField(this, FAX_PREFIX, 10, null, null);
     field.addListener(new InitOnceFieldHandler(null));
   }
   if (iFieldSeq == 9) {
     field = new DoubleField(this, INTERNATIONAL_TAX, 10, null, null);
     field.addListener(new InitOnceFieldHandler(null));
   }
   if (iFieldSeq == 10) {
     field = new DoubleField(this, DOMESTIC_TAX, 10, null, null);
     field.addListener(new InitOnceFieldHandler(null));
   }
   if (iFieldSeq == 11) field = new DoubleField(this, ARRIVAL_TAX, 10, null, null);
   if (iFieldSeq == 12) {
     field = new FloatField(this, GMT_OFFSET, 5, null, null);
     field.addListener(new InitOnceFieldHandler(null));
   }
   if (iFieldSeq == 13)
     field = new RegionField(this, REGION_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
   if (iFieldSeq == 14) field = new MemoField(this, DESCRIPTION, 9999, null, null);
   if (iFieldSeq == 15) field = new ImageField(this, PICTURE, 9999, null, null);
   if (field == null) field = super.setupField(iFieldSeq);
   return field;
 }
Exemplo n.º 3
0
  /** FieldChanged Method. */
  public int fieldChanged(boolean bDisplayOption, int iMoveMode) {
    BaseField fldDays = this.getOwner();
    BookingCar recBookingCar = (BookingCar) fldDays.getRecord();
    DateTimeField fldStartDate = (DateTimeField) recBookingCar.getField(BookingCar.DETAIL_DATE);
    if ((!fldStartDate.isNull()) && (fldDays.getValue() > 0)) {
      Date dateStart = fldStartDate.getDateTime();
      float fDays = (float) fldDays.getValue();
      Date dateEnd = new Date(dateStart.getTime() + (long) (fDays * DBConstants.KMS_IN_A_DAY));
      Calendar calendar = DateTimeField.m_calendar;

      calendar.setTime(dateEnd);
      calendar.set(Calendar.SECOND, 0);
      calendar.set(Calendar.MILLISECOND, 0);
      dateEnd = calendar.getTime();

      DateTimeField fldEndDate = (DateTimeField) recBookingCar.getField(BookingCar.DETAIL_END_DATE);
      return fldEndDate.setDateTime(dateEnd, bDisplayOption, iMoveMode);
    }
    return super.fieldChanged(bDisplayOption, iMoveMode);
  }