Unit 'fpobserver' Package
[Overview][Types][Classes][Procedures and functions][Index] [#fcl]

TBaseMediator

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Base class for mediating data between model and view objects

Declaration

Source position: fpobserver.pp line 58

type TBaseMediator = class(TComponent,IFPObserver)

public

  destructor Destroy; override;

  

Destroys the mediator and cleans up observer attachments

  procedure ObjectToView;

  

Copies data from subject object to view component

  procedure ViewToObject;

  

Copies data from view component to subject object

  class function ViewClass; virtual;

  

Returns the minimum view class this mediator can handle

  class function CompositeMediator; virtual;

  

Indicates whether this is a composite mediator

  property Subject: TObject; [rw]

  

Model object implementing IFPObserved interface

  property View: TObject; [r]

  

View component for data display and editing

  property Valuelist: TObjectList; [rw]

  

Optional list of values for list-based mediators

published

  property SubjectPropertyName: string; [rw]

  

Name of property in subject object to mediate

  property Active: Boolean; [rw]

  

Enables or disables automatic data synchronization

  property ReadOnly: Boolean; [rw]

  

Prevents data transfer from view to subject when True

  property OnViewToObject: TMediatingEvent; [rw]

  

Event triggered when copying data from view to subject

  property OnObjectToView: TMediatingEvent; [rw]

  

Event triggered when copying data from subject to view

end;

Inheritance

TBaseMediator

  

Base class for mediating data between model and view objects

|

TComponent,IFPObserver

|

TPersistent,IUnknown,IInterfaceComponentReference

|

TObject,IFPObserved

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

TObservedHook

  

Observer pattern helper class implementing IFPObserved interface

TComponentMediator

  

General-purpose mediator for any TComponent-based view


Documentation generated on: Dec 15 2025