/** * Set the date field to the current time. * Also make sure the time is not the same as it is currently. */ public void setTheDate() { boolean[] rgbEnabled = m_field.setEnableListeners(false); Calendar calAfter = m_field.getCalendar(); Calendar calBefore = m_field.getCalendar(); m_field.setValue(DateTimeField.currentTime(), DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // File written or updated, set the update date calAfter = m_field.getCalendar(); if (calBefore != null) if (calAfter.before(calBefore)) calAfter = calBefore; // If this was set with a different computer (clock), make sure it always increases! if (calAfter != null) if (calAfter.equals(calBefore)) { calAfter.add(Calendar.SECOND, 1); // Can't be the same as last time. m_field.setCalendar(calAfter, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); } Utility.getLogger().info("Set date: " + m_field.toString()); m_field.setEnableListeners(rgbEnabled); } /**
/** * Set the date field to the current time. * Also make sure the time is not the same as it is currently. */ public void setTheDate() { boolean[] rgbEnabled = m_field.setEnableListeners(false); Calendar calAfter = m_field.getCalendar(); Calendar calBefore = m_field.getCalendar(); m_field.setValue(DateTimeField.currentTime(), DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // File written or updated, set the update date calAfter = m_field.getCalendar(); if (calBefore != null) if (calAfter.before(calBefore)) calAfter = calBefore; // If this was set with a different computer (clock), make sure it always increases! if (calAfter != null) if (calAfter.equals(calBefore)) { calAfter.add(Calendar.SECOND, 1); // Can't be the same as last time. m_field.setCalendar(calAfter, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); } Utility.getLogger().info("Set date: " + m_field.toString()); m_field.setEnableListeners(rgbEnabled); } /**
/** * Set the date field to the current time. * Also make sure the time is not the same as it is currently. */ public void setTheDate() { boolean[] rgbEnabled = m_field.setEnableListeners(false); Calendar calAfter = m_field.getCalendar(); Calendar calBefore = m_field.getCalendar(); m_field.setValue(DateTimeField.currentTime(), DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // File written or updated, set the update date calAfter = m_field.getCalendar(); if (calBefore != null) if (calAfter.before(calBefore)) calAfter = calBefore; // If this was set with a different computer (clock), make sure it always increases! if (calAfter != null) if (calAfter.equals(calBefore)) { calAfter.add(Calendar.SECOND, 1); // Can't be the same as last time. m_field.setCalendar(calAfter, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); } Utility.getLogger().info("Set date: " + m_field.toString()); m_field.setEnableListeners(rgbEnabled); } /**
/** * Called when a change is the record status is about to happen/has happened. * This method sets the field to the current time on an add or update. * @param field If this file change is due to a field, this is the field. * @param iChangeType The type of change that occurred. * @param bDisplayOption If true, display any changes. * @return an error code. */ public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Write/Update a record switch (iChangeType) { case DBConstants.REFRESH_TYPE: case DBConstants.ADD_TYPE: case DBConstants.UPDATE_TYPE: DateTimeField thisField = m_field; if (m_field == null) thisField = (DateTimeField)this.getOwner().getField(m_iMainFilesFieldSeq); boolean[] rgbEnabled = thisField.setEnableListeners(false); thisField.setValue(DateTimeField.currentTime(), bDisplayOption, DBConstants.SCREEN_MOVE); // File written or updated, set the update date thisField.setEnableListeners(rgbEnabled); break; } return super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record } }
/** * Called when a change is the record status is about to happen/has happened. * This method sets the field to the current time on an add or update. * @param field If this file change is due to a field, this is the field. * @param iChangeType The type of change that occurred. * @param bDisplayOption If true, display any changes. * @return an error code. */ public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Write/Update a record switch (iChangeType) { case DBConstants.REFRESH_TYPE: case DBConstants.ADD_TYPE: case DBConstants.UPDATE_TYPE: DateTimeField thisField = m_field; if (m_field == null) thisField = (DateTimeField)this.getOwner().getField(m_iMainFilesFieldSeq); boolean[] rgbEnabled = thisField.setEnableListeners(false); thisField.setValue(DateTimeField.currentTime(), bDisplayOption, DBConstants.SCREEN_MOVE); // File written or updated, set the update date thisField.setEnableListeners(rgbEnabled); break; } return super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record } }
/** * Called when a change is the record status is about to happen/has happened. * This method sets the field to the current time on an add or update. * @param field If this file change is due to a field, this is the field. * @param iChangeType The type of change that occurred. * @param bDisplayOption If true, display any changes. * @return an error code. */ public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Write/Update a record switch (iChangeType) { case DBConstants.FIELD_CHANGED_TYPE: if (!onFieldChange) break; case DBConstants.REFRESH_TYPE: case DBConstants.ADD_TYPE: case DBConstants.UPDATE_TYPE: DateTimeField thisField = m_field; if (thisField == null) if (mainFilesFieldName != null) thisField = (DateTimeField)this.getOwner().getField(mainFilesFieldName); boolean[] rgbEnabled = thisField.setEnableListeners(false); thisField.setValue(DateTimeField.currentTime(), bDisplayOption, DBConstants.SCREEN_MOVE); // File written or updated, set the update date thisField.setEnableListeners(rgbEnabled); break; } return super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record } }