FRAME_ObjListF.cpp 5.3 KB

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