/** * The Field has Changed. * Reselect the grid screen. * @param bDisplayOption If true, display the change. * @param iMoveMode The type of move being done (init/read/screen). * @return The error code (or NORMAL_RETURN if okay). * Reselect the records. */ public int fieldChanged(boolean bDisplayOption, int iMoveMode) { if (m_gridScreen != null) m_gridScreen.reSelectRecords(); if (m_sPopupBox != null) m_sPopupBox.reSelectRecords(); return DBConstants.NORMAL_RETURN; } }
/** * Set an index to a key area. * @param iKeyArea The key area to set to this index. * @param gridTable The record to set. * @param index The index to relate to this keyarea/gridtable combo. */ public void setGridTable(String keyAreaName, Rec gridTable, int index) { if (index == -1) index = m_iNextArrayIndex; // Next available m_iNextArrayIndex = Math.max(m_iNextArrayIndex, index+1); if (gridTable == null) if (m_gridScreen != null) gridTable = m_gridScreen.getMainRecord(); if (gridTable != null) if (m_gridScreen != null) if (gridTable != m_gridScreen.getMainRecord()) { if (m_gridScreen.getMainRecord() instanceof QueryRecord) { int keyIndex = ((QueryRecord)m_gridScreen.getMainRecord()).setGridFile((Record)gridTable, keyAreaName); // Sets the key order and gridtable (even if only one file) keyAreaName = gridTable.getKeyArea(keyIndex).getKeyName(); } } m_iKeyAreaArray[index] = keyAreaName; } /**
/** * User pressed a header button; change the key value to match (and reorder). */ public void clickColumn(int iIndex) { this.getOwner().setValue(iIndex - m_gridScreen.getNavCount()); // Set the grid value (will call this listener if change) } /**
m_recGrid = (Record)m_gridScreen.getMainRecord(); for (int i = 0; i < m_recGrid.getKeyAreaCount(); i++) int iColumn = iKeyOrder + 1 + m_gridScreen.getNavCount(); // grid column ScreenComponent sField = m_gridScreen.getSField(iColumn); if (sField.getConverter() != null) if (sField.getConverter().getField() != null) Record record = (Record)m_gridScreen.getMainRecord(); iKeyOrder = -1; // No obvious sort order for (int iKeyArea = 0; iKeyArea < record.getKeyAreaCount(); iKeyArea++) KeyArea keyArea = null; if (m_recGrid == null) m_recGrid = (Record)m_gridScreen.getMainRecord(); keyArea = m_recGrid.setKeyArea(iKeyOrder); if (keyArea == null)
/** * User pressed a header button; change the key value to match (and reorder). */ public void valueChanged(ListSelectionEvent e) { if (e.getFirstIndex() == e.getLastIndex()) if (e.getFirstIndex() > 0) // Column 0 is the form button this.clickColumn(e.getFirstIndex()); JTable control = (JTable)m_gridScreen.getControl(); control.clearSelection(); // Column selections not allowed } /**
/** * Set the field that owns this listener. * @owner The field that this listener is being added to (if null, this listener is being removed). */ public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (owner != null) { this.setupGridOrder(); // Set the initial grid order if (m_gridScreen != null) { m_gridScreen.setConverter(this.getOwner()); // The grid screen will automatically change this field to match the key order. this.getOwner().addComponent(m_gridScreen); } } } /**
screenField = recPropertiesInput.makeScreen(itsLocation, targetScreen, iDisplayFieldDesc | ScreenConstants.DISPLAY_MODE, this.getMapKeyDescriptions()); boolean bAllowAppending = (this.getMapKeyDescriptions() == null); ((GridScreenParent)screenField).setAppending(bAllowAppending); this.addListener(new SyncFieldToPropertiesRecord(recPropertiesInput)); recPropertiesInput.addListener(new SyncPropertiesRecordToField(this));
if (screen instanceof GridScreenParent) ((GridScreenParent)screen).reSelectRecords();
/** * Constructor. * @param field The basefield owner of this listener (usually null and set on setOwner()). * @param gridScreen The grid screen to reselect on change. */ public void init(BaseField field, GridScreenParent gridScreen, GridComponent sPopupBox) { super.init(field); m_gridScreen = gridScreen; m_sPopupBox = sPopupBox; Record gridFile = null; if (gridScreen != null) gridFile = (Record)gridScreen.getMainRecord(); if (gridFile != null) { // Remove this listener when the file closes FileListener listener = new FileRemoveBOnCloseHandler(this); // If this closes first, this will remove FileListener gridFile.addListener(listener); // Remove this if you close the file first } } /**
if (screen instanceof GridScreenParent) ((GridScreenParent)screen).reSelectRecords();