/** * Called when a new blank record is required for the table/query. * If the file is empty, this does an addNew, otherwise, the first record * is read. * @param bDisplayOption If true, display any changes. */ public void doNewRecord(boolean bDisplayOption) { super.doNewRecord(bDisplayOption); try { if (this.getOwner().isOpen()) // Don't do first time! { boolean bOldEnableState = this.isEnabledListener(); this.setEnabledListener(false); // Just in case AddNew decides to call this this.getOwner().close(); if (this.getOwner().hasNext()) // records yet? this.getOwner().next(); else this.getOwner().addNew(); // Make a new one this.setEnabledListener(bOldEnableState); } } catch (DBException ex) { if (ex.getErrorCode() == DBConstants.FILE_NOT_FOUND) if ((this.getOwner().getOpenMode() & DBConstants.OPEN_DONT_CREATE) == DBConstants.OPEN_DONT_CREATE) return; // Special case - they didn't want the table created if not found ex.printStackTrace(); // Never } } }
/** * Called when a new blank record is required for the table/query. * If the file is empty, this does an addNew, otherwise, the first record * is read. * @param bDisplayOption If true, display any changes. */ public void doNewRecord(boolean bDisplayOption) { super.doNewRecord(bDisplayOption); try { if (this.getOwner().isOpen()) // Don't do first time! { boolean bOldEnableState = this.isEnabledListener(); this.setEnabledListener(false); // Just in case AddNew decides to call this this.getOwner().close(); if (this.getOwner().hasNext()) // records yet? this.getOwner().next(); else this.getOwner().addNew(); // Make a new one this.setEnabledListener(bOldEnableState); } } catch (DBException ex) { if (ex.getErrorCode() == DBConstants.FILE_NOT_FOUND) if ((this.getOwner().getOpenMode() & DBConstants.OPEN_DONT_CREATE) == DBConstants.OPEN_DONT_CREATE) return; // Special case - they didn't want the table created if not found ex.printStackTrace(); // Never } } }
/** * Called when a new blank record is required for the table/query. * If the file is empty, this does an addNew, otherwise, the first record * is read. * @param bDisplayOption If true, display any changes. */ public void doNewRecord(boolean bDisplayOption) { super.doNewRecord(bDisplayOption); try { if (this.getOwner().isOpen()) // Don't do first time! { boolean bOldEnableState = this.isEnabledListener(); this.setEnabledListener(false); // Just in case AddNew decides to call this this.getOwner().close(); if (this.getOwner().hasNext()) // records yet? this.getOwner().next(); else this.getOwner().addNew(); // Make a new one this.setEnabledListener(bOldEnableState); } } catch (DBException ex) { if (ex.getErrorCode() == DBConstants.FILE_NOT_FOUND) if ((this.getOwner().getOpenMode() & DBConstants.OPEN_DONT_CREATE) == DBConstants.OPEN_DONT_CREATE) return; // Special case - they didn't want the table created if not found ex.printStackTrace(); // Never } } }
/** * Set the field or file that owns this listener. * This method calls doNewRecord when the owner is set. * @see doNewRecord. * @param owner My owner. */ public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (owner == null) return; boolean bEnabledFlag = this.setEnabledListener(true); // Disabled automatically on setOwner. try { // Open this table and move to the control record if (!this.getOwner().isOpen()) if (this.isEnabled()) // Not on a slave this.getOwner().open(); // Open the control file if (this.getOwner().getEditMode() == Constants.EDIT_NONE) if (this.isEnabled()) // Not on a slave this.doNewRecord(true); // Read the control file } catch (DBException ex) { ex.printStackTrace(); } finally { this.setEnabledListener(bEnabledFlag); // Set back } } /**
/** * Set the field or file that owns this listener. * This method calls doNewRecord when the owner is set. * @see doNewRecord. * @param owner My owner. */ public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (owner == null) return; boolean bEnabledFlag = this.setEnabledListener(true); // Disabled automatically on setOwner. try { // Open this table and move to the control record if (!this.getOwner().isOpen()) if (this.isEnabled()) // Not on a slave this.getOwner().open(); // Open the control file if (this.getOwner().getEditMode() == Constants.EDIT_NONE) if (this.isEnabled()) // Not on a slave this.doNewRecord(true); // Read the control file } catch (DBException ex) { ex.printStackTrace(); } finally { this.setEnabledListener(bEnabledFlag); // Set back } } /**
/** * Set the field or file that owns this listener. * This method calls doNewRecord when the owner is set. * @see doNewRecord. * @param owner My owner. */ public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (owner == null) return; boolean bEnabledFlag = this.setEnabledListener(true); // Disabled automatically on setOwner. try { // Open this table and move to the control record if (!this.getOwner().isOpen()) if (this.isEnabled()) // Not on a slave this.getOwner().open(); // Open the control file if (this.getOwner().getEditMode() == Constants.EDIT_NONE) if (this.isEnabled()) // Not on a slave this.doNewRecord(true); // Read the control file } catch (DBException ex) { ex.printStackTrace(); } finally { this.setEnabledListener(bEnabledFlag); // Set back } } /**