FRAME_ObjListF.cpp 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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 resource "*.dfm"
  38. //TFRAMEObjList *FRAMEObjList;
  39. //---------------------------------------------------------------------------
  40. __fastcall TFRAMEObjList::TFRAMEObjList(TComponent* Owner)
  41. : TFrame(Owner)
  42. {
  43. m_pGDC = TvList->DataController;
  44. //TvList->OptionsView->NoDataToDisplayInfoText = "<Á¤º¸°¡ ¾ø½À´Ï´Ù>";
  45. Column05->Visible = false;
  46. Column06->Visible = false;
  47. Column07->Visible = false;
  48. Column08->Visible = false;
  49. Column09->Visible = false;
  50. Column10->Visible = false;
  51. Column11->Visible = false;
  52. Column13->Visible = false;
  53. if (g_AppCfg.sLang != "kr")
  54. {
  55. Column03->Caption = "Name";
  56. Column04->Caption = "Type";
  57. }
  58. }
  59. //---------------------------------------------------------------------------
  60. void __fastcall TFRAMEObjList::UpdateList()
  61. {
  62. CMM_ClearGridTableView(TvList);
  63. int nRow = 0;
  64. try
  65. {
  66. TvList->BeginUpdate();
  67. try
  68. {
  69. ObjCtlrManager->FLists.Lock();
  70. FOR_STL(TMonitoringCtlr*, pObj, ObjCtlrManager->FLists)
  71. {
  72. nRow = m_pGDC->AppendRecord();
  73. m_pGDC->Values[nRow][ColumnSel->Index] = false;
  74. m_pGDC->Values[nRow][Column00->Index] = "-";
  75. m_pGDC->Values[nRow][Column01->Index] = String(pObj->CTLR_NMBR);
  76. m_pGDC->Values[nRow][Column02->Index] = pObj->CTLR_ID;
  77. m_pGDC->Values[nRow][Column03->Index] = pObj->NAME;
  78. //m_pGDC->Values[nRow][Column04->Index] = pObj->INFO1;
  79. m_pGDC->Values[nRow][Column99->Index] = (int)pObj;
  80. m_pGDC->Values[nRow][Column11->Index] = pObj->CTLR_NMBR;
  81. m_pGDC->Values[nRow][Column12->Index] = pObj->CTLR_ID;
  82. }
  83. }
  84. __finally
  85. {
  86. ObjCtlrManager->FLists.UnLock();
  87. }
  88. }
  89. __finally
  90. {
  91. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  92. TvList->EndUpdate();
  93. TvList->DataController->GotoFirst();
  94. TvList->DataController->FocusedRecordIndex = 0;
  95. Column11->SortIndex = Column11->Index;
  96. Column11->SortOrder = soAscending;
  97. }
  98. }
  99. //---------------------------------------------------------------------------
  100. void __fastcall TFRAMEObjList::BtnAllSelectClick(TObject *Sender)
  101. {
  102. TcxButton *pBtn = (TcxButton*)Sender;
  103. CMM_CheckAllListItem(TvList, ColumnSel->Index, pBtn->Tag);
  104. }
  105. //---------------------------------------------------------------------------
  106. int __fastcall TFRAMEObjList::GetSelIds(String &ALinkIds)
  107. {
  108. ALinkIds = "";
  109. if (TvList->ViewData->RecordCount <= 0) return 0;
  110. int nIndex = m_pGDC->FocusedRecordIndex;
  111. if( nIndex < 0 )
  112. return 0;
  113. String sLinkId = VarToStr(m_pGDC->Values[nIndex][Column01->Index]);
  114. ALinkIds = sLinkId;
  115. return 1;
  116. }
  117. //---------------------------------------------------------------------------
  118. int __fastcall TFRAMEObjList::GetSelIds(TStringList *AStringList)
  119. {
  120. int nSelCnt = 0;
  121. try
  122. {
  123. TvList->BeginUpdate();
  124. int nRowCnt = TvList->ViewData->RecordCount;
  125. for (int ii = 0; ii < nRowCnt; ii++)
  126. {
  127. TcxCustomGridRow* ARow = TvList->ViewData->Rows[ii];
  128. if (((bool)ARow->Values[ColumnSel->Index]))
  129. {
  130. AStringList->Add(ARow->Values[Column01->Index]);
  131. nSelCnt++;
  132. }
  133. }
  134. }
  135. __finally
  136. {
  137. TvList->EndUpdate();
  138. }
  139. return nSelCnt;
  140. }
  141. //---------------------------------------------------------------------------
  142. void __fastcall TFRAMEObjList::TvListDataControllerFilterChanged(TObject *Sender)
  143. {
  144. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  145. }
  146. //---------------------------------------------------------------------------
  147. void __fastcall TFRAMEObjList::BtnExlSaveClick(TObject *Sender)
  148. {
  149. TcxGrid *pGrid = CxList;
  150. TcxGridTableView *pView = TvList;
  151. String sTitle= "Controller Information";
  152. CMM_ExportToExcelFile(sTitle, pGrid, pView, (TForm*)this);
  153. }
  154. //---------------------------------------------------------------------------
  155. void __fastcall TFRAMEObjList::OnCloseQuery(bool &CanClose)
  156. {
  157. }
  158. //---------------------------------------------------------------------------