/** * 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 } } }