Index: VerpakkingsDefinitie/ApplicationContext.pas =================================================================== diff -u -r603 -r607 --- VerpakkingsDefinitie/ApplicationContext.pas (.../ApplicationContext.pas) (revision 603) +++ VerpakkingsDefinitie/ApplicationContext.pas (.../ApplicationContext.pas) (revision 607) @@ -248,6 +248,41 @@ property InternalErrorMessage: string read FInternalErrorMessage write FInternalErrorMessage; end; + // VERPAKKING META + TProductVerpakkingMeta = class + private + FID: Integer; + FName: string; + FOptiType: string; + public + property ID: Integer read FID write FID; + property Name: string read FName write FName; + property OptiType: string read FOptiType write FOptiType; + end; + + TProductVerpakkingMetaContext = class(TSubject) + private + FProductGroepen: TList; + FMetas: TList; + + FIsOK: Boolean; + FErrorMessage: string; + FInternalErrorMessage: string; + + function GetProductGroepen: TReadOnlyList; + function GetProductMetas: TReadOnlyList; + public + constructor Create(); + property ProductGroepen: TReadOnlyList read GetProductGroepen; + procedure SetProductGroepen(Collection: TEnumerable); + property Metas: TReadOnlyList read GetProductMetas; + procedure SetMetas(Collection: TEnumerable); + + property IsOK: Boolean read FIsOK write FIsOK; + property ErrorMessage: string read FErrorMessage write FErrorMessage; + property InternalErrorMessage: string read FInternalErrorMessage write FInternalErrorMessage; + end; + // APPLICATION CONTEXT // Application context bevat alle sub-contexts TApplicationContext = class @@ -256,12 +291,15 @@ FUiInstellingenContext: TUiInstellingenContext; FProductsContext: TProductsContext; FProductDetailContext: TProductVerpakkingenContext; + FProductVerpakkingMetaContext: TProductVerpakkingMetaContext; public constructor Create(); property UserContext: TUserContext read FUserContext write FUserContext; property UiInstellingenContext: TUiInstellingenContext read FUiInstellingenContext write FUiInstellingenContext; property ProductsContext: TProductsContext read FProductsContext write FProductsContext; property ProductVerpakkingContext: TProductVerpakkingenContext read FProductDetailContext write FProductDetailContext; + property ProductVerpakkingMetaContext: TProductVerpakkingMetaContext read FProductVerpakkingMetaContext + write FProductVerpakkingMetaContext; end; implementation @@ -532,13 +570,47 @@ FParameters.AddRange(Collection); end; +// VERPAKKING META +constructor TProductVerpakkingMetaContext.Create(); +begin + inherited Create(); + + FProductGroepen := TList.Create(); + FMetas := TList.Create(); +end; + +function TProductVerpakkingMetaContext.GetProductGroepen(): TReadOnlyList; +begin + Result := TReadOnlyList.Create(FProductGroepen); +end; + +function TProductVerpakkingMetaContext.GetProductMetas(): TReadOnlyList; +begin + Result := TReadOnlyList.Create(FMetas); +end; + +procedure TProductVerpakkingMetaContext.SetProductGroepen(Collection: TEnumerable); +begin + FProductGroepen.Clear(); + FProductGroepen.AddRange(Collection); + self.Change(); +end; + +procedure TProductVerpakkingMetaContext.SetMetas(Collection: TEnumerable); +begin + FMetas.Clear(); + FMetas.AddRange(Collection); + self.Change(); +end; + // APPLICATION CONTEXT constructor TApplicationContext.Create(); begin FUserContext := TUserContext.Create(); FUiInstellingenContext := TUiInstellingenContext.Create(); FProductsContext := TProductsContext.Create(); FProductDetailContext := TProductVerpakkingenContext.Create(); + FProductVerpakkingMetaContext := TProductVerpakkingMetaContext.Create(); end; end.