unit ProductDetailScherm; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Subscherm, Main, ApplicationContext, ObserverPattern, Vcl.ComCtrls; type TFormProductDetail = class(TFormSubscherm) LabelOmschrijving1: TLabel; LabelOmschrijving2: TLabel; Label1: TLabel; LabelProductNaam: TLabel; ListViewDozen: TListView; GroupBox1: TGroupBox; ButtonNieuw: TButton; ButtonVerwijder: TButton; ButtonMaakDozen: TButton; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label7: TLabel; Label8: TLabel; Label9: TLabel; Label10: TLabel; Label11: TLabel; Label12: TLabel; Label13: TLabel; Label14: TLabel; Label15: TLabel; EditMeta: TEdit; EditVolumeVan: TEdit; ComboBoxDeelVan: TComboBox; EditBreedte: TEdit; EditDiepte: TEdit; EditHoogte: TEdit; EditMaxCombAantal: TEdit; EditAantal: TEdit; MemoParameters: TMemo; ComboBoxPlaatsing: TComboBox; ComboBoxPositie: TComboBox; ComboBoxRichting: TComboBox; ComboBoxOptiType: TComboBox; ComboBoxBoxSelect: TComboBox; ButtonMeta: TButton; ButtonDeelVan: TButton; procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); private FProductDetailsSubject: TSubject; FProductDetailsSubjectObserver: TSubjectObserver; procedure UpdateGui(Sender: TObject); public Constructor Create(AOwner: TComponent; Navigator: INavigator; ApplicationContext: TApplicationContext; ProductDetailsSubject: TSubject); end; implementation uses OptiServerService; {$R *.dfm} Constructor TFormProductDetail.Create(AOwner: TComponent; Navigator: INavigator; ApplicationContext: TApplicationContext; ProductDetailsSubject: TSubject); begin inherited Create(AOwner, Navigator, ApplicationContext); self.FProductDetailsSubject := ProductDetailsSubject; self.FProductDetailsSubjectObserver := TSubjectObserver.Create(self); self.FProductDetailsSubjectObserver.OnChange := UpdateGui; end; procedure TFormProductDetail.FormCreate(Sender: TObject); begin FProductDetailsSubject.RegisterObserver(FProductDetailsSubjectObserver); end; procedure TFormProductDetail.FormDestroy(Sender: TObject); begin FProductDetailsSubject.UnregisterObserver(FProductDetailsSubjectObserver); end; procedure TFormProductDetail.UpdateGui(Sender: TObject); var ProductDetailInformatie: OptiServerService.pxBoxData; begin if ApplicationContext.ProductDetailContext.GeselecteerdProduct <> nil then begin // Update with data from ApplicationContext LabelOmschrijving1.Caption := ApplicationContext.ProductDetailContext.GeselecteerdProduct.Omschrijving1; LabelOmschrijving2.Caption := ApplicationContext.ProductDetailContext.GeselecteerdProduct.Omschrijving2; end; if ApplicationContext.ProductDetailContext.ProductDetailInformatie <> nil then begin ProductDetailInformatie := ApplicationContext.ProductDetailContext.ProductDetailInformatie; ListViewDozen.Clear(); With ListViewDozen.Items.Add Do begin // List view (grid) // Caption := IntToStr(Product.ProductNr); // Deze casting geeft geen access violation Caption := IntToStr(ProductDetailInformatie.CutOrder); SubItems.Add(ProductDetailInformatie.MetaCaption); SubItems.Add(ProductDetailInformatie.Breedte + ' x ' + ProductDetailInformatie.Diepte + ' x ' + ProductDetailInformatie.Hoogte); SubItems.Add(ProductDetailInformatie.Aantal); SubItems.Add(ProductDetailInformatie.MaxCombinAantal); SubItems.Add(ProductDetailInformatie.DeelVanCaption); // Linkerhelft { TODO : Defaultwaarden uit DefaultData halen indien gewone waarden niet zijn ingevuld } EditMeta.Text := ProductDetailInformatie.MetaCaption; EditVolumeVan.Text := ProductDetailInformatie.VolumeVanCaption; ComboBoxDeelVan.Items.Add(ProductDetailInformatie.DeelVanCaption); EditBreedte.Text := ProductDetailInformatie.Breedte; EditDiepte.Text := ProductDetailInformatie.Diepte; EditHoogte.Text := ProductDetailInformatie.Hoogte; EditMaxCombAantal.Text := ProductDetailInformatie.MaxCombinAantal; EditAantal.Text := ProductDetailInformatie.Aantal; // Rechterhelft { TODO : Plaatsing: PPSPrioriteit } { TODO : Dropdown met check boxes. Positie: Defaultwaarden en veld Positie } { TODO : Dropdown met check boxes. Rotatie heeft default waarden van Richting X; Y; Z; F; Veld in XML is Rotatie met 1 waarde } end; end; end; end.