Procedure

TfrmTemplateEditor.Resync

Module

fTemplateEditor

Last Modified

7/15/2014 3:26:44 PM

Visibility

Protected

Owner

TfrmTemplateEditor

Declaration

procedure Resync(const Templates: array of TTemplate);

Calls Hierarchy


TfrmTemplateEditor.Resync
 ├TdmodShared.Resync
 │ ├InSyncNode
 │ ├GetID
 │ │ └..(rec)..
 │ ├TTemplate.RemoveNode
 │ ├BuildNodes
 │ │ ├TTemplate.AddNode
 │ │ ├TTemplate.GetItems
 │ │ │ └ExpandTemplate
 │ │ │   ├TTemplate.GetChildren
 │ │ │   ├GetTemplateChildren
 │ │ │   ├AddTemplate
 │ │ │   │ ├TTemplate.Create
 │ │ │   │ │ └TTemplate.ReminderDialogIEN
 │ │ │   │ └TTemplate.AddChild
 │ │ │   │   └TTemplate.GetItems...
 │ │ │   └TTemplate.ItemIENs
 │ │ │     └TTemplate.GetItems...
 │ │ ├..(rec)..
 │ │ └TTemplate.GetChildren
 │ └GetNode
 │   └GetID...
 ├TfrmTemplateEditor.EnableNavControls
 │ └TfrmTemplateEditor.AllowMove
 │   ├TfrmTemplateEditor.IsTemplateLocked
 │   │ ├TTemplate.AutoLock
 │   │ │ └TTemplate.LinkType
 │   │ ├TTemplate.IsLocked
 │   │ │ └TTemplate.AutoLock...
 │   │ └..(rec)..
 │   └TTemplate.GetItems...
 └TfrmTemplateEditor.tvTreeChange
   ├TfrmTemplateEditor.ChangeTree
   ├TfrmTemplateEditor.IsTemplateLocked...
   ├TfrmTemplateEditor.EnableControls
   │ ├TfrmTemplateEditor.UpdateInsertsDialogs
   │ │ ├TfrmTemplateObjects.UpdateStatus
   │ │ └TfrmTemplateFields.UpdateStatus
   │ │   └TfrmTemplateFields.ValidInsert
   │ └TfrmTemplateEditor.EnableNavControls...
   └TfrmTemplateEditor.ShowInfo
     ├TfrmTemplateEditor.ShowTemplateType
     ├TfrmTemplateEditor.GetLinkType
     ├LoadServiceListWithSynonyms
     ├TTemplate.LinkName
     │ ├GetLinkName
     │ │ └ExternalName
     │ ├TTemplate.LinkIEN
     │ └TTemplate.LinkType
     ├TTemplate.LinkIEN
     ├TTemplate.GetDescription
     │ └LoadTemplateDescription
     ├TTemplate.IsLocked...
     ├TTemplate.AutoLock...
     ├TfrmTemplateEditor.IsTemplateLocked...
     ├TTemplate.GetChildren
     ├TTemplate.ReminderDialogIEN
     ├TdmodShared.InDialog
     │ └TTemplate.IsDialog
     ├TTemplate.GetBoilerplate
     │ └GetTemplateBoilerplate
     ├TfrmTemplateEditor.DisplayBoilerplate
     │ ├TfrmTemplateEditor.pnlBoilerplateResize
     │ ├TTemplate.GetBoilerplate...
     │ ├TTemplate.FullBoilerplate
     │ │ ├TTemplate.GetBoilerplate...
     │ │ ├TTemplate.ItemBoilerplate
     │ │ │ ├TTemplate.GetItems...
     │ │ │ ├TTemplate.GetTemplateType
     │ │ │ ├DlgText
     │ │ │ └TTemplate.DialogProperties
     │ │ │   ├TTemplate.GetBoilerplate...
     │ │ │   └TTemplate.DlgID
     │ │ ├DlgText
     │ │ └TTemplate.DialogProperties...
     │ ├TfrmTemplateEditor.UpdateInsertsDialogs...
     │ ├TfrmTemplateEditor.ShowBoilerPlate
     │ └TfrmTemplateEditor.ShowGroupBoilerplate
     ├TfrmTemplateEditor.ShowGroupBoilerplate
     └TfrmTemplateEditor.pnlBoilerplateResize

Called-By Hierarchy


                     TfrmTemplateEditor.Resync
              TfrmTemplateEditor.btnNewClick┤ 
                             EditTemplates┤ │ 
     TfrmDCSumm.popSummMemoTemplateClick┤ │ │ 
          TfrmDCSumm.mnuNewTemplateClick┤ │ │ 
        TfrmDCSumm.mnuEditTemplatesClick┤ │ │ 
  TfrmDCSumm.mnuEditSharedTemplatesClick┤ │ │ 
    TfrmDCSumm.mnuNewSharedTemplateClick┤ │ │ 
   TfrmConsults.popNoteMemoTemplateClick┤ │ │ 
      TfrmConsults.mnuEditTemplatesClick┤ │ │ 
        TfrmConsults.mnuNewTemplateClick┤ │ │ 
TfrmConsults.mnuEditSharedTemplatesClick┤ │ │ 
  TfrmConsults.mnuNewSharedTemplateClick┤ │ │ 
       TfrmDrawers.mnuEditTemplatesClick┤ │ │ 
         TfrmDrawers.mnuNewTemplateClick┤ │ │ 
    TfrmSurgery.popNoteMemoTemplateClick┤ │ │ 
       TfrmSurgery.mnuEditTemplatesClick┤ │ │ 
         TfrmSurgery.mnuNewTemplateClick┤ │ │ 
 TfrmSurgery.mnuEditSharedTemplatesClick┤ │ │ 
   TfrmSurgery.mnuNewSharedTemplateClick┤ │ │ 
      TfrmNotes.popNoteMemoTemplateClick┤ │ │ 
         TfrmNotes.mnuEditTemplatesClick┤ │ │ 
           TfrmNotes.mnuNewTemplateClick┤ │ │ 
   TfrmNotes.mnuEditSharedTemplatesClick┤ │ │ 
     TfrmNotes.mnuNewSharedTemplateClick┘ │ │ 
        TfrmTemplateEditor.mnuAutoGenClick┤ │ 
 TfrmTemplateEditor.mnuImportTemplateClick┘ │ 
            TfrmTemplateEditor.sbMoveUpClick┤ 
          TfrmTemplateEditor.sbMoveDownClick┤ 
            TfrmTemplateEditor.sbDeleteClick┤ 
     TfrmTemplateEditor.mnuNodeDeleteClick┤ │ 
          TfrmTemplateEditor.tvTreeKeyDown┘ │ 
           TfrmTemplateEditor.tvTreeDragDrop┤ 
        TfrmTemplateEditor.sbCopyLeftClick┤ │ 
       TfrmTemplateEditor.sbCopyRightClick┤ │ 
      TfrmTemplateEditor.mnuNodePasteClick┘ │ 
             TfrmTemplateEditor.mnuSortClick┤ 
           TfrmTemplateEditor.TemplateLocked┘ 
             TfrmTemplateEditor.FormCreate┘   

Calls

Name Declaration Comments
TfrmTemplateEditor.EnableNavControls procedure EnableNavControls; -
TdmodShared.Resync procedure Resync(SyncNode: TTreeNode; AllowInactive: boolean; var EmptyCount: integer); -
TfrmTemplateEditor.tvTreeChange procedure tvTreeChange(Sender: TObject; Node: TTreeNode); -

Called-By

Name Declaration Comments
TfrmTemplateEditor.btnNewClick procedure btnNewClick(Sender: TObject); -
TfrmTemplateEditor.mnuSortClick procedure mnuSortClick(Sender: TObject); -
TfrmTemplateEditor.sbDeleteClick procedure sbDeleteClick(Sender: TObject); -
TfrmTemplateEditor.sbMoveDownClick procedure sbMoveDownClick(Sender: TObject); -
TfrmTemplateEditor.sbMoveUpClick procedure sbMoveUpClick(Sender: TObject); -
TfrmTemplateEditor.TemplateLocked procedure TemplateLocked(Sender: TObject); -
TfrmTemplateEditor.tvTreeDragDrop procedure tvTreeDragDrop(Sender, Source: TObject; X, Y: Integer); -


Source

2002  procedure TfrmTemplateEditor.Resync(const Templates: array of TTemplate);
2003  var
2004    i, j: integer;
2005    NodeList: TStringList;
2006    TemplateList: TStringList;
2007    Node: TTreeNode;
2008    tmpl: TTemplate;
2009    NodeID: string;
2010  
2011  begin
2012    NodeList := TStringList.Create;
2013    try
2014      TemplateList := TStringList.Create;
2015      try
2016        for i := low(Templates) to high(Templates) do
2017        begin
2018          tmpl := Templates[i];
2019          if (assigned(tmpl)) then
2020          begin
2021            for j := 0 to tmpl.Nodes.Count - 1 do
2022            begin
2023              Node := TTreeNode(tmpl.Nodes.Objects[j]);
2024              if (NodeList.IndexOfObject(Node) < 0) then
2025              begin
2026                NodeID := IntToStr(Node.Level);
2027                NodeID := copy('000', 1, 4 - length(NodeID)) + NodeID + U + tmpl.Nodes[j];
2028                TemplateList.AddObject(NodeID, tmpl);
2029                NodeList.AddObject(NodeId, Node);
2030              end;
2031            end;
2032          end;
2033        end;
2034  
2035      { By Sorting by Node Level, we prevent a Resync
2036        of nodes deeper within the heirchary }
2037  
2038        NodeList.Sort;
2039  
2040        for i := 0 to NodeList.Count - 1 do
2041        begin
2042          NodeID := NodeList[i];
2043          Node := TTreeNode(NodeList.Objects[i]);
2044          j := TemplateList.IndexOf(NodeID);
2045          if (j >= 0) then
2046          begin
2047            tmpl := TTemplate(TemplateList.Objects[j]);
2048            NodeID := Piece(NodeID, U, 2);
2049            if (tmpl.Nodes.IndexOf(NodeID) >= 0) then
2050            begin
2051              if (Node.TreeView = tvShared) then
2052                dmodShared.Resync(Node, not cbShHide.Checked, FSharedEmptyNodeCount)
2053              else
2054                if (Node.TreeView = tvPersonal) then
2055                  dmodShared.Resync(Node, not cbPerHide.Checked, FPersonalEmptyNodeCount);
2056            end;
2057          end;
2058        end;
2059      finally
2060        TemplateList.Free;
2061      end;
2062    finally
2063      NodeList.Free;
2064    end;
2065    EnableNavControls;
2066    if ((assigned(FCurTree)) and (assigned(FCurTree.Selected))) then
2067      tvTreeChange(FCurTree, FCurTree.Selected)
2068    else
2069      tvPersonal.Selected := tvPersonal.Items.GetFirstNode;
2070    FCopyNode := nil;
2071  end;