/** * If there is a header record, return it, otherwise, return the main record. * The header record is the (optional) main record on gridscreens and is sometimes used * to enter data in a sub-record when a header is required. * @return The header record. */ public Record getHeaderRecord() { return this.getMainRecord(); } /**
/** * If there is a header record, return it, otherwise, return the main record. * The header record is the (optional) main record on gridscreens and is sometimes used * to enter data in a sub-record when a header is required. * @return The header record. */ public Record getHeaderRecord() { return this.getMainRecord(); } /**
/** * Utility method to get the grid's record. */ public Record getMainRecord() { return m_gridScreen.getMainRecord(); } }
/** * Utility method to get the grid's record. */ public Record getMainRecord() { return m_gridScreen.getMainRecord(); } }
/** * Override this to add behaviors. */ public void addListeners() { // If there is a header record and there is a bookmark associated with it, make it current! super.addListeners(); if (this.getMainRecord() != null) this.getMainRecord().addScreenListeners(this); // Add the basic listeners to this record that belong on screen(s). if (this.getMainRecord() != null) if (DBConstants.TRUE.equalsIgnoreCase(this.getMainRecord().getTable().getDatabase().getProperty(DBConstants.READ_ONLY_DB))) this.setEditing(false); // Don't allow changes to read-only tables } /**
/** * Override this to add behaviors. */ public void addListeners() { // If there is a header record and there is a bookmark associated with it, make it current! super.addListeners(); if (this.getMainRecord() != null) this.getMainRecord().addScreenListeners(this); // Add the basic listeners to this record that belong on screen(s). if (this.getMainRecord() != null) if (DBConstants.TRUE.equalsIgnoreCase(this.getMainRecord().getTable().getDatabase().getProperty(DBConstants.READ_ONLY_DB))) this.setEditing(false); // Don't allow changes to read-only tables } /**
/** * Does the current user have permission to access this screen. * @return NORMAL_RETURN if access is allowed, ACCESS_DENIED or LOGIN_REQUIRED otherwise. */ public int checkSecurity() { if ((this.getClass().getName().startsWith(BASE_CLASS)) && (this.getMainRecord() != null)) { App application = null; if (this.getTask() != null) application = this.getTask().getApplication(); int iErrorCode = DBConstants.NORMAL_RETURN; if (application != null) iErrorCode = application.checkSecurity(this.getMainRecord().getClass().getName()); // Check access to main record return iErrorCode; } else return super.checkSecurity(); // Custom screen - check security } /**
/** * Process the command. * Step 1 - Process the command if possible and return true if processed. * Step 2 - If I can't process, pass to all children (with me as the source). * Step 3 - If children didn't process, pass to parent (with me as the source). * Note: Never pass to a parent or child that matches the source (to avoid an endless loop). * @param strCommand The command to process. * @param sourceSField The source screen field (to avoid echos). * @param iCommandOptions If this command creates a new screen, create in a new window? * @return true if success. */ public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { if (strCommand.indexOf('=') == -1) if (this.getMainRecord() != null) { int iDocType = this.getMainRecord().commandToDocType(strCommand); if (iDocType > ScreenConstants.LAST_MODE) { // Display the user defined screen. boolean bSuccess = (this.onForm(null, iDocType, true, iCommandOptions, null) != null); if (bSuccess) return bSuccess; // Return if successful. } } return super.doCommand(strCommand, sourceSField, iCommandOptions); // This will send the command to my view } /**
/** * Does the current user have permission to access this screen. * @return NORMAL_RETURN if access is allowed, ACCESS_DENIED or LOGIN_REQUIRED otherwise. */ public int checkSecurity() { if ((this.getClass().getName().startsWith(BASE_CLASS)) && (this.getMainRecord() != null)) { App application = null; if (this.getTask() != null) application = this.getTask().getApplication(); int iErrorCode = DBConstants.NORMAL_RETURN; if (application != null) iErrorCode = application.checkSecurity(this.getMainRecord().getClass().getName()); // Check access to main record return iErrorCode; } else return super.checkSecurity(); // Custom screen - check security } /**
/** * Process the command. * Step 1 - Process the command if possible and return true if processed. * Step 2 - If I can't process, pass to all children (with me as the source). * Step 3 - If children didn't process, pass to parent (with me as the source). * Note: Never pass to a parent or child that matches the source (to avoid an endless loop). * @param strCommand The command to process. * @param sourceSField The source screen field (to avoid echos). * @param iCommandOptions If this command creates a new screen, create in a new window? * @return true if success. */ public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { if (strCommand.indexOf('=') == -1) if (this.getMainRecord() != null) { int iDocType = this.getMainRecord().commandToDocType(strCommand); if (iDocType > ScreenConstants.LAST_MODE) { // Display the user defined screen. boolean bSuccess = (this.onForm(null, iDocType, true, iCommandOptions, null) != null); if (bSuccess) return bSuccess; // Return if successful. } } return super.doCommand(strCommand, sourceSField, iCommandOptions); // This will send the command to my view } /**
try { if ((this.getHeaderRecord() != null) && (this.getHeaderRecord() != this.getMainRecord()) && ((this.getHeaderRecord().getEditMode() == Constants.EDIT_IN_PROGRESS) || (this.getHeaderRecord().getEditMode() == Constants.EDIT_CURRENT))) strURL = this.addURLParam(strURL, DBParams.HEADER_OBJECT_ID, this.getHeaderRecord().getHandle(DBConstants.BOOKMARK_HANDLE).toString());
try { if ((this.getHeaderRecord() != null) && (this.getHeaderRecord() != this.getMainRecord()) && ((this.getHeaderRecord().getEditMode() == Constants.EDIT_IN_PROGRESS) || (this.getHeaderRecord().getEditMode() == Constants.EDIT_CURRENT))) strURL = this.addURLParam(strURL, DBParams.HEADER_OBJECT_ID, this.getHeaderRecord().getHandle(DBConstants.BOOKMARK_HANDLE).toString());
return; // Can't do it. if ((recHeader == null) || (this.getMainRecord() == recHeader) || (ScreenConstants.HTML_SCREEN_TYPE.equalsIgnoreCase(this.getViewFactory().getViewSubpackage()))) return; fldMain = this.getMainRecord().getReferenceField(recHeader); if (fldMain != null) if (recHeader != null) if (fldMain.getReferenceRecord(null, false) != recHeader) fldMain.setReferenceRecord(recHeader); if ((this.getMainRecord().getEditMode() != Constants.EDIT_NONE) && (this.getMainRecord().getEditMode() != Constants.EDIT_ADD))
return; // Can't do it. if ((recHeader == null) || (this.getMainRecord() == recHeader) || (ScreenConstants.HTML_SCREEN_TYPE.equalsIgnoreCase(this.getViewFactory().getViewSubpackage()))) return; fldMain = this.getMainRecord().getReferenceField(recHeader); if (fldMain != null) if (recHeader != null) if (fldMain.getReferenceRecord(null, false) != recHeader) fldMain.setReferenceRecord(recHeader); if ((this.getMainRecord().getEditMode() != Constants.EDIT_NONE) && (this.getMainRecord().getEditMode() != Constants.EDIT_ADD))
this.addRecord(mainRecord, false); mainRecord = this.getMainRecord(); if (mainRecord != null) if (mainRecord.getKeyArea() != null)
this.addRecord((Record)mainRecord, false); mainRecord = this.getMainRecord(); if (mainRecord != null) if (((Record)mainRecord).getKeyArea() != null)
try { Record record = this.getMainRecord(); if (this instanceof GridScreen) record = ((GridScreen)this).getHeaderRecord(); this.getMainRecord().addNew();
try { Record record = this.getMainRecord(); if (this instanceof GridScreen) record = ((GridScreen)this).getHeaderRecord(); this.getMainRecord().addNew();
m_messageFilterList = null; Record record = this.getMainRecord();
m_messageFilterList = null; Record record = this.getMainRecord();