TCustomerMidasPageProducer
HTML Generation
JavaScript Generation
Interfaces

TCustomMidasPageProducer

TCustomMidasPageProducer is a container for TComponent derived classes that implement the IWebComponent interface. Each component may implement additional interfaces depending on the components capabilities. When a request is made for the content of TCustomMidasPageProducer, the child components are traversed. At this time, components may generated JavaScript as well as HTML elements such as FORM, TABLE, and INPUT.

HTML Generation

Components that generate HTML implement the IWebContent interface. For example, a TFieldText component generates an INPUT element. Container components are responsible for requesting content from their children.

In order to control the layout of child components, container components pass a layout object in each content request. Layout objects implement the ILayoutWebContent interface. For example, the TFieldGroup component arranges the labels and INPUT elements using a TABLE element.

JavaScript Generation

Components that generate JavaScript implement the IScriptComponent interface. Components call the IAddScriptElements interface to add JavaScript variables, functions, and so forth. Components can find out about JavaScript generated by other components using the IScriptManager interface.

Interfaces

Required

IWebComponent

HTML Content

IWebContent
ILayoutWebContent
IHTMLForm
IHTMLField

XML Data Aware

IDataSetComponent
IDataSetFields
IDataSetField

Query

IQueryField
IQueryFields

Script Management

IAddScriptElements
IScriptManager
IScriptComponent
IXMLDisplay

Component Editor

IWebComponentEditor
IRestoreDefaults

Required

IWebComponent

All children of TMidasPageProducer must support the IWebComponent interface. This interface is used to define the positional and parent/child relationships between components.

  IWebComponent = interface
  ['{EB813782-EEAE-11D2-AFB0-00C04FB16EC3}']
    function GetIndex: Integer;
    procedure SetIndex(Value: Integer);
    procedure SetContainer(Container: TWebComponentContainer);
    function GetContainer: TWebComponentContainer;
    procedure SetComponentList(List: TObject);
    property Index: Integer read GetIndex write SetIndex;
    property Container: TWebComponentContainer read GetContainer 
      write SetContainer;
    property ComponentList: TObject write SetComponentList;
  end;

HTML Content

IWebContent

InterfaceExpress components that provide HTML content must implement this interface. Typically components call an implementation of ILayoutWebContent to add HTML elements to the page.

  IWebContent = interface
  ['{1B3E1CD1-DF59-11D2-AA45-00A024C11562}']
    function Content(Options: TWebContentOptions;
      ParentLayout: TLayout): string;
  end;

ILayoutWebContent

Layout manager implement this interface. Layout managers are responsible for arranging HTML elements on the page. The default layout manager arranges inputs and labels using a TABLE element.

  ILayoutWebContent = interface
  ['{4E810ED1-F09B-11D2-AA53-00A024C11562}']
    function LayoutButton(const HTMLButton: string; 
      Attributes: TLayoutAttributes): string;
    function LayoutField(const HTMLField: string; 
      Attributes: TLayoutAttributes): string;
    function LayoutLabelAndField(const HTMLLabel, HTMLField: string; 
      Attributes: TLayoutAttributes): string;
    function LayoutTable(const HTMLTable: string; 
      Attributes: TLayoutAttributes): string;
  end;

IHTMLForm

Components that generated FORM elements implement this interface.

  IHTMLForm = interface
  ['{394C5DD7-F252-11D2-AA55-00A024C11562}']
    function GetHTMLFormName: string;
    function GetHTMLFormVarName: string;
    property HTMLFormName: string read GetHTMLFormName;
    property HTMLFormVarName: string read GetHTMLFormVarName;
  end;

IHTMLField

Components that generate INPUT elements implement this interface

  IHTMLField = interface
  ['{C72355D9-FE5C-11D2-AFC5-00C04FB16EC3}']
    function GetHTMLControlName: string;
    property HTMLControlName: string read GetHTMLControlName;
  end;

XML Data Aware

IDataSetComponent

Components that bind to an XMLBroker implement this interface. TDataGridand TFieldGroup are examples.

  IDataSetComponent = interface
  ['{D1AE355D-F1C3-11D2-AFB3-00C04FB16EC3}']
    function GetXMLBroker: TXMLBroker;
    function GetDataSet: IMidasWebDataSet;
    function GetXMLDataSet: TXMLDataSet;
    property DataSet: IMidasWebDataSet read GetDataSet;
    property XMLBroker: TXMLBroker read GetXMLBroker;
    property XMLDataSet: TXMLDataSet read GetXMLDataSet;
  end;

IDataSetFields

Components that contain data aware fields implement this interface. TDataGridand TFieldGroup are examples.

  IDataSetFields = interface
  ['{394C5DD4-F252-11D2-AA55-00A024C11562}']
    procedure ValidateDataSet;
    procedure GetFieldsList(AList: TStrings);
    function IsFieldInUse(AName: string): Boolean;
    function HasStatusField: Boolean;
    function GetVisibleFields: TWebComponentList;
    property VisibleFields: TWebComponentList read GetVisibleFields;
  end;

IDataSetField

Components that bind to field in field from IDataSetFields.GetFieldsList implement this interface. TFieldText is an example.

  IDataSetField = interface(IHTMLField)
  ['{394C5DD5-F252-11D2-AA55-00A024C11562}']
    procedure SetFieldName(AFieldName: string);
    function GetFieldName: string;
    function GetRowSetFieldAttributes(const FieldVarName: string): string;
    property FieldName: string read GetFieldName write SetFieldName;
  end;

Query

IQueryField

Components that bind to field in IQueryFields.GetParmsList implement this interface. TQuerySelectOptions is an example.

  IQueryField = interface(IHTMLField)
  ['{7C321115-FCFB-11D2-AFC3-00C04FB16EC3}']
    function GetParamName: string;
    procedure SetParamName(AParamName: string);
    function GetText: string;
    procedure SetText(const Value: string);
    property ParamName: string read GetParamName write SetParamName;
    property Text: string read GetText write SetText;
  end;

IQueryFields

Components that contain query fields implement this interface. TQueryFieldGroup is an example.

  IQueryFields = interface
  ['{DADD9F42-FD2B-11D2-AA78-00A024C11562}']
    procedure ValidateDataSet;
    function IsParamInUse(AName: string): Boolean;
    procedure GetParamsList(AList: TStrings);
  end;

Script Management

IAddScriptElements

Components call this interface to add JavaScript to the page.

  IAddScriptElements = interface
  ['{2FF3A331-E790-11D2-AFA7-00C04FB16EC3}']
    function GetScriptManager: IScriptManager;
    function AddIncludeFile(FileName: string): Boolean;
    function AddRowSet(XMLProducer: TComponent; Path: TStrings): Boolean;
    function AddScriptBlock(Name: string; Script: string): Boolean;
    function AddHTMLBlock(Name: string; HTML: string): Boolean;
    function AddVar(Name: string; Script: string): Boolean;
    function AddFunction(Name: string; Body: string): Boolean;
    procedure AddError(Text: string);
    procedure AddPass(Event: TAddScriptElementsEvent; Data: Pointer);
    procedure AddScriptComponents(List: TObject);
    property ScriptManager: IScriptManager read GetScriptManager;
  end;

IScriptManager

Components call this interface to find out about the JavaScript that has been added to the page by other components.

  IScriptManager = interface
  ['{94B8B14E-E6D6-11D2-AFA6-00C04FB16EC3}']
    function GetXMLDocuments: IXMLDocuments;
    function GetIncludeFiles: IIncludeFiles;
    function GetFunctions: IFunctions;
    function GetWarnings: TStrings;
    function GetScriptBlocks: IScriptBlocks;
    function GetVars: IVars;
    function GetHTMLBlocks: IHTMLBlocks;
    function GetOptions: TWebContentOptions;
    function GetAddElementsIntf: IAddScriptElements;
    procedure AddError(const Error: string);
    property XMLDocuments: IXMLDocuments read GetXMLDocuments;
    property IncludeFiles: IIncludeFiles read GetIncludeFiles;
    property Warnings: TStrings read GetWarnings;
    property Functions: IFunctions read GetFunctions;
    property Vars: IVars read GetVars;
    property ScriptBlocks: IScriptBlocks read GetScriptBlocks;
    property HTMLBlocks: IHTMLBlocks read GetHTMLBlocks;
    property Options: TWebContentOptions read GetOptions;
    property AddElementsIntf: IAddScriptElements 
      read GetAddElementsIntf;
  end;

IScriptComponent

Components that generated JavaScript implement this interface.

  IScriptComponent = interface
  ['{1B9B0962-D28E-11D2-AF8A-00C04FB16EC3}']
    procedure AddElements(AddIntf: IAddScriptElements);
    function GetSubComponents: TObject; 
    property SubComponents: TObject read GetSubComponents;
  end;

IXMLDisplay

Components that define XMLRowSets implement this interface so that child components can retrieve information about the RowSet.

  IXMLDisplay = interface
  ['{394C5DD6-F252-11D2-AA55-00A024C11562}']
    function GetXMLDisplayName: string;
    function GetXMLRowSetName: string;
    function GetIsMultipleRecordView: Boolean;
    property XMLRowSetName: string read GetXMLRowSetName;
    property XMLDisplayName: string read GetXMLDisplayName;
    property IsMultipleRecordView: Boolean 
      read GetIsMultipleRecordView;
  end;

Component Editor

IWebComponentEditor

Container components implement this interface so that the component editor can determine the child classes that are valid children.

  IWebComponentEditor = interface
  ['{13F59F61-EF85-11D2-AFB1-00C04FB16EC3}']
    function CanAddClass(AParent: TComponent; AClass: TClass): Boolean;
  end;

IRestoreDefaults

Components that support the restore defaults command implement this interface.

  IRestoreDefaults = interface
  ['{394C5DD3-F252-11D2-AA55-00A024C11562}']
    procedure RestoreDefaults;
  end;