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

dbFieldLink Class Reference
[OOFILE GUI forms interface.]

#include <oofgui.h>

Inheritance diagram for dbFieldLink:

Inheritance graph
[legend]
Collaboration diagram for dbFieldLink:

Collaboration graph
[legend]
List of all members.

Detailed Description

dbFieldLink is the main link abstraction mapping a database field to a GUI object (via a dbGUIAdapter).

This two-stage mapping is necessary so we can provide overrides at either end without a combinatorial explosion from mixing field and GUI control types. (As early OOFILE suffered.)

In Pattern terms, dbFieldLink provides a Facade covering a whole range of field access. dbGUIAdapter is our Adapter for control I/O interfacing.

Warning:
most of the methods of dbFieldLink operate under the original assumptions that the field link has been initialised with both a dbField* and dbGUIAdapter*.
Report editing may subclass and use with NULL values for either of these, but uses only a subset of features.

We implement read-only in OOFILE rather than relying on application level controls as some frameworks (eg: PowerPlant) may not provide readonly behaviour without having to totally disable a control. If you want to retain select/copy/paste of a control, disabling is not suitable.

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.

Note:
it is quite straightforward to use your own subclasses of dbFieldLink. Rather than using dbEditHelper::linkField to link the control and dbField, create your own link and give it to the helper:
    mEditHelper->adoptLink(new YourLink(...));


mainly used by dbGUIadaptor

void maybeChangeTargetLink ()
void maybeDirty ()
virtual void tellGUIcareAboutLocking () const

mainly used by dbEditHelper

virtual void copyFieldToLink ()
virtual void copyLinkToField ()
virtual bool linkEqualsField () const
virtual bool leaveLink ()
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 bool validToLeaveForm ()
 Validate unique fields to ensure can accept this record without error from database.

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

 dbFieldLink (dbField *, dbGUIAdapter *adoptedAdapter, bool becomeReadOnly=false)
 dbFieldLink (const dbFieldLink &)
virtual ~dbFieldLink ()
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 Attributes

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

dbFieldLink::dbFieldLink dbField fld,
dbGUIAdapter adoptedAdapter,
bool  becomeReadOnly = false
 

Parameters:
adoptedAdapter is our interface to a source/display of values (probably control)
becomeReadOnly indicates the control must not allow update of the field.

dbFieldLink::dbFieldLink const dbFieldLink  ) 
 

dbFieldLink::~dbFieldLink  )  [virtual]
 


Member Function Documentation

dbGUIAdapter * dbFieldLink::adapter  )  const [inline]
 

bool dbFieldLink::alwaysReadOnly  )  const [inline]
 

void dbFieldLink::copyFieldToLink  )  [virtual]
 

Reimplemented in dbFieldPickLink, and dbBoolLink.

void dbFieldLink::copyLinkToField  )  [virtual]
 

Reimplemented in dbFieldPickLink, and dbBoolLink.

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]
 

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]
 

Visually highlight a link, usually becoming edit focus.

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

bool dbFieldLink::isDirty  )  const [inline]
 

bool dbFieldLink::isReadOnly  )  const [inline]
 

bool dbFieldLink::leaveLink  )  [virtual]
 

Reimplemented in dbFieldPickLink, and oofRepEditLink.

bool dbFieldLink::linkEqualsField  )  const [virtual]
 

Reimplemented in dbFieldPickLink, and dbBoolLink.

bool dbFieldLink::linkIsEmpty  )  const
 

void dbFieldLink::markClean  )  [inline]
 

void dbFieldLink::maybeChangeTargetLink  )  [inline]
 

void dbFieldLink::maybeDirty  )  [inline]
 

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

Reimplemented in dbTable, dbConnect, dbField, and OOF_adornerHolder.

void dbFieldLink::owner dbHelper  )  [inline]
 

not ctor param as can create without helper

dbHelper * dbFieldLink::owner  )  const [inline]
 

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

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 dbFieldLink::setField dbField inField  )  [inline]
 

void dbFieldLink::tellGUIcareAboutLocking  )  const [virtual]
 

Reimplemented in oofRepEditLink.

void dbFieldLink::updateDerivedFieldDisplay bool  isNew  )  [virtual]
 

Reimplemented in dbNumericFieldLink, dbDateLink2Editor, and dbDateTimeLink2Editor.

bool dbFieldLink::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 in dbFieldPickLink.

bool dbFieldLink::validToLeaveLink  )  [virtual]
 

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]
 

so it can call PreApprovedReadOnly


Member Data Documentation

dbGUIAdapter* dbFieldLink::mAdapter [protected]
 

owned

bool dbFieldLink::mAlwaysReadOnly [protected]
 

for static controls, etc;

dbField* dbFieldLink::mField [protected]
 

bool OOF_PublicBase::mHidden [protected, inherited]
 

bool dbFieldLink::mMaybeDirty [protected]
 

tentative flag lets us optimise comparisons

dbHelper* dbFieldLink::mOwner [protected]
 

bool dbFieldLink::mReadOnly [protected]
 

default is read-write


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