OOFILE  1.9
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
dbFieldPickLink Class Reference

dbPickFieldLink maps selection of related records via a control linked to a field. More...

#include <oofgui.h>

Inheritance diagram for dbFieldPickLink:
Inheritance graph
[legend]
Collaboration diagram for dbFieldPickLink:
Collaboration graph
[legend]

Public Member Functions

void allowNullRelationship (bool inAllowFlag=true)
 
bool allowsNullRelationship () const
 
 dbFieldPickLink (dbField *, dbGUIAdapter *adoptedAdapter, bool becomeReadOnly, dbRelRef *pickVia)
 
 dbFieldPickLink (const dbFieldPickLink &)
 
virtual void describe (std::ostream &) const
 Provide human-readable information about object. More...
 
dbFieldfield () const
 purposely non-virtual as subclasses return different types More...
 
bool hidden () const
 
void hide (bool hideIt=true)
 
virtual oofString name () const
 
dbHelperowner () const
 
void owner (dbHelper *)
 not ctor param as can create without helper More...
 
void setDefaultPick (int)
 
void setField (dbField *inField)
 
virtual ~dbFieldPickLink ()
 
mainly used by dbEditHelper
virtual void copyFieldToLink ()
 Load related record as popup setting or copy value. More...
 
virtual void copyLinkToField ()
 Update the linked dGUIAdapter from our field, actually what lookup record is related. More...
 
virtual bool linkEqualsField () const
 Compare ordinal position for popups, use base for values. More...
 
virtual bool leaveLink ()
 Mainly override to avoid checks in base. More...
 
virtual bool validToLeaveForm ()
 Validate unique fields to ensure can accept this record without error from database. More...
 
mainly used by dbGUIadaptor
void maybeChangeTargetLink ()
 
void maybeDirty ()
 
virtual void tellGUIcareAboutLocking () const
 
mainly used by dbEditHelper
virtual void updateDerivedFieldDisplay (bool isNew)
 
virtual void readOnly (bool isReadOnly=true)
 Change readonly state of link to accept or deny data entry. More...
 
virtual bool validToLeaveLink ()
 Validate field contents, overridden if can check just contents. More...
 
virtual void highlightLink ()
 Visually highlight a link, usually becoming edit focus. More...
 
void markClean ()
 
reflective calls
bool isReadOnly () const
 
bool alwaysReadOnly () const
 
bool isDirty () const
 
bool linkIsEmpty () const
 
dbGUIAdapteradapter () const
 

Protected Member Functions

void InitLookup ()
 Clone tables for lookup operations. More...
 

Protected Attributes

dbGUIAdaptermAdapter
 owned More...
 
bool mAllowsNullRelationship
 OK to not have lookup value. More...
 
bool mAlwaysReadOnly
 for static controls, etc; More...
 
unsigned long mCachedRecordNumber
 used for popups to optimise comparisons More...
 
int mDefaultPick
 
dbFieldmField
 
bool mHidden
 
dbTablemLookupTable
 owned clone More...
 
bool mMaybeDirty
 tentative flag lets us optimise comparisons More...
 
dbHelpermOwner
 
dbRelRefmPickVia
 only allow Ref as lookups point to just one record More...
 
bool mReadOnly
 default is read-write More...
 

Detailed Description

dbPickFieldLink maps selection of related records via a control linked to a field.

Parameters

Definition at line 263 of file oofgui.h.

Constructor & Destructor Documentation

dbFieldPickLink::dbFieldPickLink ( dbField fld,
dbGUIAdapter adoptedAdapter,
bool  becomeReadOnly,
dbRelRef pickVia 
)

Definition at line 1202 of file oofgui.cpp.

References dbRelRefBase::isRelBackToParent().

dbFieldPickLink::dbFieldPickLink ( const dbFieldPickLink rhs)

Definition at line 1215 of file oofgui.cpp.

dbFieldPickLink::~dbFieldPickLink ( )
virtual

Definition at line 1225 of file oofgui.cpp.

References mLookupTable.

Member Function Documentation

dbGUIAdapter * dbFieldLink::adapter ( ) const
inlineinherited

Definition at line 815 of file oofgui.h.

References dbFieldLink::mAdapter.

Referenced by dbAbstractEditHelper::getLink().

void dbFieldPickLink::allowNullRelationship ( bool  inAllowFlag = true)
inline

Definition at line 839 of file oofgui.h.

References mAllowsNullRelationship.

bool dbFieldPickLink::allowsNullRelationship ( ) const
inline

Definition at line 832 of file oofgui.h.

References mAllowsNullRelationship.

bool dbFieldLink::alwaysReadOnly ( ) const
inlineinherited

Definition at line 770 of file oofgui.h.

References dbFieldLink::mAlwaysReadOnly.

void dbFieldPickLink::copyFieldToLink ( )
virtual

Load related record as popup setting or copy value.

Todo:

cope with null relationships allowed for pickers (ie: popup menus)

cope with join relationships on pickers like setRelatedRecord(dbTable*);

more flexibility in initialising popup menu

Reimplemented from dbFieldLink.

Definition at line 1238 of file oofgui.cpp.

References dbFieldLink::copyFieldToLink(), dbTable::count(), dbTable::currentOID(), dbTable::gotoRecord(), InitLookup(), dbRelRefBase::isJoin(), dbGUIAdapter::isValuePicker(), dbFieldLink::mAdapter, mAllowsNullRelationship, mCachedRecordNumber, mDefaultPick, dbFieldLink::mField, mLookupTable, mPickVia, dbTable::recordNumberOfOID(), dbRelRefBase::relatedTable(), dbRelRef::setRelatedRecord(), dbGUIAdapter::setValue(), and dbGUIAdapter::setValueList().

void dbFieldPickLink::copyLinkToField ( )
virtual

Update the linked dGUIAdapter from our field, actually what lookup record is related.

If this is the first time called on this screen, may need to load a popup menu. Maps one-based indexes returned from pickers to 0-based records numbers.

Todo:
handle picking via edit fields, doing a search

Reimplemented from dbFieldLink.

Definition at line 1298 of file oofgui.cpp.

References dbGUIAdapter::getValue(), dbTable::gotoRecord(), dbGUIAdapter::isValuePicker(), dbFieldLink::mAdapter, mCachedRecordNumber, mLookupTable, mPickVia, and dbRelRef::setRelatedRecord().

Referenced by leaveLink().

void OOF_PublicBase::describe ( std::ostream &  ) const
virtualinherited

Provide human-readable information about object.

Overriden to provide much more detail particularly for dbTable::describe() which provides full schema.

Reimplemented in dbConnect, dbTable, dbFixedBinary, dbChar, dbField, and dbRelRefBase.

Definition at line 342 of file oof1.cpp.

References OOF_PublicBase::name().

Referenced by OOF_Dictionary::describeVisible().

dbField * dbFieldLink::field ( ) const
inlineinherited

purposely non-virtual as subclasses return different types

Accessor for field being edited.

Used by dbGUIAdapters such as dbGUIAdaptEditPane::setFieldLink to get the field in order to query database characteristics.

Returns
dbField* to the field we link.

Definition at line 808 of file oofgui.h.

References dbFieldLink::mField.

Referenced by dbFieldLink::copyFieldToLink(), dbBoolLink::copyFieldToLink(), dbFieldLink::copyLinkToField(), dbBoolLink::copyLinkToField(), dbFieldLink::leaveLink(), dbBoolLink::linkEqualsField(), and dbGUIAdaptEditPane::setFieldLink().

bool OOF_PublicBase::hidden ( ) const
inlineinherited

Definition at line 51 of file oof1.h.

Referenced by OOF_Dictionary::EntryMatchesVisibility().

void OOF_PublicBase::hide ( bool  hideIt = true)
inlineinherited

Definition at line 52 of file oof1.h.

void dbFieldLink::highlightLink ( )
virtualinherited

Visually highlight a link, usually becoming edit focus.

dbAbstractEditHelper::ValidateLinks calls us to highlight the first invalid link it finds.

Definition at line 1044 of file oofgui.cpp.

References dbGUIAdapter::highlightContents(), and dbFieldLink::mAdapter.

Referenced by dbAbstractEditHelper::ValidateLinks().

void dbFieldPickLink::InitLookup ( )
protected

Clone tables for lookup operations.

Todo:
cache RAM-based map

Definition at line 1282 of file oofgui.cpp.

References dbTable::cloneTableWithoutSelection(), dbField::fieldIsStandalone(), dbField::fieldTable(), dbFieldLink::mField, mLookupTable, and dbTable::selectAll().

Referenced by copyFieldToLink().

bool dbFieldLink::isDirty ( ) const
inlineinherited
bool dbFieldLink::isReadOnly ( ) const
inlineinherited

Definition at line 763 of file oofgui.h.

References dbFieldLink::mReadOnly.

Referenced by dbGUIAdaptLControl::ExecuteSelf(), and dbGUIAdapter::IsReadOnly().

bool dbFieldPickLink::leaveLink ( )
virtual

Mainly override to avoid checks in base.

It is common for our target fields (the lookup field) to be uniquely indexed. We rely on the check in validToLeaveForm.

Returns
true at all times

Reimplemented from dbFieldLink.

Definition at line 1343 of file oofgui.cpp.

References copyLinkToField(), linkEqualsField(), and dbFieldLink::validToLeaveLink().

bool dbFieldPickLink::linkEqualsField ( ) const
virtual

Compare ordinal position for popups, use base for values.

Reimplemented from dbFieldLink.

Definition at line 1322 of file oofgui.cpp.

References dbGUIAdapter::getValue(), dbGUIAdapter::isValuePicker(), dbFieldLink::linkEqualsField(), dbFieldLink::mAdapter, mCachedRecordNumber, and mLookupTable.

Referenced by leaveLink().

bool dbFieldLink::linkIsEmpty ( ) const
inherited
void dbFieldLink::markClean ( )
inlineinherited
void dbFieldLink::maybeChangeTargetLink ( )
inlineinherited
void dbFieldLink::maybeDirty ( )
inlineinherited
oofString OOF_PublicBase::name ( ) const
virtualinherited

Reimplemented in dbConnect, dbTable, OOF_adornerHolder, and dbField.

Definition at line 349 of file oof1.cpp.

Referenced by OOF_PublicBase::describe().

dbHelper * dbFieldLink::owner ( ) const
inlineinherited
void dbFieldLink::owner ( dbHelper inOwner)
inlineinherited

not ctor param as can create without helper

Definition at line 787 of file oofgui.h.

References dbFieldLink::mOwner.

void dbFieldLink::readOnly ( bool  becomeReadOnly = true)
virtualinherited

Change readonly state of link to accept or deny data entry.

Won't allow enabling editing if can't edit record due to locking.

Definition at line 1133 of file oofgui.cpp.

References dbTable::getGUI(), dbFieldLink::mAlwaysReadOnly, dbFieldLink::mOwner, dbFieldLink::mReadOnly, dbGUI::recordAvailable(), and dbHelper::table().

Referenced by oofRepLayoutEditLink::getCellText(), oofRepViewEditLink::getCellText(), and oofRepColHeaderEditLink::getCellText().

void dbFieldPickLink::setDefaultPick ( int  inPick)
inline

Definition at line 846 of file oofgui.h.

References mDefaultPick, and mLookupTable.

void dbFieldLink::setField ( dbField inField)
inlineinherited

Definition at line 822 of file oofgui.h.

References dbFieldLink::mField.

void dbFieldLink::tellGUIcareAboutLocking ( ) const
virtualinherited
void dbFieldLink::updateDerivedFieldDisplay ( bool  isNew)
virtualinherited
bool dbFieldPickLink::validToLeaveForm ( )
virtual

Validate unique fields to ensure can accept this record without error from database.

Warning
you probably still want to call this method if you override.

Reimplemented from dbFieldLink.

Definition at line 1362 of file oofgui.cpp.

References dbTable::count(), mAllowsNullRelationship, mPickVia, and dbRelRefBase::relatedTable().

bool dbFieldLink::validToLeaveLink ( )
virtualinherited

Validate field contents, overridden if can check just contents.

Lightweight check that allows tabbing between fields in open record.

See also
validToLeaveForm for heavier check.
dbDateLink2Editor::validToLeaveLink

Reimplemented in dbDateTimeLink2Editor, and dbDateLink2Editor.

Definition at line 1099 of file oofgui.cpp.

Referenced by dbFieldLink::leaveLink(), leaveLink(), and dbFieldLink::validToLeaveForm().

Member Data Documentation

dbGUIAdapter* dbFieldLink::mAdapter
protectedinherited
bool dbFieldPickLink::mAllowsNullRelationship
protected

OK to not have lookup value.

Definition at line 286 of file oofgui.h.

Referenced by allowNullRelationship(), allowsNullRelationship(), copyFieldToLink(), and validToLeaveForm().

bool dbFieldLink::mAlwaysReadOnly
protectedinherited

for static controls, etc;

Definition at line 238 of file oofgui.h.

Referenced by dbFieldLink::alwaysReadOnly(), and dbFieldLink::readOnly().

unsigned long dbFieldPickLink::mCachedRecordNumber
protected

used for popups to optimise comparisons

Definition at line 289 of file oofgui.h.

Referenced by copyFieldToLink(), copyLinkToField(), and linkEqualsField().

int dbFieldPickLink::mDefaultPick
protected

Definition at line 290 of file oofgui.h.

Referenced by copyFieldToLink(), and setDefaultPick().

dbField* dbFieldLink::mField
protectedinherited
bool OOF_PublicBase::mHidden
protectedinherited

Definition at line 61 of file oof1.h.

dbTable* dbFieldPickLink::mLookupTable
protected

owned clone

Definition at line 288 of file oofgui.h.

Referenced by copyFieldToLink(), copyLinkToField(), InitLookup(), linkEqualsField(), setDefaultPick(), and ~dbFieldPickLink().

bool dbFieldLink::mMaybeDirty
protectedinherited

tentative flag lets us optimise comparisons

Definition at line 236 of file oofgui.h.

Referenced by dbFieldLink::isDirty(), dbFieldLink::leaveLink(), dbFieldLink::markClean(), and dbFieldLink::maybeDirty().

dbHelper* dbFieldLink::mOwner
protectedinherited
dbRelRef* dbFieldPickLink::mPickVia
protected

only allow Ref as lookups point to just one record

Definition at line 287 of file oofgui.h.

Referenced by copyFieldToLink(), copyLinkToField(), and validToLeaveForm().

bool dbFieldLink::mReadOnly
protectedinherited

default is read-write

Definition at line 237 of file oofgui.h.

Referenced by dbFieldLink::isReadOnly(), and dbFieldLink::readOnly().


The documentation for this class was generated from the following files: