/** * Creates a new object of the same class as this object. * @return a clone of this instance. * @exception CloneNotSupportedException if the object's class does not support the <code>Cloneable</code> interface. * @see java.lang.Cloneable */ public Object clone() throws CloneNotSupportedException { SubFileFilter newBehavior = null; if (m_fldMainFile != null) newBehavior = new SubFileFilter(m_fldMainFile, m_iThisFileFieldSeq, m_fldMainFile2, m_iThisFileFieldSeq2, m_fldMainFile3, m_iThisFileFieldSeq3); else if (m_recordMain != null) newBehavior = new SubFileFilter(m_recordMain); return newBehavior; } /**
/** * Constructor for Records with properly set-up reference fields. * If a key area's main key is a reference to this record, then this class sets up * a sub-query to this listener's owner (a record). * @param recordMain The main record to create a sub-query for. */ public SubFileFilter(Record recordMain) { // For this to work right, the booking number field needs a listener to re-select this file whenever it changes this(); this.init(null, recordMain, -1, null, -1, null, -1, null, -1, false, false, true); } /**
/** * * @param bAddNewHeaderOnAdd */ public void setAddNewHeaderOnAdd(boolean bAddNewHeaderOnAdd) { m_bAddNewHeaderOnAdd = bAddNewHeaderOnAdd; if (m_bAddNewHeaderOnAdd) if (this.getMainRecord() != null) this.getMainRecord().setOpenMode((this.getMainRecord().getOpenMode() | DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY)); } /**
/** * Add all the screen listeners. */ public void addListeners() { super.addListeners(); SubFileFilter listener = null; this.getMainRecord().addListener(listener = new SubFileFilter(this.getScreenRecord().getField(ProductScreenRecord.START_DATE), Inventory.INV_DATE, null, null, null, null)); listener.setEndKey(false); this.getScreenRecord().getField(ProductScreenRecord.START_DATE).addListener(new FieldReSelectHandler(this)); if (Boolean.TRUE.toString().equalsIgnoreCase(this.getProperty(this.getScreenRecord().getField(ProductScreenRecord.READ_ONLY).getFieldName()))) { this.setAppending(false); this.setEditing(false); } } /**
/** * AddSubFileFilter Method. */ public void addSubFileFilter() { // Override this if it is not correct. SubFileFilter listener = null; this.getMainRecord().addListener(listener = new SubFileFilter(this.getHeaderRecord())); if (this.getMainRecord().getKeyArea().getField(DBConstants.MAIN_KEY_FIELD).isNullable() == false) { listener.setFilterIfNull(true); listener.setAddNewHeaderOnAdd(false); } }
/** * AddSubFileFilter Method. */ public void addSubFileFilter() { // Override this if it is not correct. SubFileFilter listener = null; this.getMainRecord().addListener(listener = new SubFileFilter(this.getHeaderRecord())); if (!this.getMainRecord().getKeyArea().getField(DBConstants.MAIN_KEY_FIELD).isNullable()) listener.setFilterIfNull(true); // If the header record's key can't be null, don't display any detail if new record }
/** * Add all the screen listeners. */ public void addListeners() { super.addListeners(); SubFileFilter listener = null; this.getMainRecord().addListener(listener = new SubFileFilter(this.getScreenRecord().getField(ProductScreenRecord.START_DATE), BookingDetail.DETAIL_DATE, null, null, null, null)); listener.setEndKey(false); if (this.getScreenRecord().getField(ProductScreenRecord.START_DATE).isNull()) this.getScreenRecord().getField(ProductScreenRecord.START_DATE).setValue(DateTimeField.currentTime(), DBConstants.DISPLAY, DBConstants.INIT_MOVE); this.getScreenRecord().getField(ProductScreenRecord.START_DATE).addListener(new FieldReSelectHandler(this)); this.setAppending(false); this.setEditing(false); } /**
/** * Add all the screen listeners. */ public void addListeners() { super.addListeners(); Record recApTrx = this.getMainRecord(); Record recVendor = this.getRecord(Vendor.VENDOR_FILE); Record recCurrencys = this.getRecord(Currencys.CURRENCYS_FILE); recVendor.addListener(new SubFileFilter(recCurrencys)); recApTrx.addListener(new SubFileFilter(recVendor)); } /**
/** * Add all the screen listeners. */ public void addListeners() { super.addListeners(); SubFileFilter listener = null; this.getMainRecord().addListener(listener = new SubFileFilter(this.getScreenRecord().getField(ProductScreenRecord.START_DATE), BookingDetail.DETAIL_DATE, null, null, null, null)); listener.setEndKey(false); if (this.getScreenRecord().getField(ProductScreenRecord.START_DATE).isNull()) this.getScreenRecord().getField(ProductScreenRecord.START_DATE).setValue(DateTimeField.currentTime(), DBConstants.DISPLAY, DBConstants.INIT_MOVE); this.getScreenRecord().getField(ProductScreenRecord.START_DATE).addListener(new FieldReSelectHandler(this)); this.setAppending(false); this.setEditing(false); } /**
/** * Initialize class fields. */ public void init(BaseField mainFilesField, BaseField fldDate) { m_fldDate = null; m_fldDate = fldDate; super.init(null, null, null, null, null, mainFilesField, BankTrx.BANK_ACCT_ID, null, null, false, false, false); } /**
/** * Add the A/R trx entry for the total invoice amount. */ public void addInvoiceEntry() { ArTrx recArTrx = (ArTrx)this.getOwner(); Calendar calTrxDate = ((DateTimeField)this.getOwner().getField(ArTrx.TRX_DATE)).getCalendar(); if (calTrxDate != null) calTrxDate.add(Calendar.MINUTE, -1); // Just so it will come before the previous entry boolean bOldState = this.setEnabledListener(true); // This method IS disabled, but must be enabled if I update this record (so count is correct) try { SubFileFilter filter = (SubFileFilter)this.getOwner().getListener(SubFileFilter.class); BookingModel recBooking = (BookingModel)filter.getMainRecord(); recBooking.addArDetail(recArTrx, null, false); // Being careful recArTrx.addNew(); double dBalance = recBooking.getField(BookingModel.NET).getValue(); recArTrx.getField(ArTrx.AMOUNT).setValue(dBalance); ((DateTimeField)recArTrx.getField(ArTrx.TRX_DATE)).setCalendar(calTrxDate, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // Just before the previous entry. recArTrx.getField(ArTrx.TRX_STATUS_ID).setValue(iInvoiceTrxStatus); recArTrx.getField(ArTrx.COMMENTS).moveFieldToThis(((ReferenceField)recArTrx.getField(ArTrx.TRX_STATUS_ID)).getReference().getField(TrxStatus.STATUS_DESC)); recArTrx.add(); } catch (DBException ex) { ex.printStackTrace(); } finally { this.setEnabledListener(bOldState); } }
/** * Add all the screen listeners. */ public void addListeners() { super.addListeners(); Record recApTrx = this.getMainRecord(); Record recVendor = this.getRecord(Vendor.VENDOR_FILE); Record recCurrencys = this.getRecord(Currencys.CURRENCYS_FILE); recVendor.addListener(new SubFileFilter(recCurrencys)); recApTrx.addListener(new SubFileFilter(recVendor)); } /**
/** * Constructor for Records with properly set-up reference fields. * If a key area's main key is a reference to this record, then this class sets up * a sub-query to this listener's owner (a record). * @param recordMain The main record to create a sub-query for. */ public SubFileFilter(Record recordMain) { // For this to work right, the booking number field needs a listener to re-select this file whenever it changes this(); this.init(null, recordMain, null, null, null, null, null, null, null, false, false, true); } /**
/** * Get the sub-record. */ public Record getSubRecord() { if (m_recDependent == null) m_recDependent = this.createSubRecord(); if (m_recDependent != null) { if (m_recDependent.getListener(SubFileFilter.class.getName()) == null) m_recDependent.addListener(new SubFileFilter(this.getOwner())); } return m_recDependent; } /**
/** * Constructor for Records with properly set-up reference fields. * If a key area's main key is a reference to this record, then this class sets up * a sub-query to this listener's owner (a record). * @param recordMain The main record to create a sub-query for. */ public SubFileFilter(Record recordMain) { // For this to work right, the booking number field needs a listener to re-select this file whenever it changes this(); this.init(null, recordMain, -1, null, -1, null, -1, null, -1, false, false, true); } /**
/** * Get the sub-record. */ public Record getSubRecord() { if (m_recDependent == null) m_recDependent = this.createSubRecord(); if (m_recDependent != null) { if (m_recDependent.getListener(SubFileFilter.class.getName()) == null) m_recDependent.addListener(new SubFileFilter(this.getOwner())); } return m_recDependent; } /**
/** * Constructor for Records with properly set-up reference fields. * If a key area's main key is a reference to this record, then this class sets up * a sub-query to this listener's owner (a record). * @param recordMain The main record to create a sub-query for. * @param bRefreshLastIfNotCurrent If true, this class will refresh the last record if the record is not current. * @param bRefreshLastIfNotCurrent (Typically used for remote sessions where the remote method does an add before the detail can add). */ public SubFileFilter(Record recordMain, boolean bSetFilterIfNull, boolean bAddNewHeaderOnAdd) { // For this to work right, the key field needs a listener to re-select this file whenever it changes this(); this.init(null, recordMain, -1, null, -1, null, -1, null, -1, bSetFilterIfNull, false, bAddNewHeaderOnAdd); } /**
/** * Get the sub-record. */ public Record getSubRecord() { if (m_recDependent == null) m_recDependent = this.createSubRecord(); if (m_recDependent != null) { if (m_recDependent.getListener(SubFileFilter.class.getName()) == null) m_recDependent.addListener(new SubFileFilter(this.getOwner())); } return m_recDependent; } /**
/** * Constructor for Records with properly set-up reference fields. * If a key area's main key is a reference to this record, then this class sets up * a sub-query to this listener's owner (a record). * @param recordMain The main record to create a sub-query for. * @param bRefreshLastIfNotCurrent If true, this class will refresh the last record if the record is not current. * @param bRefreshLastIfNotCurrent (Typically used for remote sessions where the remote method does an add before the detail can add). */ public SubFileFilter(int iKeyOrder, BaseField fldMainFile) { // For this to work right, the key field needs a listener to re-select this file whenever it changes this(); this.init(null, null, iKeyOrder, fldMainFile, -1, null, -1, null, -1, false, false, true); } /**
/** * Add the behaviors needed to read the bundles in the addBundle method. */ public void addBundleBehaviors(Record recBundle, Record recBundleDetail, Record recItem) { if (recItem != null) recBundleDetail.getField(BundleDetail.BROCHURE_ID).addListener(new ReadSecondaryHandler(recItem)); recBundleDetail.addListener(new SubFileFilter(recBundle)); } /**