Index: VerpakkingsDefinitie/ApplicationContext.pas =================================================================== diff -u -r579 -r580 --- VerpakkingsDefinitie/ApplicationContext.pas (.../ApplicationContext.pas) (revision 579) +++ VerpakkingsDefinitie/ApplicationContext.pas (.../ApplicationContext.pas) (revision 580) @@ -10,7 +10,7 @@ uses ObserverPattern, System.Generics.Collections, SysUtils, - OptiServerService, UI_Data; + OptiServerService; // SUB CONTEXTS: klassen die overeenkomen met bepaalde sub-context (bv. alles gerelateerd met authenticatie). @@ -34,16 +34,30 @@ end; // - UI instellingen + TPair = class + private + FKey: string; + FValue: string; + public + property Key: string read FKey write FKey; + property Value: string read FValue write FValue; + end; + TUiInstellingenContext = class(TSubject) private - FInstellingen: UI_Data.IXMLOptiBoxType; + FPositie: TList; + FPlaatsing: TList; + FRichting: TList; FIsOK: Boolean; FErrorMessage: string; FInternalErrorMessage: string; public + constructor Create(); procedure NotifyChanged(); - property Instellingen: UI_Data.IXMLOptiBoxType read FInstellingen write FInstellingen; + property Positie: TList read FPositie write FPositie; + property Plaatsing: TList read FPlaatsing write FPlaatsing; + property Richting: TList read FRichting write FRichting; property IsOK: Boolean read FIsOK write FIsOK; property ErrorMessage: string read FErrorMessage write FErrorMessage; property InternalErrorMessage: string read FInternalErrorMessage write FInternalErrorMessage; @@ -138,6 +152,14 @@ end; // UiInstellingen +constructor TUiInstellingenContext.Create(); +begin + inherited Create(); + FPositie := TList.Create(); + FPlaatsing := TList.Create(); + FRichting := TList.Create(); +end; + procedure TUiInstellingenContext.NotifyChanged(); begin self.Change(); Index: VerpakkingsDefinitie/WS/ProductsAgent.pas =================================================================== diff -u -r579 -r580 --- VerpakkingsDefinitie/WS/ProductsAgent.pas (.../ProductsAgent.pas) (revision 579) +++ VerpakkingsDefinitie/WS/ProductsAgent.pas (.../ProductsAgent.pas) (revision 580) @@ -84,8 +84,10 @@ procedure TProductsAgent.RegistreerMislukteOpzoeking(UiInstellingenContext: TUiInstellingenContext; pxStatusObj: OptiServerService.pxStatus); begin - // Ander velden leegmaken - UiInstellingenContext.Instellingen := nil; + // Andere velden leegmaken + UiInstellingenContext.Positie.Clear(); + UiInstellingenContext.Plaatsing.Clear(); + UiInstellingenContext.Richting.Clear(); UiInstellingenContext.IsOK := pxStatusObj.IsOK; UiInstellingenContext.ErrorMessage := pxStatusObj.Message_; @@ -111,14 +113,55 @@ procedure TProductsAgent.RegistreerLoadResultaten(UiInstellingenContext: TUiInstellingenContext; Instellingen: UI_Data.IXMLOptiBoxType); +var + Node: IXMLNode; + I: Integer; + NewPair: TPair; begin // Ander velden leegmaken UiInstellingenContext.IsOK := True; UiInstellingenContext.ErrorMessage := ''; UiInstellingenContext.InternalErrorMessage := ''; - UiInstellingenContext.Instellingen := Instellingen; + UiInstellingenContext.Positie.Clear(); + if Instellingen.Positie <> nil then + begin + for I := 0 to Instellingen.Positie.Count - 1 do + begin + Node := Instellingen.Positie[I]; + NewPair := TPair.Create(); + NewPair.Key := Node.GetAttributeNS('Key', ''); + NewPair.Value := Node.Text; + UiInstellingenContext.Positie.Add(NewPair); + end; + end; + UiInstellingenContext.Plaatsing.Clear(); + if Instellingen.Positie <> nil then + begin + for I := 0 to Instellingen.Plaatsing.Count - 1 do + begin + Node := Instellingen.Plaatsing[I]; + NewPair := TPair.Create(); + NewPair.Key := Node.GetAttributeNS('Key', ''); + NewPair.Value := Node.Text; + UiInstellingenContext.Plaatsing.Add(NewPair); + end; + end; + + UiInstellingenContext.Richting.Clear(); + if Instellingen.Positie <> nil then + begin + for I := 0 to Instellingen.Richting.Count - 1 do + begin + Node := Instellingen.Richting[I]; + NewPair := TPair.Create(); + NewPair.Key := Node.GetAttributeNS('Key', ''); + NewPair.Value := Node.Text; + UiInstellingenContext.Richting.Add(NewPair); + end; + end; + UiInstellingenContext.NotifyChanged(); end;