FRAME_ObjListF.cpp 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "AppGlobalF.h"
  4. #include "ITSSkinF.h"
  5. #pragma hdrstop
  6. #include "FRAME_ObjListF.h"
  7. //---------------------------------------------------------------------------
  8. #pragma package(smart_init)
  9. #pragma link "cxButtons"
  10. #pragma link "cxCalc"
  11. #pragma link "cxCheckBox"
  12. #pragma link "cxClasses"
  13. #pragma link "cxContainer"
  14. #pragma link "cxControls"
  15. #pragma link "cxCustomData"
  16. #pragma link "cxData"
  17. #pragma link "cxDataStorage"
  18. #pragma link "cxDropDownEdit"
  19. #pragma link "cxEdit"
  20. #pragma link "cxFilter"
  21. #pragma link "cxGraphics"
  22. #pragma link "cxGrid"
  23. #pragma link "cxGridCustomTableView"
  24. #pragma link "cxGridCustomView"
  25. #pragma link "cxGridLevel"
  26. #pragma link "cxGridTableView"
  27. #pragma link "cxLookAndFeelPainters"
  28. #pragma link "cxLookAndFeels"
  29. #pragma link "cxMaskEdit"
  30. #pragma link "cxStyles"
  31. #pragma link "cxTextEdit"
  32. #pragma link "dxSkinsCore"
  33. #pragma link "dxSkinscxPCPainter"
  34. #pragma link "dxSkinBlack"
  35. #pragma link "dxSkinBlue"
  36. #pragma link "dxSkinMcSkin"
  37. #pragma link "cxLabel"
  38. #pragma resource "*.dfm"
  39. //TFRAMEObjList *FRAMEObjList;
  40. //---------------------------------------------------------------------------
  41. __fastcall TFRAMEObjList::TFRAMEObjList(TComponent* Owner)
  42. : TFrame(Owner)
  43. {
  44. m_pGDC = TvList->DataController;
  45. //TvList->OptionsView->NoDataToDisplayInfoText = "<Á¤º¸°¡ ¾ø½À´Ï´Ù>";
  46. Column05->Visible = false;
  47. Column06->Visible = false;
  48. Column07->Visible = false;
  49. Column08->Visible = false;
  50. Column09->Visible = false;
  51. Column10->Visible = false;
  52. Column11->Visible = false;
  53. Column13->Visible = false;
  54. if (g_AppCfg.sLang != "kr")
  55. {
  56. Column03->Caption = "Name";
  57. Column04->Caption = "Type";
  58. }
  59. }
  60. //---------------------------------------------------------------------------
  61. void __fastcall TFRAMEObjList::UpdateList()
  62. {
  63. CMM_ClearGridTableView(TvList);
  64. int nRow = 0;
  65. try
  66. {
  67. TvList->BeginUpdate();
  68. try
  69. {
  70. ObjCtlrManager->FLists.Lock();
  71. FOR_STL(TMonitoringCtlr*, pObj, ObjCtlrManager->FLists)
  72. {
  73. nRow = m_pGDC->AppendRecord();
  74. m_pGDC->Values[nRow][ColumnSel->Index] = false;
  75. m_pGDC->Values[nRow][Column00->Index] = "-";
  76. m_pGDC->Values[nRow][Column01->Index] = pObj->CCAM_ID;
  77. m_pGDC->Values[nRow][Column02->Index] = pObj->CTLR_ID;
  78. m_pGDC->Values[nRow][Column03->Index] = pObj->NAME;
  79. //m_pGDC->Values[nRow][Column04->Index] = pObj->INFO1;
  80. m_pGDC->Values[nRow][Column99->Index] = (int)pObj;
  81. m_pGDC->Values[nRow][Column11->Index] = pObj->CCAM_ID;
  82. m_pGDC->Values[nRow][Column12->Index] = pObj->CTLR_ID;
  83. }
  84. }
  85. __finally
  86. {
  87. ObjCtlrManager->FLists.UnLock();
  88. }
  89. }
  90. __finally
  91. {
  92. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  93. TvList->EndUpdate();
  94. TvList->DataController->GotoFirst();
  95. TvList->DataController->FocusedRecordIndex = 0;
  96. Column11->SortIndex = Column11->Index;
  97. Column11->SortOrder = soAscending;
  98. }
  99. }
  100. //---------------------------------------------------------------------------
  101. void __fastcall TFRAMEObjList::BtnAllSelectClick(TObject *Sender)
  102. {
  103. TcxButton *pBtn = (TcxButton*)Sender;
  104. CMM_CheckAllListItem(TvList, ColumnSel->Index, pBtn->Tag);
  105. }
  106. //---------------------------------------------------------------------------
  107. int __fastcall TFRAMEObjList::GetSelIds(String &ALinkIds)
  108. {
  109. ALinkIds = "";
  110. if (TvList->ViewData->RecordCount <= 0) return 0;
  111. int nIndex = m_pGDC->FocusedRecordIndex;
  112. if( nIndex < 0 )
  113. return 0;
  114. String sLinkId = VarToStr(m_pGDC->Values[nIndex][Column01->Index]);
  115. ALinkIds = sLinkId;
  116. return 1;
  117. }
  118. //---------------------------------------------------------------------------
  119. int __fastcall TFRAMEObjList::GetSelIds(TStringList *AStringList)
  120. {
  121. int nSelCnt = 0;
  122. try
  123. {
  124. TvList->BeginUpdate();
  125. int nRowCnt = TvList->ViewData->RecordCount;
  126. for (int ii = 0; ii < nRowCnt; ii++)
  127. {
  128. TcxCustomGridRow* ARow = TvList->ViewData->Rows[ii];
  129. if (((bool)ARow->Values[ColumnSel->Index]))
  130. {
  131. AStringList->Add(ARow->Values[Column01->Index]);
  132. nSelCnt++;
  133. }
  134. }
  135. }
  136. __finally
  137. {
  138. TvList->EndUpdate();
  139. }
  140. return nSelCnt;
  141. }
  142. //---------------------------------------------------------------------------
  143. void __fastcall TFRAMEObjList::TvListDataControllerFilterChanged(TObject *Sender)
  144. {
  145. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  146. }
  147. //---------------------------------------------------------------------------
  148. void __fastcall TFRAMEObjList::BtnExlSaveClick(TObject *Sender)
  149. {
  150. TcxGrid *pGrid = CxList;
  151. TcxGridTableView *pView = TvList;
  152. String sTitle= "Controller Information";
  153. CMM_ExportToExcelFile(sTitle, pGrid, pView, (TForm*)this);
  154. }
  155. //---------------------------------------------------------------------------
  156. void __fastcall TFRAMEObjList::OnCloseQuery(bool &CanClose)
  157. {
  158. }
  159. //---------------------------------------------------------------------------