Example #1
0
 /**
  * @param CellMatrix $matrix
  * @param \Donquixote\Cellbrush\Axis\Axis $rows
  * @param \Donquixote\Cellbrush\Axis\Axis $columns
  */
 public function modifyMatrix(CellMatrix $matrix, Axis $rows, Axis $columns)
 {
     // Fill the basic cells.
     foreach ($this->getCells() as $rowName => $rowCells) {
         $rowRange = $rows->subtreeRange($rowName);
         foreach ($rowCells as $colName => $cell) {
             $colRange = $columns->subtreeRange($colName);
             $brush = new RangedBrush($rowRange, $colRange);
             $matrix->addCell($brush, $cell);
         }
     }
 }
Example #2
0
 function testCellMatrix()
 {
     $cellMatrix = CellMatrix::create(1, 2);
     $rowRange = new SimpleRange(0, 1);
     $colRange = new SimpleRange(0, 1);
     $brush = new RangedBrush($rowRange, $colRange);
     $cell = new Cell('td', '0..1');
     $cellMatrix->addCell($brush, $cell);
     $this->assertEquals([[$cell, new PlaceholderCell()]], $cellMatrix->getCells());
     $cellMatrix->brushCellGrowRight($brush);
     $this->assertEquals([[$cell->setColspan(2), new ShadowCell()]], $cellMatrix->getCells());
 }
Example #3
0
 /**
  * @return CellMatrix
  *
  * @see BuildContainer::$CellMatrix
  */
 protected function get_CellMatrix()
 {
     $matrix = new CellMatrix($this->nRows, $this->MatrixEmptyRow);
     foreach ($this->NamedCells as $rowName => $rowCells) {
         $rowRange = $this->rows->subtreeRange($rowName);
         foreach ($rowCells as $colName => $cell) {
             $colRange = $this->columns->subtreeRange($colName);
             $brush = new RangedBrush($rowRange, $colRange);
             $matrix->addCell($brush, $cell);
         }
     }
     foreach ($this->OpenEndCells as $rowName => $rowCells) {
         $rowRange = $this->rows->subtreeRange($rowName);
         foreach ($rowCells as $colName => $cTrue) {
             $colRange = $this->columns->subtreeRange($colName);
             $brush = new RangedBrush($rowRange, $colRange);
             $matrix->brushCellGrowRight($brush);
         }
     }
     return $matrix;
 }