Guest User

Untitled

a guest
Jul 16th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. import mx.controls.cells.CheckCellRenderer;
  2. import mx.controls.cells.ICellRenderer;
  3.  
  4. /**
  5. * This class sets the upSkin style based on the current item's rowColor value
  6. * in the data provider.
  7. * Make sure the class is marked "public" and in the case of our custom cell renderer,
  8. * extends the CellRenderer class and implements the ICellRenderer interface.
  9. */
  10. public class ZebraStripes extends CellRenderer implements ICellRenderer {
  11.  
  12.  
  13. /**
  14. * Constructor.
  15. */
  16. public function ZebraStripes() {
  17. super();
  18. }
  19.  
  20.  
  21. /**
  22. * This method returns the style definition object from the CellRenderer class.
  23. */
  24. public static function getStyleDefinition() {
  25. return CellRenderer.getStyleDefinition();
  26. }
  27.  
  28. /**
  29. * This method overrides the inherited drawBackground() method and sets the renderer's
  30. * upSkin style based on the row's rowColor value in the data provider. For example,
  31. * if the item's rowColor value is "green", the upSkin style is set to the
  32. * CellRenderer_upSkinGreen linkage in the library. If the rowColor value is "red", the
  33. * upSkin style is set to the CellRenderer_upSkinRed linkage in the library.
  34. */
  35. override protected function drawBackground(){
  36. switch (data.rowColor) {
  37. case "green" :
  38. setStyle("upSkin", CellRenderer_upSkinGreen);
  39. break;
  40. case "red" :
  41. setStyle("upSkin", CellRenderer_upSkinRed);
  42. break;
  43. default :
  44. break;
  45. }
  46. super.drawBackground();
  47. }
  48. }
Add Comment
Please, Sign In to add comment