Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

dbFieldPickLink Class Reference
[OOFILE GUI forms interface.]

#include <oofgui.h>

Inheritance diagram for dbFieldPickLink:

Inheritance graph
[legend]
Collaboration diagram for dbFieldPickLink:

Collaboration graph
[legend]
List of all members.

Detailed Description

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

Parameters:
\param becomeReadOnly is probably irrelevant but maybe we might have an entry field that is temporarily readonly depending on user state.
dbFieldLink retains the setting and can be queried by isReadOnly. Implementing the behaviour to inhibit editing is the job of the dbGUIAdapter eg, in PowerPlant dbGUIAdaptEditPane::ExecuteSelf swallows msg_KeyPress.

Warning:
the big conceptual difference with dbFieldPickLink is that it separates the target field (the dbRelRefBase) being set by user interaction from the field which provides data entry characteristics, eg: a dbChar providing menu titles. Normally these are the same field.

Todo:
cope with text entry fields used as pickers, suspect may need to know type of adapter

just copy the entire table into RAM lookup map for speed.


mainly used by dbEditHelper

virtual void copyFieldToLink ()
 Load related record as popup setting or copy value.

virtual void copyLinkToField ()
 Update the linked dGUIAdapter from our field, actually what lookup record is related.

virtual bool linkEqualsField () const
 Compare ordinal position for popups, use base for values.

virtual bool leaveLink ()
 Mainly override to avoid checks in base.

virtual bool validToLeaveForm ()
 Validate unique fields to ensure can accept this record without error from database.


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.

virtual bool validToLeaveLink ()
 Validate field contents, overridden if can check just contents.

virtual void highlightLink ()
 Visually highlight a link, usually becoming edit focus.

void markClean ()

reflective calls

bool isReadOnly () const
bool alwaysReadOnly () const
bool isDirty () const
bool linkIsEmpty () const
dbGUIAdapteradapter () const

Public Member Functions

 dbFieldPickLink (dbField *, dbGUIAdapter *adoptedAdapter, bool becomeReadOnly, dbRelRef *pickVia)
 dbFieldPickLink (const dbFieldPickLink &)
virtual ~dbFieldPickLink ()
bool allowsNullRelationship () const
void allowNullRelationship (bool inAllowFlag=true)
void setDefaultPick (int)
dbHelperowner () const
void owner (dbHelper *)
 not ctor param as can create without helper

dbFieldfield () const
 purposely non-virtual as subclasses return different types

void setField (dbField *inField)
bool hidden () const
void hide (bool hideIt=true)
virtual void describe (std::ostream &) const
 Provide human-readable information about object.

virtual oofString name () const

Protected Member Functions

void InitLookup ()
 Clone tables for lookup operations.


Protected Attributes

bool mAllowsNullRelationship
 OK to not have lookup value.

dbRelRefmPickVia
 only allow Ref as lookups point to just one record

dbTablemLookupTable
 owned clone

unsigned long mCachedRecordNumber
 used for popups to optimise comparisons

int mDefaultPick
dbFieldmField
dbGUIAdaptermAdapter
 owned

dbHelpermOwner
bool mMaybeDirty
 tentative flag lets us optimise comparisons

bool mReadOnly
 default is read-write

bool mAlwaysReadOnly
 for static controls, etc;

bool mHidden

Friends

class dbAbstractEditHelper
 so it can call PreApprovedReadOnly


Constructor & Destructor Documentation

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

dbFieldPickLink::dbFieldPickLink const dbFieldPickLink  ) 
 

dbFieldPickLink::~dbFieldPickLink  )  [virtual]
 


Member Function Documentation

dbGUIAdapter * dbFieldLink::adapter  )  const [inline, inherited]
 

void dbFieldPickLink::allowNullRelationship bool  inAllowFlag = true  )  [inline]
 

bool dbFieldPickLink::allowsNullRelationship  )  const [inline]
 

bool dbFieldLink::alwaysReadOnly  )  const [inline, inherited]
 

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.

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.

void OOF_PublicBase::describe std::ostream &  os  )  const [virtual, inherited]
 

Provide human-readable information about object.

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

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

dbField * dbFieldLink::field  )  const [inline, inherited]
 

purposely non-virtual as subclasses return different types

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

Returns:
dbField* to the field we link.

Reimplemented in dbUshortLink.

bool OOF_PublicBase::hidden  )  const [inline, inherited]
 

void OOF_PublicBase::hide bool  hideIt = true  )  [inline, inherited]
 

void dbFieldLink::highlightLink  )  [virtual, inherited]
 

Visually highlight a link, usually becoming edit focus.

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

void dbFieldPickLink::InitLookup  )  [protected]
 

Clone tables for lookup operations.

Todo:
cache RAM-based map

bool dbFieldLink::isDirty  )  const [inline, inherited]
 

bool dbFieldLink::isReadOnly  )  const [inline, inherited]
 

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.

bool dbFieldPickLink::linkEqualsField  )  const [virtual]
 

Compare ordinal position for popups, use base for values.

Reimplemented from dbFieldLink.

bool dbFieldLink::linkIsEmpty  )  const [inherited]
 

void dbFieldLink::markClean  )  [inline, inherited]
 

void dbFieldLink::maybeChangeTargetLink  )  [inline, inherited]
 

void dbFieldLink::maybeDirty  )  [inline, inherited]
 

oofString OOF_PublicBase::name  )  const [virtual, inherited]
 

Reimplemented in dbTable, dbConnect, dbField, and OOF_adornerHolder.

void dbFieldLink::owner dbHelper  )  [inline, inherited]
 

not ctor param as can create without helper

dbHelper * dbFieldLink::owner  )  const [inline, inherited]
 

void dbFieldLink::readOnly bool  becomeReadOnly = true  )  [virtual, inherited]
 

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

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

void dbFieldPickLink::setDefaultPick int   )  [inline]
 

void dbFieldLink::setField dbField inField  )  [inline, inherited]
 

void dbFieldLink::tellGUIcareAboutLocking  )  const [virtual, inherited]
 

Reimplemented in oofRepEditLink.

void dbFieldLink::updateDerivedFieldDisplay bool  isNew  )  [virtual, inherited]
 

Reimplemented in dbNumericFieldLink, dbDateLink2Editor, and dbDateTimeLink2Editor.

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.

bool dbFieldLink::validToLeaveLink  )  [virtual, inherited]
 

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 dbDateLink2Editor, and dbDateTimeLink2Editor.


Friends And Related Function Documentation

friend class dbAbstractEditHelper [friend, inherited]
 

so it can call PreApprovedReadOnly


Member Data Documentation

dbGUIAdapter* dbFieldLink::mAdapter [protected, inherited]
 

owned

bool dbFieldPickLink::mAllowsNullRelationship [protected]
 

OK to not have lookup value.

bool dbFieldLink::mAlwaysReadOnly [protected, inherited]
 

for static controls, etc;

unsigned long dbFieldPickLink::mCachedRecordNumber [protected]
 

used for popups to optimise comparisons

int dbFieldPickLink::mDefaultPick [protected]
 

dbField* dbFieldLink::mField [protected, inherited]
 

bool OOF_PublicBase::mHidden [protected, inherited]
 

dbTable* dbFieldPickLink::mLookupTable [protected]
 

owned clone

bool dbFieldLink::mMaybeDirty [protected, inherited]
 

tentative flag lets us optimise comparisons

dbHelper* dbFieldLink::mOwner [protected, inherited]
 

dbRelRef* dbFieldPickLink::mPickVia [protected]
 

only allow Ref as lookups point to just one record

bool dbFieldLink::mReadOnly [protected, inherited]
 

default is read-write


The documentation for this class was generated from the following files:
Generated on Fri Jan 2 00:57:10 2004 for OOFILE by doxygen 1.3.5