/** * Process the "Add" toolbar command. * @return true If command was handled */ public boolean onAdd() { Record record = this.getMainRecord(); if (record == null) return false; try { if (record.isModified(false)) { if (record.getEditMode() == Constants.EDIT_IN_PROGRESS) record.set(); else if (record.getEditMode() == Constants.EDIT_ADD) record.add(); } record.addNew(); this.clearStatusText(); } catch(DBException ex) { this.displayError(ex); return false; } return true; } /**
/** * Process the "Add" toolbar command. * @return true If command was handled */ public boolean onAdd() { Record record = this.getMainRecord(); if (record == null) return false; try { if (record.isModified(false)) { if (record.getEditMode() == Constants.EDIT_IN_PROGRESS) record.set(); else if (record.getEditMode() == Constants.EDIT_ADD) record.add(); } record.addNew(); this.clearStatusText(); } catch(DBException ex) { this.displayError(ex); return false; } return true; } /**
/** * Process the Refresh Command. * @return true if successful. */ public boolean onRefresh() { Record record = this.getMainRecord(); if (record == null) return false; try { if (record.getEditMode() == Constants.EDIT_IN_PROGRESS) { // If they're adding, can't delete nothing! if (record.isRefreshedRecord()) return this.onDelete(); Object bookmark = record.getHandle(DBConstants.BOOKMARK_HANDLE); record.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE); } if (record.getEditMode() == Constants.EDIT_ADD) record.addNew(); this.clearStatusText(); } catch (DBException ex) { this.displayError(ex); return false; } return true; } /**
/** * Process the Refresh Command. * @return true if successful. */ public boolean onRefresh() { Record record = this.getMainRecord(); if (record == null) return false; try { if (record.getEditMode() == Constants.EDIT_IN_PROGRESS) { // If they're adding, can't delete nothing! if (record.isRefreshedRecord()) return this.onDelete(); Object bookmark = record.getHandle(DBConstants.BOOKMARK_HANDLE); record.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE); } if (record.getEditMode() == Constants.EDIT_ADD) record.addNew(); this.clearStatusText(); } catch (DBException ex) { this.displayError(ex); return false; } return true; } /**
/** * Process the "Delete" toolbar command. * @return true If command was handled */ public boolean onDelete() { Record record = this.getMainRecord(); if (record == null) return false; if (record.getEditMode() == Constants.EDIT_NONE) return true; if (record.getEditMode() == Constants.EDIT_ADD) { // If they're adding, can't delete nothing! this.onRefresh(); return true; } try { if (record.getEditMode() != Constants.EDIT_IN_PROGRESS) record.edit(); record.remove(); record.addNew(); this.clearStatusText(); } catch(DBException ex) { this.displayError(ex); return false; } return true; } /**
/** * Process the "Delete" toolbar command. * @return true If command was handled */ public boolean onDelete() { Record record = this.getMainRecord(); if (record == null) return false; if (record.getEditMode() == Constants.EDIT_NONE) return true; if (record.getEditMode() == Constants.EDIT_ADD) { // If they're adding, can't delete nothing! this.onRefresh(); return true; } try { if (record.getEditMode() != Constants.EDIT_IN_PROGRESS) record.edit(); record.remove(); record.addNew(); this.clearStatusText(); } catch(DBException ex) { this.displayError(ex); return false; } return true; } /**
record.move(nIDMoveCommand); record.isModified(false); this.clearStatusText(); } catch(DBException ex) { this.displayError(ex);
record.move(nIDMoveCommand); record.isModified(false); this.clearStatusText(); } catch(DBException ex) { this.displayError(ex);