/** * Set the field or file that owns this listener. * @param owner My owner. */ public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (owner != null) if (m_fldMain != null) if (m_fldMain.getRecord() != owner) m_fldMain.addListener(new FieldRemoveBOnCloseHandler(this)); } /**
/** * FieldChanged Method. */ public int fieldChanged(boolean bDisplayOption, int iMoveMode) { double dGross = this.getOwner().getRecord().getField(Mco.GROSS).getValue(); double dCommAmt = this.getOwner().getRecord().getField(Mco.COMM_AMT).getValue(); double dSvcAmt = this.getOwner().getRecord().getField(Mco.SVC_AMT).getValue(); double dTaxAmt = this.getOwner().getRecord().getField(Mco.TAX_AMT).getValue(); double dNet = Math.floor((dGross - dCommAmt - dSvcAmt - dTaxAmt) * 100.00 + 0.5) / 100.00; this.getOwner().getRecord().getField(Mco.NET).setValue(dNet); return super.fieldChanged(bDisplayOption, iMoveMode); }
/** * InitBookingDetailFields Method. */ public int initBookingDetailFields(BookingModel recBooking, TourModel recTour, boolean bOnlyIfTargetIsNull) { if ((!bOnlyIfTargetIsNull) || (this.getField(BookingSub.BOOKING_ID).isNull())) this.getField(BookingSub.BOOKING_ID).moveFieldToThis((BaseField)recBooking.getField(Booking.ID), DBConstants.DISPLAY, DBConstants.INIT_MOVE); if ((!bOnlyIfTargetIsNull) || (this.getField(BookingSub.MODULE_ID).isNull())) this.getField(BookingSub.MODULE_ID).moveFieldToThis((BaseField)recTour.getField(Tour.TOUR_HEADER_ID), DBConstants.DISPLAY, DBConstants.INIT_MOVE); return DBConstants.NORMAL_RETURN; } /**
/** * 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) { String tempString = this.convertIndexToString(index); return this.setString(tempString, bDisplayOption, iMoveMode); // Move value to this field } /**
/** * SaveProductParam Method. */ public static Map<String,Object> addFieldParam(Map<String,Object> map, BaseField field) { if (!field.isNull()) map.put(field.getFieldName(), field.toString()); return map; } /**
/** * SetScreenFields Method. */ public void setScreenFields(Map<String,Object> properties) { super.setScreenFields(properties); Record recProduct = this.getMainRecord(); String strPax = (String)properties.get(SearchConstants.PAX); this.getScreenRecord().getField(ProductScreenRecord.PAX).setString(strPax); Record recProductControl = this.getRecord(ProductControl.PRODUCT_CONTROL_FILE); this.getScreenRecord().getField(ProductScreenRecord.RATE_ID).moveFieldToThis(recProductControl.getField(ProductControl.LAND_RATE_ID)); }
/** * AddMasterListeners Method. */ public void addMasterListeners() { super.addMasterListeners(); this.getField(HotelPricing.COST).addListener(new PaxToRoomHandler(HotelPricing.ROOM_COST)); this.getField(HotelPricing.ROOM_COST).addListener(new RoomToPaxHandler(HotelPricing.COST)); this.getField(HotelPricing.PRICE).addListener(new PaxToRoomHandler(HotelPricing.ROOM_PRICE)); this.getField(HotelPricing.ROOM_PRICE).addListener(new RoomToPaxHandler(HotelPricing.PRICE)); } /**
/** * Get the current field count. */ public double getCount() { double dMainValue = 0; if (m_fldMain != null) dMainValue = m_fldMain.getValue(); // Set in main file's field return dMainValue; } /**
/** * Set up the default control for this field (using default params). * @param targetScreen Where to place this component (ie., Parent screen or GridBagLayout). * @return Return the component or ScreenField that is created for this field. */ public ScreenComponent setupFieldView(ComponentParent targetScreen) { return this.setupDefaultView(targetScreen.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.SET_ANCHOR), targetScreen, ScreenConstants.DISPLAY_DESC); } /**
/** * FieldChanged Method. */ public int fieldChanged(boolean bDisplayOption, int iMoveMode) { int iTourStatus = (int)this.getOwner().getValue(); if (iTourStatus == TourStatus.OKAY) this.getOwner().getRecord().getField(Tour.SERV_CONF).setState(true, bDisplayOption, iMoveMode); // Trigger the services confirmed event return super.fieldChanged(bDisplayOption, iMoveMode); }
/** * Move data to this field from another field. * @param field The source field. * @return The error code (or NORMAL_RETURN). */ public int moveFieldToThis(FieldInfo field) { // Copy a field to this return this.moveFieldToThis(field, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); } /**
/** * RestoreProductParam Method. */ public static void restoreFieldParam(PropertyOwner propertyOwner, BaseField field) { String strFieldName = field.getFieldName(); if (propertyOwner.getProperty(strFieldName) != null) field.setString((String)propertyOwner.getProperty(strFieldName)); } /**
/** * Add all the screen listeners. */ public void addListeners() { super.addListeners(); this.getMainRecord().getField(CashBatch.BANK_ACCT_ID).addListener(new InitFieldHandler(this.getRecord(ArControl.AR_CONTROL_FILE).getField(ArControl.AR_BANK_ACCT_ID))); this.getScreenRecord().getField(CashBatchScreenRecord.USER_ID).moveFieldToThis(this.getMainRecord().getField(CashBatch.USER_ID)); this.getMainRecord().setKeyArea(CashBatch.USER_ID_KEY); this.getMainRecord().addListener(new SubFileFilter(this.getScreenRecord().getField(CashBatchScreenRecord.USER_ID), CashBatch.USER_ID, null, null, null, null)); } /**
/** * FieldChanged Method. */ public int fieldChanged(boolean bDisplayOption, int iMoveMode) { int iErrorCode = super.fieldChanged(bDisplayOption, iMoveMode); if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; String strDesc = ((BookingDetail)this.getOwner().getRecord()).setupProductDesc(); iErrorCode = this.getOwner().getRecord().getField(BookingDetail.DESCRIPTION).setString(strDesc); return iErrorCode; }
/** * Get this field in SQL format. * ie., number 1,234.56 -> 1234.56. * @return This field as a SQL string. */ public String getSQLString() { return this.toString(); // By Default } /**
/** * DoEndKey Method. */ public void doEndKey() { this.getOwner().getField(LandPricing.CLASS_ID).setValue(m_iSicPmc); this.getOwner().getField(LandPricing.CLASS_ID).setModified(true); super.doEndKey(); // This is the starting key, set the initial position } /**
/** * AddMasterListeners Method. */ public void addMasterListeners() { super.addMasterListeners(); ChangePricingTypeHandler listener = null; this.getField(BookingTour.PRICING_TYPE_ID).addListener(listener = new ChangePricingTypeHandler(null)); listener.setDependentStateListener(this.getField(BookingDetail.STATUS_SUMMARY).getListener(StatusHandler.class)); } /**
/** * Move this product cost from to virtual fields to the ProductCost * field in recProduct. Also move the status to the product cost status. * (Override this to set the correct fields!). */ public void setupScreenStatus(Record recProduct, int iStatus) { recProduct.getField(Product.DISPLAY_INVENTORY_STATUS_ID).setValue(iStatus); }