/** * FolderGridScreen Method. */ public FolderGridScreen(Record recHeader, Record record, ScreenLocation itsLocation, BasePanel parentScreen, Converter fieldConverter, int iDisplayFieldDesc, Map<String,Object> properties) { this(); this.init(recHeader, record, itsLocation, parentScreen, fieldConverter, iDisplayFieldDesc, properties); } /**
/** * AddSubFileFilter Method. */ public void addSubFileFilter() { // Override this if it is not correct. SubFileFilter listener = null; this.getMainRecord().setKeyArea(BaseFolder.kParentFolderIDKey); this.getMainRecord().addListener(listener = new SubFileFilter(this.getHeaderRecord())); if (this.getMainRecord().getKeyArea().getField(DBConstants.MAIN_KEY_FIELD).isNullable() == false) { listener.setFilterIfNull(true); listener.setAddNewHeaderOnAdd(false); } // Set it back if (DBConstants.TRUE.equalsIgnoreCase(this.getProperty("fakeHeader"))) this.setProperty(DBParams.HEADER_OBJECT_ID, DBConstants.BLANK); } /**
/** * SetupSFields Method. */ public void setupSFields() { this.getRecord(Folder.kFolderFile).getField(Folder.kName).setupDefaultView(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), this, ScreenConstants.DEFAULT_DISPLAY); }
/** * Add all the screen listeners. */ public void addListeners() { // This beginning code is a trick to make the grid screen think that a zero record is the header. this.setProperty("fakeHeader", DBConstants.FALSE); if (m_recHeader != null) if ((m_recHeader.getEditMode() == DBConstants.EDIT_ADD) || (m_recHeader.getEditMode() == DBConstants.EDIT_NONE)) if (this.getProperty(DBParams.HEADER_OBJECT_ID) == null) { this.setProperty("fakeHeader", DBConstants.TRUE); this.setProperty(DBParams.HEADER_OBJECT_ID, "0"); if (m_recHeader.getCounterField() != null) if (m_recHeader.getCounterField().getDefault() == null) { m_recHeader.getCounterField().setDefault(new Integer(0)); // This will guarantee that the sub record's parent field is non-null try { m_recHeader.addNew(); } catch (DBException ex) { } } } super.addListeners(); } /**
/** * MakeScreen Method. */ public BaseScreen makeScreen(ScreenLocation itsLocation, BasePanel parentScreen, int iDocMode, Map<String,Object> properties) { BaseScreen screen = null; if ((iDocMode & ScreenConstants.DOC_MODE_MASK) == ScreenConstants.DETAIL_MODE) screen = new FolderGridScreen(this, null, itsLocation, parentScreen, null, iDocMode | ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties); else if ((iDocMode & ScreenConstants.MAINT_MODE) == ScreenConstants.MAINT_MODE) screen = new FolderScreen(this, itsLocation, parentScreen, null, iDocMode | ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties); else if ((iDocMode & ScreenConstants.DISPLAY_MODE) != 0) screen = new FolderGridScreen(this, itsLocation, parentScreen, null, iDocMode | ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties); else screen = super.makeScreen(itsLocation, parentScreen, iDocMode, properties); return screen; } /**
/** * OpenHeaderRecord Method. */ public Record openHeaderRecord() { super.openHeaderRecord(); if (m_recHeader == null) { Record record = this.getMainRecord(); try { m_recHeader = (Record)record.clone(); // Do not add to screen's list - will mix with other file } catch (CloneNotSupportedException ex) { ex.printStackTrace(); } // Do not clone the listeners, while (m_recHeader.getListener() != null) { m_recHeader.removeListener(m_recHeader.getListener(), true); } m_recHeader.addListeners(); // Just use the standard listeners } return m_recHeader; } /**
return super.doCommand(strCommand, sourceSField, iCommandOptions);
/** * Initialize class fields. */ public void init(Record record, ScreenLocation itsLocation, BasePanel parentScreen, Converter fieldConverter, int iDisplayFieldDesc, Map<String,Object> properties) { super.init(record, itsLocation, parentScreen, fieldConverter, iDisplayFieldDesc, properties); } /**
/** * Constructor. * @param record The main record for this screen. * @param itsLocation The location of this component within the parent. * @param parentScreen The parent screen. * @param fieldConverter The field this screen field is linked to. * @param iDisplayFieldDesc Do I display the field desc?. */ public FolderGridScreen(Record record, ScreenLocation itsLocation, BasePanel parentScreen, Converter fieldConverter, int iDisplayFieldDesc, Map<String,Object> properties) { this(); this.init(record, itsLocation, parentScreen, fieldConverter, iDisplayFieldDesc, properties); } /**