resultArrayView.as 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. import com.imt.intimamedia.model.ApplicationModelLocator;
  2. import com.imt.intimamedia.views.physician.measure.GeneralMeasureView;
  3. import com.imt.intimamedia.views.physician.measure.MeasureView;
  4. import com.imt.intimamedia.vo.DragAndDropVo;
  5. import com.imt.intimamedia.vo.MeasuresVo;
  6. import mx.collections.ArrayCollection;
  7. import mx.controls.dataGridClasses.DataGridColumn;
  8. import mx.resources.ResourceManager;
  9. /**
  10. * Référence sur le modèle
  11. */
  12. [Bindable]
  13. private var _model : ApplicationModelLocator = ApplicationModelLocator.getInstance();
  14. [Bindable]
  15. public var resultsCollection : ArrayCollection;
  16. /**
  17. * Affichage de la vue et création de la source de données
  18. */
  19. public function createCollection() : void
  20. {
  21. resultsCollection = new ArrayCollection();
  22. for each( var dragAndDropVo : DragAndDropVo in ( this.parentDocument.measures as MeasureView ).listImages.dataProvider )
  23. {
  24. if (_model.viewPatient)
  25. {
  26. // put scale and measure on dragAndDropVo
  27. for each (var measuresVo : MeasuresVo in ( this.parentDocument as GeneralMeasureView ).getMeasuresArray())
  28. {
  29. if (dragAndDropVo.id == measuresVo.imageId)
  30. {
  31. if (measuresVo.scale)
  32. dragAndDropVo.scale = measuresVo.scale;
  33. if (measuresVo.distance)
  34. dragAndDropVo.distance = measuresVo.distance;
  35. if (measuresVo.area)
  36. dragAndDropVo.area = measuresVo.area;
  37. if (measuresVo.fwImt)
  38. dragAndDropVo.fwImtResult = measuresVo.fwImt;
  39. if (measuresVo.nwImt)
  40. dragAndDropVo.nwImtResult = measuresVo.nwImt;
  41. }
  42. }
  43. }
  44. resultsCollection.addItem( dragAndDropVo );
  45. }
  46. }
  47. /**
  48. * Affichage des mesures
  49. */
  50. private function displayMeasures() : void
  51. {
  52. _model.measureViewFlip = true;
  53. ( this.parentDocument as GeneralMeasureView ).selectZone('measures');
  54. }
  55. /**
  56. * Formatage du tableau d'EIM
  57. */
  58. private function formatValue( item : Object, col : DataGridColumn ) : String
  59. {
  60. var value : String = "";
  61. switch( col.dataField )
  62. {
  63. case "mean":
  64. value = formatNumber.format( item.mean );
  65. break;
  66. case "max":
  67. value = formatNumber.format( item.max );
  68. break;
  69. case "standardDeviation":
  70. value = formatNumber.format( item.standardDeviation );
  71. break;
  72. case "qualityIndex":
  73. value = formatNumber.format( item.qualityIndex );
  74. break;
  75. case "distance":
  76. value = formatNumber.format( item.distance );
  77. break;
  78. case "numberOfPoints":
  79. value = formatInt.format( item.numberOfPoints );
  80. break;
  81. }
  82. return value;
  83. }
  84. /**
  85. * Formatage des types du tableau
  86. */
  87. private function formatType( item : Object, col : DataGridColumn ) : String
  88. {
  89. return ResourceManager.getInstance().getString( 'type', item.type );
  90. }
  91. /**
  92. * Formatage des collections du tableau
  93. */
  94. private function formatLocation( item : Object, col : DataGridColumn ) : String
  95. {
  96. return ResourceManager.getInstance().getString( 'location', item.collection );
  97. }
  98. /**
  99. * Formatage de l'échelle
  100. */
  101. private function formatScale( item : Object, col : DataGridColumn ) : String
  102. {
  103. var value : String = "-";
  104. if( item.scale && item.scale.value > 0 )
  105. value = formatNumber.format( item.scale.value ) + " mm";
  106. return value;
  107. }
  108. /**
  109. * Formatage de la surface
  110. */
  111. private function formatArea( item : Object, col : DataGridColumn ) : String
  112. {
  113. var value : String = "-";
  114. if( item.area && item.area.value > 0 )
  115. value = formatNumber.format( item.area.value ) + " mm²";
  116. if( item.area2 && item.area2.value > 0 )
  117. value += "\n" + formatNumber.format( item.area2.value ) + " mm²";
  118. return value;
  119. }
  120. /**
  121. * Formatage de la distance
  122. */
  123. private function formatDistance( item : Object, col : DataGridColumn ) : String
  124. {
  125. var value : String = "-";
  126. if( item.distance && item.distance.value > 0 )
  127. value = formatNumber.format( item.distance.value ) + " mm\n"
  128. + item.distance.getTypeText();
  129. return value;
  130. }