Public Member Functions | Protected Attributes | Friends | List of all members
dbFieldLink Class Reference

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

#include <oofgui.h>

Inheritance diagram for dbFieldLink:
Inheritance graph
Collaboration diagram for dbFieldLink:
Collaboration graph

Public Member Functions

 dbFieldLink (dbField *, dbGUIAdapter *adoptedAdapter, bool becomeReadOnly=false)
 dbFieldLink (const dbFieldLink &)
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 setField (dbField *inField)
virtual ~dbFieldLink ()
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. More...
virtual bool validToLeaveLink ()
 Validate field contents, overridden if can check just contents. More...
virtual bool validToLeaveForm ()
 Validate unique fields to ensure can accept this record without error from database. 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 Attributes

 owned More...
bool mAlwaysReadOnly
 for static controls, etc; More...
bool mHidden
bool mMaybeDirty
 tentative flag lets us optimise comparisons More...
bool mReadOnly
 default is read-write More...


class dbAbstractEditHelper
 so it can call PreApprovedReadOnly More...

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.

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.

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(...));

Definition at line 182 of file oofgui.h.

Constructor & Destructor Documentation

dbFieldLink::dbFieldLink ( dbField fld,
dbGUIAdapter adoptedAdapter,
bool  becomeReadOnly = false 
adoptedAdapteris our interface to a source/display of values (probably control)
becomeReadOnlyindicates the control must not allow update of the field.

Definition at line 982 of file oofgui.cpp.

References mAdapter, and dbGUIAdapter::setFieldLink().

dbFieldLink::dbFieldLink ( const dbFieldLink rhs)

Definition at line 995 of file oofgui.cpp.

References dbGUIAdapter::clone(), mAdapter, and dbGUIAdapter::setFieldLink().

dbFieldLink::~dbFieldLink ( )

Definition at line 1010 of file oofgui.cpp.

References mAdapter.

Member Function Documentation

dbGUIAdapter * dbFieldLink::adapter ( ) const

Definition at line 815 of file oofgui.h.

References mAdapter.

Referenced by dbAbstractEditHelper::getLink().

bool dbFieldLink::alwaysReadOnly ( ) const

Definition at line 770 of file oofgui.h.

References mAlwaysReadOnly.

void dbFieldLink::copyFieldToLink ( )
void dbFieldLink::copyLinkToField ( )
void OOF_PublicBase::describe ( std::ostream &  ) const

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

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.

dbField* to the field we link.

Definition at line 808 of file oofgui.h.

References mField.

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

bool OOF_PublicBase::hidden ( ) const

Definition at line 51 of file oof1.h.

Referenced by OOF_Dictionary::EntryMatchesVisibility().

void OOF_PublicBase::hide ( bool  hideIt = true)

Definition at line 52 of file oof1.h.

void dbFieldLink::highlightLink ( )

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 mAdapter.

Referenced by dbAbstractEditHelper::ValidateLinks().

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

Definition at line 763 of file oofgui.h.

References mReadOnly.

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

bool dbFieldLink::leaveLink ( )
bool dbFieldLink::linkEqualsField ( ) const

Reimplemented in dbBoolLink, and dbFieldPickLink.

Definition at line 1168 of file oofgui.cpp.

References dbField::copyString(), dbGUIAdapter::equalsString(), mAdapter, and mField.

Referenced by leaveLink(), and dbFieldPickLink::linkEqualsField().

bool dbFieldLink::linkIsEmpty ( ) const

Definition at line 1179 of file oofgui.cpp.

References dbGUIAdapter::getString(), oofString::isEmpty(), and mAdapter.

Referenced by leaveLink().

void dbFieldLink::markClean ( )
void dbFieldLink::maybeChangeTargetLink ( )
void dbFieldLink::maybeDirty ( )
oofString OOF_PublicBase::name ( ) const

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
void dbFieldLink::owner ( dbHelper inOwner)

not ctor param as can create without helper

Definition at line 787 of file oofgui.h.

References mOwner.

void dbFieldLink::readOnly ( bool  becomeReadOnly = true)

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(), mAlwaysReadOnly, mOwner, mReadOnly, dbGUI::recordAvailable(), and dbHelper::table().

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

void dbFieldLink::setField ( dbField inField)

Definition at line 822 of file oofgui.h.

References mField.

void dbFieldLink::tellGUIcareAboutLocking ( ) const
void dbFieldLink::updateDerivedFieldDisplay ( bool  isNew)
bool dbFieldLink::validToLeaveForm ( )

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

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

Reimplemented in dbFieldPickLink.

Definition at line 1110 of file oofgui.cpp.

References dbField::copyString(), dbField::fieldIsUniqueIndexed(), dbField::fieldName(), mField, validToLeaveLink(), and dbField::valueIsDuplicate().

Referenced by dbAbstractEditHelper::ValidateLinks().

bool dbFieldLink::validToLeaveLink ( )

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.

Reimplemented in dbDateTimeLink2Editor, and dbDateLink2Editor.

Definition at line 1099 of file oofgui.cpp.

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

Friends And Related Function Documentation

friend class dbAbstractEditHelper

so it can call PreApprovedReadOnly

Definition at line 240 of file oofgui.h.

Member Data Documentation

dbGUIAdapter* dbFieldLink::mAdapter
bool dbFieldLink::mAlwaysReadOnly

for static controls, etc;

Definition at line 238 of file oofgui.h.

Referenced by alwaysReadOnly(), and readOnly().

dbField* dbFieldLink::mField
bool OOF_PublicBase::mHidden

Definition at line 61 of file oof1.h.

bool dbFieldLink::mMaybeDirty

tentative flag lets us optimise comparisons

Definition at line 236 of file oofgui.h.

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

dbHelper* dbFieldLink::mOwner

Definition at line 235 of file oofgui.h.

Referenced by maybeChangeTargetLink(), maybeDirty(), owner(), and readOnly().

bool dbFieldLink::mReadOnly

default is read-write

Definition at line 237 of file oofgui.h.

Referenced by isReadOnly(), and readOnly().

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