You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2019/11/21 01:31:06 UTC

[royale-asjs] 02/02: fill out adg with alternating row colors

This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

View the commit online:
https://github.com/apache/royale-asjs/commit/90c48e0899edb7d88b950d9cf92b2c42bd7a5c62

commit 90c48e0899edb7d88b950d9cf92b2c42bd7a5c62
Author: Alex Harui <ah...@apache.org>
AuthorDate: Wed Nov 20 17:30:51 2019 -0800

    fill out adg with alternating row colors
---
 .../beads/DataGridLinesBeadForICollectionView.as   | 28 ++++++++++++++++------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/DataGridLinesBeadForICollectionView.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/DataGridLinesBeadForICollectionView.as
index af8f51f..54ada07 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/DataGridLinesBeadForICollectionView.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/DataGridLinesBeadForICollectionView.as
@@ -19,6 +19,8 @@
 package mx.controls.beads
 {
     import mx.collections.ICollectionView;
+    import mx.controls.advancedDataGridClasses.AdvancedDataGridColumn;
+    import mx.core.UIComponent;
     
     import org.apache.royale.core.IBeadModel;
     import org.apache.royale.core.IDataGridModel;
@@ -30,7 +32,6 @@ package mx.controls.beads
     import org.apache.royale.graphics.SolidColorStroke;
     import org.apache.royale.html.beads.DataGridLinesBead;
     import org.apache.royale.html.beads.models.DataGridPresentationModel;
-    import mx.controls.advancedDataGridClasses.AdvancedDataGridColumn;
     
 	public class DataGridLinesBeadForICollectionView extends DataGridLinesBead
 	{
@@ -75,6 +76,8 @@ package mx.controls.beads
             var rowHeight:Number = presentationModel.rowHeight;
             var n:int = getDataProviderLength();
             var totalHeight:Number = n * rowHeight;
+            if (totalHeight < contentView.height)
+                totalHeight = contentView.height;
             
             // translate the stroke to a fill since rectangles are used for the grid
             // lines and not lines.
@@ -93,6 +96,23 @@ package mx.controls.beads
             
             _overlay.clear();
             
+            // draw the horizontals
+            if (contentView.height > n * rowHeight)
+            {
+                var bgColors:Array = (_strand as UIComponent).getStyle("alternatingItemColors");
+                var yy:Number = n * rowHeight;
+                
+                var bgFill0:SolidColor = new SolidColor();
+                bgFill0.color = bgColors[0];
+                var bgFill1:SolidColor = new SolidColor();
+                bgFill1.color = bgColors[1];
+                for (i=n; yy < contentView.height; i++, yy += rowHeight) {
+                    _overlay.fill = (i % 2 == 1) ? bgFill1 : bgFill0;
+                    _overlay.drawRect(0, yy, _area.width, rowHeight);
+                }                
+            }
+            
+            _overlay.fill = lineFill;            
             // draw the verticals
             for (var i:int=0; i < columns.length - 1; i++) {
                 var column:AdvancedDataGridColumn = columns[i] as AdvancedDataGridColumn;
@@ -103,12 +123,6 @@ package mx.controls.beads
                 }
             }
             
-            /*
-            // draw the horizontals
-            for (i=1; i < n+1; i++) {
-                _overlay.drawRect(0, i*rowHeight, _area.width, weight);
-            }
-            */
         }
 
 	}