FRAME_DatabaseStatusF.cpp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "AppGlobalF.h"
  6. #include "ITSLangTransF.h"
  7. #pragma hdrstop
  8. #include "FRAME_DatabaseStatusF.h"
  9. #include "CDSDatabaseF.h"
  10. //---------------------------------------------------------------------------
  11. #pragma package(smart_init)
  12. #pragma link "cxButtons"
  13. #pragma link "cxCalc"
  14. #pragma link "cxClasses"
  15. #pragma link "cxControls"
  16. #pragma link "cxCustomData"
  17. #pragma link "cxData"
  18. #pragma link "cxDataStorage"
  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 "cxLabel"
  28. #pragma link "cxLookAndFeelPainters"
  29. #pragma link "cxLookAndFeels"
  30. #pragma link "cxStyles"
  31. #pragma link "cxTextEdit"
  32. #pragma link "dxSkinBlack"
  33. #pragma link "dxSkinBlue"
  34. #pragma link "dxSkinsCore"
  35. #pragma link "dxSkinscxPCPainter"
  36. #pragma link "cxContainer"
  37. #pragma link "cxProgressBar"
  38. #pragma resource "*.dfm"
  39. //TFRAMEDatabaseStatus *FRAMEDatabaseStatus;
  40. //---------------------------------------------------------------------------
  41. __fastcall TFRAMEDatabaseStatus::TFRAMEDatabaseStatus(TComponent* Owner)
  42. : TFrame(Owner)
  43. {
  44. LangTrans->Translate(this, ITSDb_GetConnection());
  45. m_pGDC = TvList->DataController;
  46. }
  47. //---------------------------------------------------------------------------
  48. void __fastcall TFRAMEDatabaseStatus::UpdateList()
  49. {
  50. CMM_ClearGridTableView(TvList);
  51. int nRow = 0;
  52. try
  53. {
  54. TvList->BeginUpdate();
  55. try
  56. {
  57. ItsDatabaseManager->FLists.Lock();
  58. FOR_STL(TItsDatabase*, pObj, ItsDatabaseManager->FLists)
  59. {
  60. if (pObj->Completed == false) continue;
  61. nRow = m_pGDC->AppendRecord();
  62. m_pGDC->Values[nRow][Column01->Index] = pObj->TABLESPACE_NAME;
  63. m_pGDC->Values[nRow][Column02->Index] = pObj->TOTAL_MB;
  64. m_pGDC->Values[nRow][Column03->Index] = pObj->USED_MB;
  65. m_pGDC->Values[nRow][Column04->Index] = pObj->USED_PERCENT;
  66. }
  67. }
  68. __finally
  69. {
  70. ItsDatabaseManager->FLists.UnLock();
  71. }
  72. }
  73. __finally
  74. {
  75. TvList->EndUpdate();
  76. TvList->DataController->GotoFirst();
  77. }
  78. }
  79. //---------------------------------------------------------------------------
  80. void __fastcall TFRAMEDatabaseStatus::RefreshList()
  81. {
  82. CMM_ClearGridTableView(TvList);
  83. int nRow = 0;
  84. try
  85. {
  86. TvList->BeginUpdate();
  87. try
  88. {
  89. ItsDatabaseManager->FLists.Lock();
  90. FOR_STL(TItsDatabase*, pObj, ItsDatabaseManager->FLists)
  91. {
  92. nRow = m_pGDC->AppendRecord();
  93. m_pGDC->Values[nRow][Column01->Index] = pObj->TABLESPACE_NAME;
  94. m_pGDC->Values[nRow][Column02->Index] = pObj->TOTAL_MB;
  95. m_pGDC->Values[nRow][Column03->Index] = pObj->USED_MB;
  96. m_pGDC->Values[nRow][Column04->Index] = pObj->USED_PERCENT;
  97. }
  98. }
  99. __finally
  100. {
  101. ItsDatabaseManager->FLists.UnLock();
  102. }
  103. }
  104. __finally
  105. {
  106. TvList->EndUpdate();
  107. TvList->DataController->GotoFirst();
  108. }
  109. }
  110. //---------------------------------------------------------------------------
  111. void __fastcall TFRAMEDatabaseStatus::TvListCustomDrawCell(TcxCustomGridTableView *Sender,
  112. TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
  113. bool &ADone)
  114. {
  115. //OptionsSelection.InvertSelect = False
  116. //OptionsView.FocusRect = False
  117. if (AViewInfo->GridRecord->Selected)
  118. {
  119. //ACanvas->Brush->Color = Sender->LookAndFeelPainter->DefaultContentColor();
  120. //ACanvas->Font->Color = Sender->LookAndFeelPainter->DefaultContentTextColor();
  121. if (AViewInfo->GridRecord->Index % 2 == 0)
  122. {
  123. ACanvas->Brush->Color = Sender->LookAndFeelPainter->DefaultContentEvenColor();
  124. ACanvas->Font->Color = Sender->LookAndFeelPainter->DefaultContentTextColor();
  125. }
  126. else
  127. {
  128. ACanvas->Brush->Color = Sender->LookAndFeelPainter->DefaultContentOddColor();
  129. ACanvas->Font->Color = Sender->LookAndFeelPainter->DefaultContentTextColor();
  130. }
  131. }
  132. }
  133. //---------------------------------------------------------------------------