flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject git commit: [flex-tlf] [refs/heads/tables] - Added convenience method for determining if a table has merged cells. Allow a CellRange to have a null table
Date Wed, 22 Oct 2014 11:50:24 GMT
Repository: flex-tlf
Updated Branches:
  refs/heads/tables e5a3382c4 -> b9011500b


Added convenience method for determining if a table has merged cells.
Allow a CellRange to have a null table


Project: http://git-wip-us.apache.org/repos/asf/flex-tlf/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-tlf/commit/b9011500
Tree: http://git-wip-us.apache.org/repos/asf/flex-tlf/tree/b9011500
Diff: http://git-wip-us.apache.org/repos/asf/flex-tlf/diff/b9011500

Branch: refs/heads/tables
Commit: b9011500beae1c9774d9621bdc706b5e85202cf9
Parents: e5a3382
Author: Harbs <harbs@in-tools.com>
Authored: Wed Oct 22 14:50:19 2014 +0300
Committer: Harbs <harbs@in-tools.com>
Committed: Wed Oct 22 14:50:19 2014 +0300

----------------------------------------------------------------------
 .../src/flashx/textLayout/elements/CellRange.as |  7 +++++--
 .../flashx/textLayout/elements/TableElement.as  | 22 ++++++++++++++++++++
 2 files changed, 27 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/b9011500/textLayout/src/flashx/textLayout/elements/CellRange.as
----------------------------------------------------------------------
diff --git a/textLayout/src/flashx/textLayout/elements/CellRange.as b/textLayout/src/flashx/textLayout/elements/CellRange.as
index 27e8490..8e83003 100644
--- a/textLayout/src/flashx/textLayout/elements/CellRange.as
+++ b/textLayout/src/flashx/textLayout/elements/CellRange.as
@@ -54,10 +54,13 @@ package flashx.textLayout.elements
 				return null;
 			if (coords.row < 0)
 				coords.row = 0;
-			if (coords.row >= _table.numRows)
-				coords.row = _table.numRows-1;
 			if (coords.column < 0)
 				coords.column = 0;
+			if(_table == null)
+				return coords;
+			
+			if (coords.row >= _table.numRows)
+				coords.row = _table.numRows-1;
 			if (coords.column >= _table.numColumns)
 				coords.column = _table.numColumns-1;
 			return coords;

http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/b9011500/textLayout/src/flashx/textLayout/elements/TableElement.as
----------------------------------------------------------------------
diff --git a/textLayout/src/flashx/textLayout/elements/TableElement.as b/textLayout/src/flashx/textLayout/elements/TableElement.as
index ed82a28..a9472c1 100644
--- a/textLayout/src/flashx/textLayout/elements/TableElement.as
+++ b/textLayout/src/flashx/textLayout/elements/TableElement.as
@@ -408,6 +408,25 @@ package flashx.textLayout.elements
 		}
 		
 		/**
+		 * Convenience method for checking if table has merged cells
+		 * 
+		 */
+		public function hasMergedCells():Boolean
+		{
+			var cell:TableCellElement;
+			var child:*;
+			if(mxmlChildren == null)
+				return false;
+			for each(child in mxmlChildren)
+			{
+				cell = child as TableCellElement;
+				if( cell && (cell.columnSpan > 1 || cell.rowSpan > 1) )
+					return true;
+			}
+			return false;
+		}
+		
+		/**
 		 * Inserts a column at the end of the table. If a column is not provided one is created.

 		 * 
 		 * @see addColumn
@@ -1441,6 +1460,9 @@ package flashx.textLayout.elements
 			return _tableBlocks;
 		}
 		
+		/**
+		 * Returns a vector of the table blocks in the specified cell range.
+		 **/
 		public function getTableBlocksInRange(start:CellCoordinates,end:CellCoordinates):Vector.<TextFlowTableBlock>
 		{
 			var coords:CellCoordinates = start.clone();


Mime
View raw message