/** * The title for this screen. * @return This screen's title. */ public String getTitle() // Standard file maint for this record (returns new record) { String windowName = "Maintenance"; // Default Record query = this.getMainRecord(); if (query != null) windowName = query.getRecordName() + ' ' + windowName; // xxx Maintenance. return windowName; } /**
/** * The title for this screen. * @return This screen's title. */ public String getTitle() // Standard file maint for this record (returns new record) { String windowName = "Maintenance"; // Default Record query = this.getMainRecord(); if (query != null) windowName = query.getRecordName() + ' ' + windowName; // xxx Maintenance. return windowName; } /**
/** * Find the sub-screen that uses this grid query and set for selection. * When you select a new record here, you read the same record in the SelectQuery. * @param recMaint The record which is synced on record change. * @param bUpdateOnSelect Do I update the current record if a selection occurs. * @return True if successful. */ public boolean setSelectQuery(Record recMaint, boolean bUpdateOnSelect) { if (recMaint == null) { return true; // BaseTable Set! } if (this.getMainRecord() != null) if (this.getMainRecord() != recMaint) if (this.getMainRecord().getBaseRecord().getTableNames(false).equals(recMaint.getTableNames(false))) { this.getMainRecord().addListener(new SelectOnUpdateHandler(recMaint, bUpdateOnSelect)); return true; // BaseTable Set! } return false; } /**
/** * Find the sub-screen that uses this grid query and set for selection. * When you select a new record here, you read the same record in the SelectQuery. * @param recMaint The record which is synced on record change. * @param bUpdateOnSelect Do I update the current record if a selection occurs. * @return True if successful. */ public boolean setSelectQuery(Rec recMaint, boolean bUpdateOnSelect) { if (recMaint == null) { return true; // BaseTable Set! } if (this.getMainRecord() != null) if (this.getMainRecord() != recMaint) if (this.getMainRecord().getBaseRecord().getTableNames(false).equals(recMaint.getTableNames(false))) { this.getMainRecord().addListener(new SelectOnUpdateHandler((Record)recMaint, bUpdateOnSelect)); return true; // BaseTable Set! } return false; } /**
/** * Get the command string that will restore this screen. * @return The URL for this screen. */ public String getScreenURL() { String strURL = super.getScreenURL(); if (this.getClass().getName().equals(Screen.class.getName())) { strURL = this.addURLParam(strURL, DBParams.RECORD, this.getMainRecord().getClass().getName()); strURL = this.addURLParam(strURL, DBParams.COMMAND, ThinMenuConstants.FORM); } else strURL = this.addURLParam(strURL, DBParams.SCREEN, this.getClass().getName()); try { if (this.getMainRecord() != null) if ((this.getMainRecord().getEditMode() == Constants.EDIT_IN_PROGRESS) || (this.getMainRecord().getEditMode() == Constants.EDIT_CURRENT)) { String strBookmark = DBConstants.BLANK; if (this.getMainRecord().getHandle(DBConstants.OBJECT_ID_HANDLE) != null) strBookmark = this.getMainRecord().getHandle(DBConstants.OBJECT_ID_HANDLE).toString(); strURL = this.addURLParam(strURL, DBConstants.STRING_OBJECT_ID_HANDLE, strBookmark); } } catch (DBException ex) { ex.printStackTrace(); } return strURL; } /**
/** * Get the command string that will restore this screen. * @return The URL for this screen. */ public String getScreenURL() { String strURL = super.getScreenURL(); if (this.getClass().getName().equals(Screen.class.getName())) { strURL = this.addURLParam(strURL, DBParams.RECORD, this.getMainRecord().getClass().getName()); strURL = this.addURLParam(strURL, DBParams.COMMAND, ThinMenuConstants.FORM); } else strURL = this.addURLParam(strURL, DBParams.SCREEN, this.getClass().getName()); try { if (this.getMainRecord() != null) if ((this.getMainRecord().getEditMode() == Constants.EDIT_IN_PROGRESS) || (this.getMainRecord().getEditMode() == Constants.EDIT_CURRENT)) { String strBookmark = DBConstants.BLANK; if (this.getMainRecord().getHandle(DBConstants.OBJECT_ID_HANDLE) != null) strBookmark = this.getMainRecord().getHandle(DBConstants.OBJECT_ID_HANDLE).toString(); strURL = this.addURLParam(strURL, DBConstants.STRING_OBJECT_ID_HANDLE, strBookmark); } } catch (DBException ex) { ex.printStackTrace(); } return strURL; } /**
/** * Set up the screen fields (default = set them all up for the current record). * <p/>This method is usually overidden to place the controls in exact locations. */ public void setupSFields() { // Set up the screen fields Record record = this.getMainRecord(); if (record == null) return; int lastColumn = record.getFieldCount() + DBConstants.MAIN_FIELD - 1; for (int queryColumn = DBConstants.MAIN_FIELD; queryColumn <= lastColumn; queryColumn++) { BaseField field = record.getField(queryColumn); if (field.isHidden()) continue; // Don't display the counter field if (field.isSelected()) field.setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.SET_ANCHOR), this, ScreenConstants.DEFAULT_DISPLAY); } } }
/** * Set up the screen fields (default = set them all up for the current record). * <p/>This method is usually overidden to place the controls in exact locations. */ public void setupSFields() { // Set up the screen fields Record record = this.getMainRecord(); if (record == null) return; int lastColumn = record.getFieldCount() + DBConstants.MAIN_FIELD - 1; for (int queryColumn = DBConstants.MAIN_FIELD; queryColumn <= lastColumn; queryColumn++) { BaseField field = record.getField(queryColumn); if (field.isHidden()) continue; // Don't display the counter field if (field.isSelected()) field.setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.SET_ANCHOR), this, ScreenConstants.DEFAULT_DISPLAY); } } }
/** * Add the read-main-key listener. */ public void addMainKeyBehavior() { // Add the read keyed listener to all unique keys with one field Record record = this.getMainRecord(); if (record == null) return; int keyCount = record.getKeyAreaCount(); for (int keyNumber = DBConstants.MAIN_KEY_AREA; keyNumber < keyCount + DBConstants.MAIN_KEY_AREA; keyNumber++) { KeyArea keyAreaInfo = record.getKeyArea(keyNumber); if (((keyAreaInfo.getUniqueKeyCode() == DBConstants.UNIQUE) || (keyAreaInfo.getUniqueKeyCode() == DBConstants.SECONDARY_KEY)) & (keyAreaInfo.getKeyFields() == 1)) { BaseField mainField = keyAreaInfo.getField(DBConstants.MAIN_KEY_FIELD); MainFieldHandler readKeyed = new MainFieldHandler(keyNumber); mainField.addListener(readKeyed); } } } /**
Record recordMain = this.getMainRecord(); if (recordMain != null)
Record recordMain = this.getMainRecord(); if (recordMain != null)
/** * Add the read-main-key listener. */ public void addMainKeyBehavior() { // Add the read keyed listener to all unique keys with one field Record record = this.getMainRecord(); if (record == null) return; int keyCount = record.getKeyAreaCount(); for (int keyNumber = DBConstants.MAIN_KEY_AREA; keyNumber < keyCount + DBConstants.MAIN_KEY_AREA; keyNumber++) { KeyArea keyAreaInfo = record.getKeyArea(keyNumber); if (((keyAreaInfo.getUniqueKeyCode() == DBConstants.UNIQUE) || (keyAreaInfo.getUniqueKeyCode() == DBConstants.SECONDARY_KEY)) & (keyAreaInfo.getKeyFields() == 1)) { BaseField mainField = keyAreaInfo.getField(DBConstants.MAIN_KEY_FIELD); MainFieldHandler readKeyed = new MainFieldHandler(record.getKeyArea(keyNumber).getKeyName()); mainField.addListener(readKeyed); } } } /**