Repository: flex-tlf
Updated Branches:
  refs/heads/develop 222d745e8 -> 86fbe9325


http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/33df98ab/textLayout/src/flashx/textLayout/elements/TableRowElement.as
----------------------------------------------------------------------
diff --git a/textLayout/src/flashx/textLayout/elements/TableRowElement.as 
b/textLayout/src/flashx/textLayout/elements/TableRowElement.as
index dca92d3..0a23abc 100644
--- a/textLayout/src/flashx/textLayout/elements/TableRowElement.as
+++ b/textLayout/src/flashx/textLayout/elements/TableRowElement.as
@@ -18,13 +18,18 @@
 
////////////////////////////////////////////////////////////////////////////////
 package flashx.textLayout.elements
 {
+       import flash.utils.getQualifiedClassName;
+       
        import flashx.textLayout.tlf_internal;
+       import flashx.textLayout.edit.EditManager;
+       import flashx.textLayout.edit.SelectionManager;
+       import flashx.textLayout.formats.ITextLayoutFormat;
        
        use namespace tlf_internal;
        
        /** 
-        * <p> TableRowElement is an item in a TableElement. It most commonly 
contains one or more TableDataCellElement objects, 
-        * A TableRowElement always appears within a TableElement, 
TableBodyElement.</p>
+        * TableRowElement is an item in a TableElement. It most commonly 
contains one or more TableCellElement objects, 
+        * A TableRowElement always appears within a TableElement, 
TableBodyElement.
         *
         * 
         * @playerversion Flash 10
@@ -32,7 +37,7 @@ package flashx.textLayout.elements
         * @langversion 3.0
         *
         */
-       public final class TableRowElement extends TableFormattedElement
+       public class TableRowElement extends TableFormattedElement
        {               
                public var x:Number;
                public var y:Number;
@@ -45,6 +50,19 @@ package flashx.textLayout.elements
                public var columnIndex:Number = 0;
                public var iMaxRowDepth:Number = 0;
                public var beyondParcel:Boolean = false;
+               public var composedHeight:Number = 0;
+               public var totalHeight:Number = 0;// used to compute if a row 
will fit in parcel. Need a separate value for cells that span rows.
+               public var isMaxHeight:Boolean = false;
+               
+               public function TableRowElement(format:ITextLayoutFormat=null)
+               {
+                       super();
+                       
+                       if (format) {
+                               this.format = format;
+                       }
+               }
+
                
                /** @private */
                override protected function get abstract():Boolean
@@ -57,7 +75,7 @@ package flashx.textLayout.elements
                /** @private */
                tlf_internal override function 
canOwnFlowElement(elem:FlowElement):Boolean
                {
-                       return (elem is TableDataCellElement);
+                       return (elem is TableCellElement);
                }
                
                /** @private if its in a numbered list expand the damage to all 
list items - causes the numbers to be regenerated */
@@ -65,6 +83,102 @@ package flashx.textLayout.elements
                {
                        
super.modelChanged(changeType,elem,changeStart,changeLen,needNormalize,bumpGeneration);
                }
+               
+               /**
+                * Returns a vector of table cell elements or null if the row 
contains no cells
+                **/
+               public function getCells():Vector.<TableCellElement>
+               {
+                       var table:TableElement = getTable();
+                       
+                       if(!table) {
+                               return null;
+                       }
+                       
+                       return table.getCellsForRow(this);
+               }
+               
+               /**
+                * Get an array of cells or null if the row contains no cells
+                **/
+               public function get cells():Array
+               {
+                       var table:TableElement = getTable();
+                       
+                       if (!table) {
+                               return null;
+                       }
+                       
+                       return table.getCellsForRowArray(this);
+               }
+               
+               /**
+                * Returns the number of cells in this row. 
+                **/
+               public function get numCells():int
+               {
+                       var table:TableElement = getTable();
+                       
+                       if (!table) {
+                               return 0;
+                       }
+                       
+                       return table.getCellsForRow(this).length;
+               }
+               
+               /**
+                * Returns the cell at the specified index or null if out of 
range. 
+                **/
+               public function getCellAt(index:int):TableCellElement
+               {
+                       var cells:Vector.<TableCellElement> = getCells();
+                       
+                       if(!cells || index<0 || index>=cells.length)
+                               return null;
+                       return cells[index];
+               }
+               
+               /**
+                * Adds a table cell to the row
+                **/
+               public function addCell(cell:TableCellElement):TableCellElement
+               {
+                       var table:TableElement = getTable();
+                       var cellLength:int = numChildren;
+                       
+                       if (!table) {
+                               throw new Error("Table must be set");
+                       }
+                       
+                       cell.rowIndex = rowIndex;
+                       
+                       if (cell.colIndex==-1) {
+                               cell.colIndex = cellLength;
+                       }
+                       
+                       cells.push(cell);
+                       //var selectable:Boolean = textFlow.interactionManager 
is SelectionManager;
+                       //var editable:Boolean = textFlow.interactionManager is 
EditManager;
+                       
+                       return cell;
+               }
+               
+               /**
+                * Adds a table cell to the row
+                **/
+               public function addCellAt(index:int):TableCellElement
+               {
+                       throw new Error("Add cell at is not implemented");
+               }
+               
+               /**
+                * Get an estimate column count for this row.
+                * This is temporary. TODO loop through cells and check for 
column span.
+                **/
+               public function getColumnCount():int
+               {
+                       return numCells || numChildren;
+               }
 
        }
 }

http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/33df98ab/textLayout/src/flashx/textLayout/elements/TextFlow.as
----------------------------------------------------------------------
diff --git a/textLayout/src/flashx/textLayout/elements/TextFlow.as 
b/textLayout/src/flashx/textLayout/elements/TextFlow.as
index a248665..6ccf576 100644
--- a/textLayout/src/flashx/textLayout/elements/TextFlow.as
+++ b/textLayout/src/flashx/textLayout/elements/TextFlow.as
@@ -284,6 +284,9 @@ package flashx.textLayout.elements
                
                // ILG count
                private var _graphicObjectCount:int;
+               
+               // nested TextFlow support
+               private var _parentElement:FlowGroupElement;
                                
                /** 
                 * Constructor - creates a new TextFlow instance.
@@ -1180,6 +1183,29 @@ package flashx.textLayout.elements
                                _formatResolver.invalidateAll(this);
                        formatChanged(true);
                }
+
+               /** The parent element is the element that the TextFlow is 
nested inside (such as a TableCellElement).
+                * This property is for support of nested TextFlows to handle 
things like selection and editing.
+                * 
+                * @playerversion Flash 10
+                * @playerversion AIR 1.5
+                * @langversion 3.0
+                * 
+                */             
+               public function get parentElement():FlowGroupElement
+               {
+                       return _parentElement;
+               }
+
+               public function set parentElement(value:FlowGroupElement):void
+               {
+                       _parentElement = value;
+               }
+               
+               public function nestedInTable():Boolean{
+                       return parentElement && parentElement is 
TableCellElement;
+               }
+
        } // end TextFlow class
 }
 import flash.utils.Dictionary;

http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/33df98ab/textLayout/src/flashx/textLayout/factory/StringTextLineFactory.as
----------------------------------------------------------------------
diff --git a/textLayout/src/flashx/textLayout/factory/StringTextLineFactory.as 
b/textLayout/src/flashx/textLayout/factory/StringTextLineFactory.as
index 355e6c5..7074f5c 100644
--- a/textLayout/src/flashx/textLayout/factory/StringTextLineFactory.as
+++ b/textLayout/src/flashx/textLayout/factory/StringTextLineFactory.as
@@ -463,7 +463,7 @@ package flashx.textLayout.factory
                                charPosition = 
line.getAtomTextBlockEndIndex(atomIndex);
                        }
                        
-                       line.flushAtomData();
+                       // line.flushAtomData(); // Warning: Now does nothing
                        return charPosition;
                }
                

http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/33df98ab/textLayout/src/flashx/textLayout/factory/TextLineFactoryBase.as
----------------------------------------------------------------------
diff --git a/textLayout/src/flashx/textLayout/factory/TextLineFactoryBase.as 
b/textLayout/src/flashx/textLayout/factory/TextLineFactoryBase.as
index c59999b..8092cd5 100644
--- a/textLayout/src/flashx/textLayout/factory/TextLineFactoryBase.as
+++ b/textLayout/src/flashx/textLayout/factory/TextLineFactoryBase.as
@@ -393,7 +393,7 @@ package flashx.textLayout.factory
                        // 4. Get the char index for this atom index
                        var nextTruncationPosition:int = 
line.getAtomTextBlockBeginIndex(atomIndex) + paraStart;
                        
-                       line.flushAtomData();
+                       //line.flushAtomData(); // Warning: Now does nothing
                        
                        return nextTruncationPosition;
                } 

http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/33df98ab/textLayout/src/flashx/textLayout/operations/ApplyElementStyleNameOperation.as
----------------------------------------------------------------------
diff --git 
a/textLayout/src/flashx/textLayout/operations/ApplyElementStyleNameOperation.as 
b/textLayout/src/flashx/textLayout/operations/ApplyElementStyleNameOperation.as
index 5cd0474..679c7cb 100644
--- 
a/textLayout/src/flashx/textLayout/operations/ApplyElementStyleNameOperation.as
+++ 
b/textLayout/src/flashx/textLayout/operations/ApplyElementStyleNameOperation.as
@@ -31,7 +31,6 @@ package flashx.textLayout.operations
 
        use namespace tlf_internal;
        
-       [Deprecated(replacement="ApplyFormatToElementOperation", 
deprecatedSince="2.0")]
        /**
         * The ApplyElementStyleNameOperation class encapsulates a style name 
change.
         *

http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/33df98ab/textLayout/src/flashx/textLayout/operations/ApplyElementUserStyleOperation.as
----------------------------------------------------------------------
diff --git 
a/textLayout/src/flashx/textLayout/operations/ApplyElementUserStyleOperation.as 
b/textLayout/src/flashx/textLayout/operations/ApplyElementUserStyleOperation.as
index 02cf1d7..afc251f 100644
--- 
a/textLayout/src/flashx/textLayout/operations/ApplyElementUserStyleOperation.as
+++ 
b/textLayout/src/flashx/textLayout/operations/ApplyElementUserStyleOperation.as
@@ -30,7 +30,6 @@ package flashx.textLayout.operations
 
        use namespace tlf_internal;
        
-       [Deprecated(replacement="ApplyFormatToElementOperation", 
deprecatedSince="2.0")]
        /**
         * The ApplyElementUserStyleOperation class encapsulates a change in a 
style value of an element.
         *

Reply via email to