Skip to content

Commit

Permalink
Merge pull request #165 from HealthIntersections/gg-202111-adug-demo
Browse files Browse the repository at this point in the history
ready for adug demo
  • Loading branch information
grahamegrieve authored Nov 14, 2021
2 parents 917877a + 01285ea commit 1ca6a1b
Show file tree
Hide file tree
Showing 5 changed files with 535 additions and 355 deletions.
43 changes: 35 additions & 8 deletions library/fui/fui_lcl_managers.pas
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@
This unit contains a set of classes that orchestrate the UI interface
- TObjectManager - binds a set of edits that edit the properties of an object
- TListManager - binds a list of objects to a set of UI controls, with a TListView as the centerpiece
- TTreeManager - binds a tree of objects to a set of UI controls, with a TTreeView as a centerpiece
- TFHIRSynEditSynchroniser - keeps a SynEdit source for a resource in sync with a loaded resource
- TVTreeManager - binds a tree of objects to a set of UI controls, with a TVirtualStringTree as a centerpiece
- TPanelStack - binds to a TPanel and manages a set of subpanels that arew laid out vertically (logical alternative to a TPageControl)
- TObjectManager - binds a set of edits that edit the properties of an object
- TFHIRSynEditSynchroniser - keeps a SynEdit source for a resource in sync with a loaded resource
}

Expand Down Expand Up @@ -148,7 +149,6 @@ TListManager<T : TFslObject> = class abstract (TListOrTreeManagerBase)
Property Enabled : boolean read FEnabled write SetEnabled;
property Settings : TIniFile read FSettings write SetSettings;


// control
function doLoad : boolean; // call this when something changes the data to load
procedure saveStatus;
Expand All @@ -175,6 +175,7 @@ TListManager<T : TFslObject> = class abstract (TListOrTreeManagerBase)
function compareItem(left, right : T; col : integer) : integer; virtual; // if col is -1, then the comparison is for the object as a whole
function filterItem(item : T; s : String) : boolean; virtual;

procedure focusItemChange(item : T); virtual;
function addItem(mode : String) : T; virtual;
function editItem(item : T; mode : String) : boolean; virtual;
function deleteItem(item : T) : boolean; virtual;
Expand Down Expand Up @@ -252,6 +253,8 @@ TTreeManager<T : TFslTreeNode> = class abstract (TListOrTreeManagerBase)
function getSummaryText(item : T) : String; virtual;

procedure changed; virtual; // e.g. to save

procedure focusItemChange(item : T); virtual;
function addItem(parent : T; mode : String) : T; virtual;
function editItem(item : T; mode : String) : boolean; virtual;
function editItemText(parent, item : T; var text : String) : boolean; virtual;
Expand Down Expand Up @@ -333,6 +336,8 @@ TVTreeManager<T : TFslTreeNode> = class abstract (TListOrTreeManagerBase)
function getSummaryText(item : T) : String; virtual;

procedure changed; virtual; // e.g. to save

procedure focusItemChange(item : T); virtual;
function addItem(parent : T; mode : String) : T; virtual;
function editItem(item : T; mode : String) : boolean; virtual;
function editItemText(parent, item : T; var text : String) : boolean; virtual;
Expand Down Expand Up @@ -911,6 +916,7 @@ procedure TListManager<T>.updateStatus;
updateControls(copExecute, opExecute in ops);
FCanEdit := opEdit in ops;

focusItemChange(focus);
if assigned(FOnSetFocus) then
FOnSetFocus(self);
end;
Expand Down Expand Up @@ -1218,6 +1224,11 @@ function TListManager<T>.filterItem(item: T; s: String): boolean;
result := true;
end;

procedure TListManager<T>.focusItemChange;
begin
// nothing here
end;

function TListManager<T>.addItem(mode: String): T;
begin
result := nil;
Expand Down Expand Up @@ -1778,6 +1789,7 @@ procedure TTreeManager<T>.updateStatus;
updateControls(copExecute, opExecute in ops);
FCanEdit := opEdit in ops;

focusItemChange(focus);
if assigned(FOnSetFocus) then
FOnSetFocus(self);
end;
Expand Down Expand Up @@ -1877,6 +1889,11 @@ procedure TTreeManager<T>.changed;
// nothing
end;

procedure TTreeManager<T>.focusItemChange;
begin
// nothing here
end;

function TTreeManager<T>.addItem(parent : T; mode : String) : T;
begin
result := nil;
Expand Down Expand Up @@ -1980,8 +1997,12 @@ procedure TVTreeManager<T>.doAdd(mode: String);

procedure TVTreeManager<T>.doEdit(mode: String);
begin
changed;
raise ETodo.create('doEdit');
if focus <> nil then
if editItem(focus, mode) then
begin
updateStatus;
FTree.invalidateNode(focus.FPNode);
end;
end;

procedure TVTreeManager<T>.doDelete(mode: String);
Expand Down Expand Up @@ -2205,6 +2226,7 @@ procedure TVTreeManager<T>.updateStatus;
updateControls(copExecute, opExecute in ops);
FCanEdit := opEdit in ops;

focusItemChange(focus);
if assigned(FOnSetFocus) then
FOnSetFocus(self);
end;
Expand Down Expand Up @@ -2266,9 +2288,9 @@ procedure TVTreeManager<T>.doPaintTreeCell(Sender: TBaseVirtualTree; TargetCanva
fore := clBlack;
back := clWhite;
getCellColors(getT(node), fore, back);
TargetCanvas.Brush.Color := back;
TargetCanvas.Brush.Style := bsSolid;
TargetCanvas.Rectangle(cellRect);
//TargetCanvas.Brush.Color := back;
//TargetCanvas.Brush.Style := bsSolid;
//TargetCanvas.Rectangle(cellRect);
end;

procedure TVTreeManager<T>.doControl(sender: TObject);
Expand Down Expand Up @@ -2341,6 +2363,11 @@ procedure TVTreeManager<T>.changed;
// nothing
end;

procedure TVTreeManager<T>.focusItemChange;
begin
// nothing here
end;

function TVTreeManager<T>.addItem(parent : T; mode : String) : T;
begin
result := nil;
Expand Down
1 change: 1 addition & 0 deletions server/fhirconsole.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@
<Filename Value="test_form.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="TestForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit13>
</Units>
Expand Down
7 changes: 5 additions & 2 deletions server/fhirconsole.pas
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
fdb_odbc_fpc,
console_form,
console_tx_edit, console_ep_edit, install_form, install_log, installer,
test_form;
test_form;

{$R *.res}

Expand Down Expand Up @@ -72,7 +72,10 @@
Application.Scaled := True;

Application.Initialize;
Application.CreateForm(TMainConsoleForm, MainConsoleForm);
if (paramStr(1) = 'test-form') then
Application.CreateForm(TTestForm, TestForm)
else
Application.CreateForm(TMainConsoleForm, MainConsoleForm);
Application.Run;
end;
end.
Expand Down
Loading

0 comments on commit 1ca6a1b

Please sign in to comment.