Sign in Join
FPDoc Onlineexperiment

TBaseMediator class

In unit fpObserver

Base class for mediating data between model and view objects

Declaration

pascal
TBaseMediator = class(TComponent)

Inheritance

  1. TBaseMediator
  2. TComponent
  3. TPersistent
  4. TObject

Descends from it: TBaseListMediator TComponentMediator

Description

The TBaseMediator class provides automatic data binding between model objects (subjects) and view components. It implements the observer pattern to automatically synchronize data when either the model or view changes.

The mediator supports bidirectional data binding, read-only modes, and custom data transfer events. Subjects must implement the IFPObserved interface, while views must have published properties that can be accessed by name.

This class serves as the base class for more specialized mediators like list mediators and component mediators, providing common functionality for property validation, observer management, and data transfer coordination.

See also

Properties

ViewPropertyNameprotected
Transferringprotected
SubjectpublicModel object implementing IFPObserved interface
ViewpublicView component for data display and editing
ValuelistpublicOptional list of values for list-based mediators
SubjectPropertyNamepublishedName of property in subject object to mediate
ActivepublishedEnables or disables automatic data synchronization
ReadOnlypublishedPrevents data transfer from view to subject when True

Methods

PublishedViewPropertyprotected
PublishedSubjectPropertyprotected
SetActiveprotected
SetSubjectprotected
SetSubjectPropertyNameprotected
ViewChangedHandlerprotected
CheckPropertyNameprotected
MaybeObjectToViewprotected
MaybeViewToObjectprotected
CheckViewSubjectprotected
DoObjectToViewprotected
DoViewToObjectprotected
GetViewprotected
ViewChangedprotected
ValuelistChangedprotected
FPOObservedChangedprotected
RaiseMediatorErrorprotected
DestroypublicDestroys the mediator and cleans up observer attachments
ObjectToViewpublicCopies data from subject object to view component
ViewToObjectpublicCopies data from view component to subject object
ViewClasspublicReturns the minimum view class this mediator can handle
CompositeMediatorpublicIndicates whether this is a composite mediator

Events

OnViewToObjectpublishedEvent triggered when copying data from view to subject
OnObjectToViewpublishedEvent triggered when copying data from subject to view

Inherited

From TComponent (75)

_AddRef _Release BeforeDestruction CanObserve ChangeName ComObject ComponentCount ComponentIndex Components ComponentState ComponentStyle Create DefineProperties DesignInfo DestroyComponents Destroying ExecuteAction FindComponent FreeNotification FreeOnRelease GetChildOwner GetChildParent GetChildren GetDeltaStreams GetEnumerator GetIDsOfNames GetNamePath GetObservers GetOwner GetParentComponent GetTypeInfo GetTypeInfoCount HasParent iicrGetComponent InsertComponent Invoke IsImplementorOf Loaded Loading Name Notification ObserverAdded Observers OnGetDeltaStreams Owner PaletteCreated QueryInterface ReadDeltaState ReadDeltaStream ReadState ReferenceInterface RemoveComponent RemoveFreeNotification RemoveFreeNotifications SafeCallException SetAncestor SetChildOrder SetDesigning SetDesignInstance SetInline SetName SetParentComponent SetSubComponent Tag ToString TToStringNameMode UpdateAction Updated UpdateRegistry Updating ValidateContainer ValidateInsert ValidateRename VCLComObject WriteState

From TPersistent (5)

Assign AssignTo FPOAttachObserver FPODetachObserver FPONotifyObservers

From TObject (37)

AfterConstruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance DefaultHandler DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf Equals FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName newinstance QualifiedClassName StringMessageTable SystemHasExtendedRTTI UnitName

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.