/** * Set the field or file that owns this listener. * @param owner My owner. */ public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (m_recordToUpdate == null) m_recordToUpdate = this.getOwner(); // Defaults to this file if (owner != null) if (this.getOwner() != m_recordToUpdate) m_recordToUpdate.addListener(new FileRemoveBOnCloseHandler(this)); if (m_recordToUpdate != null) m_recordToUpdate.setOpenMode((m_recordToUpdate.getOpenMode() | DBConstants.OPEN_LOCK_ON_CHANGE_STRATEGY) & ~(DBConstants.OPEN_READ_ONLY | DBConstants.OPEN_APPEND_ONLY)); // Lock the record if any changes if (owner != null) if (this.getOwner() == m_recordToUpdate) if (this.getOwner().getListener() != this) // Prevents endless loop (listener is already the first in the list) { // This is special weird logic - This must be the first in the listener list this.getOwner().removeListener(this, false); super.setOwner(owner); // Set it back this.setNextListener(this.getOwner().getListener()); this.getOwner().setListener(this); // This MUST be the first listener on the list. } } /**
/** * Set the field or file that owns this listener. * @param owner My owner. */ public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (m_recordToUpdate == null) m_recordToUpdate = this.getOwner(); // Defaults to this file if (owner != null) if (this.getOwner() != m_recordToUpdate) m_recordToUpdate.addListener(new FileRemoveBOnCloseHandler(this)); if (m_recordToUpdate != null) m_recordToUpdate.setOpenMode((m_recordToUpdate.getOpenMode() | DBConstants.OPEN_LOCK_ON_CHANGE_STRATEGY) & ~(DBConstants.OPEN_READ_ONLY | DBConstants.OPEN_APPEND_ONLY)); // Lock the record if any changes if (owner != null) if (this.getOwner() == m_recordToUpdate) if (this.getOwner().getListener() != this) // Prevents endless loop (listener is already the first in the list) { // This is special weird logic - This must be the first in the listener list this.getOwner().removeListener(this, false); super.setOwner(owner); // Set it back this.setNextListener(this.getOwner().getListener()); this.getOwner().setListener(this); // This MUST be the first listener on the list. } } /**
/** * Set the field or file that owns this listener. * @param owner My owner. */ public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (m_recordToUpdate == null) m_recordToUpdate = this.getOwner(); // Defaults to this file if (owner != null) if (this.getOwner() != m_recordToUpdate) m_recordToUpdate.addListener(new FileRemoveBOnCloseHandler(this)); if (m_recordToUpdate != null) m_recordToUpdate.setOpenMode((m_recordToUpdate.getOpenMode() | DBConstants.OPEN_LOCK_ON_CHANGE_STRATEGY) & ~(DBConstants.OPEN_READ_ONLY | DBConstants.OPEN_APPEND_ONLY)); // Lock the record if any changes if (owner != null) if (this.getOwner() == m_recordToUpdate) if (this.getOwner().getListener() != this) // Prevents endless loop (listener is already the first in the list) { // This is special weird logic - This must be the first in the listener list this.getOwner().removeListener(this, false); super.setOwner(owner); // Set it back this.setNextListener(this.getOwner().getListener()); this.getOwner().setListener(this); // This MUST be the first listener on the list. } } /**