1
0
mirror of synced 2024-11-21 10:53:50 +00:00

Added displaying of dictionary details to monitor form

This commit is contained in:
Mark van Renswoude 2016-10-14 17:02:27 +02:00
parent 1a22728f30
commit 24dc9481bd
4 changed files with 81 additions and 6 deletions

View File

@ -26,7 +26,7 @@ object MainForm: TMainForm
Margins.Top = 8 Margins.Top = 8
Margins.Right = 8 Margins.Right = 8
Margins.Bottom = 8 Margins.Bottom = 8
ActivePage = tsRollingFile ActivePage = tsNamedPipe
Align = alClient Align = alClient
Images = ilsObservers Images = ilsObservers
TabOrder = 0 TabOrder = 0
@ -531,6 +531,19 @@ object MainForm: TMainForm
OnClick = btnTimerStopClick OnClick = btnTimerStopClick
end end
end end
object tsStructured: TTabSheet
Caption = 'Structured'
ImageIndex = 4
object btnValueTypes: TButton
Left = 12
Top = 15
Width = 121
Height = 21
Caption = 'Value types test'
TabOrder = 0
OnClick = btnValueTypesClick
end
end
end end
object pnlDispatch: TPanel object pnlDispatch: TPanel
AlignWithMargins = True AlignWithMargins = True
@ -596,7 +609,7 @@ object MainForm: TMainForm
Left = 552 Left = 552
Top = 176 Top = 176
Bitmap = { Bitmap = {
494C01010200140058000C000C00FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 494C0101020014005C000C000C00FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000300000000C00000001002000000000000009 0000000000003600000028000000300000000C00000001002000000000000009
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000

View File

@ -79,6 +79,8 @@ type
rbRollingAbsolute: TRadioButton; rbRollingAbsolute: TRadioButton;
lblRollingDays: TLabel; lblRollingDays: TLabel;
edtRollingDays: TEdit; edtRollingDays: TEdit;
tsStructured: TTabSheet;
btnValueTypes: TButton;
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject); procedure FormDestroy(Sender: TObject);
@ -105,6 +107,7 @@ type
procedure TimerTimer(Sender: TObject); procedure TimerTimer(Sender: TObject);
procedure btnRollingFileStartClick(Sender: TObject); procedure btnRollingFileStartClick(Sender: TObject);
procedure btnRollingFileStopClick(Sender: TObject); procedure btnRollingFileStopClick(Sender: TObject);
procedure btnValueTypesClick(Sender: TObject);
private private
FLog: IX2Log; FLog: IX2Log;
FEventObserver: IX2LogObserver; FEventObserver: IX2LogObserver;
@ -468,4 +471,15 @@ begin
FLog.Info('Message 3'); FLog.Info('Message 3');
end; end;
procedure TMainForm.btnValueTypesClick(Sender: TObject);
begin
FLog.InfoS('Testing the various value types',
['String', 'Hello world!',
'DateTime', Now,
'Has the large hadron collider destroyed the world yet?', False,
'Float', 3.1415,
'Integer', 89740987342]);
end;
end. end.

View File

@ -136,6 +136,19 @@ object X2LogObserverMonitorForm: TX2LogObserverMonitorForm
AutoSize = True AutoSize = True
end end
end end
object vleDetailsDictionary: TValueListEditor
Left = 0
Top = 19
Width = 298
Height = 451
Align = alClient
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goColSizing, goAlwaysShowEditor, goThumbTracking]
TabOrder = 3
ExplicitTop = 0
ColWidths = (
150
142)
end
end end
end end
object pnlLog: TPanel object pnlLog: TPanel
@ -266,14 +279,12 @@ object X2LogObserverMonitorForm: TX2LogObserverMonitorForm
Margins.Bottom = 0 Margins.Bottom = 0
Panels = <> Panels = <>
SimplePanel = True SimplePanel = True
ExplicitLeft = 20
ExplicitTop = 503
end end
object ilsLog: TImageList object ilsLog: TImageList
Left = 448 Left = 448
Top = 48 Top = 48
Bitmap = { Bitmap = {
494C01010A004000F80010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 494C01010A004000FC0010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000003000000001002000000000000030 0000000000003600000028000000400000003000000001002000000000000030
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000

View File

@ -19,7 +19,7 @@ uses
Winapi.Messages, Winapi.Messages,
X2Log.Details.Intf, X2Log.Details.Intf,
X2Log.Intf; X2Log.Intf, Vcl.Grids, Vcl.ValEdit;
const const
@ -95,6 +95,7 @@ type
mmMainFileSep1: TMenuItem; mmMainFileSep1: TMenuItem;
mmMainFileSaveAs: TMenuItem; mmMainFileSaveAs: TMenuItem;
sdSaveAs: TSaveDialog; sdSaveAs: TSaveDialog;
vleDetailsDictionary: TValueListEditor;
procedure FormShow(Sender: TObject); procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormClose(Sender: TObject; var Action: TCloseAction);
@ -151,6 +152,7 @@ type
procedure SetDetails(ADetails: IX2LogDetails); procedure SetDetails(ADetails: IX2LogDetails);
procedure SetBinaryDetails(ADetails: IX2LogDetailsBinary); procedure SetBinaryDetails(ADetails: IX2LogDetailsBinary);
procedure SetGraphicDetails(ADetails: IX2LogDetailsGraphic); procedure SetGraphicDetails(ADetails: IX2LogDetailsGraphic);
procedure SetDictionaryDetails(ADetails: IX2LogDetailsDictionary);
procedure SetVisibleDetails(AControl: TControl); procedure SetVisibleDetails(AControl: TControl);
procedure SetWordWrap(AValue: Boolean); procedure SetWordWrap(AValue: Boolean);
@ -588,6 +590,7 @@ procedure TX2LogObserverMonitorForm.SetDetails(ADetails: IX2LogDetails);
var var
logDetailsGraphic: IX2LogDetailsGraphic; logDetailsGraphic: IX2LogDetailsGraphic;
logDetailsBinary: IX2LogDetailsBinary; logDetailsBinary: IX2LogDetailsBinary;
logDetailsDictionary: IX2LogDetailsDictionary;
logDetailsText: IX2LogDetailsText; logDetailsText: IX2LogDetailsText;
canWrap: Boolean; canWrap: Boolean;
@ -603,6 +606,9 @@ begin
else if Supports(ADetails, IX2LogDetailsBinary, logDetailsBinary) then else if Supports(ADetails, IX2LogDetailsBinary, logDetailsBinary) then
SetBinaryDetails(logDetailsBinary) SetBinaryDetails(logDetailsBinary)
else if Supports(ADetails, IX2LogDetailsDictionary, logDetailsDictionary) then
SetDictionaryDetails(logDetailsDictionary)
else if Supports(ADetails, IX2LogDetailsText, logDetailsText) then else if Supports(ADetails, IX2LogDetailsText, logDetailsText) then
begin begin
reDetails.Text := logDetailsText.AsString; reDetails.Text := logDetailsText.AsString;
@ -727,6 +733,33 @@ begin
end; end;
procedure TX2LogObserverMonitorForm.SetDictionaryDetails(ADetails: IX2LogDetailsDictionary);
var
key: string;
displayValue: string;
begin
vleDetailsDictionary.Strings.Clear;
for key in ADetails.Keys do
begin
displayValue := '<error>';
case ADetails.ValueType[key] of
StringValue: displayValue := ADetails.StringValue[key];
BooleanValue: displayValue := BoolToStr(ADetails.BooleanValue[key], True);
IntValue: displayValue := IntToStr(ADetails.IntValue[key]);
FloatValue: displayValue := FormatFloat('0.########', ADetails.FloatValue[key]);
DateTimeValue: displayValue := DateTimeToStr(ADetails.DateTimeValue[key]);
end;
vleDetailsDictionary.Values[key] := displayValue;
end;
SetVisibleDetails(vleDetailsDictionary);
end;
procedure TX2LogObserverMonitorForm.SetVisibleDetails(AControl: TControl); procedure TX2LogObserverMonitorForm.SetVisibleDetails(AControl: TControl);
begin begin
if Assigned(AControl) then if Assigned(AControl) then
@ -737,12 +770,16 @@ begin
reDetails.Visible := (AControl = reDetails); reDetails.Visible := (AControl = reDetails);
sbDetailsImage.Visible := (AControl = sbDetailsImage); sbDetailsImage.Visible := (AControl = sbDetailsImage);
vleDetailsDictionary.Visible := (AControl = vleDetailsDictionary);
if not reDetails.Visible then if not reDetails.Visible then
reDetails.Clear; reDetails.Clear;
if not sbDetailsImage.Visible then if not sbDetailsImage.Visible then
imgDetailsImage.Picture.Assign(nil); imgDetailsImage.Picture.Assign(nil);
if not vleDetailsDictionary.Visible then
vleDetailsDictionary.Strings.Clear;
end; end;