Package ag.ion.bion.officelayer.internal.text.table

Examples of ag.ion.bion.officelayer.internal.text.table.TextTableCellReference


      int endRowIndex = textTableCellReferences[i].getEndRowIndex();
     
      IETextTableCell startCell = textTable.getCell(startRowIndex,startColumnIndex);
      IETextTableCell endCell = textTable.getCell(endRowIndex,endColumnIndex);
      String formula = "";
      TextTableCellReference textTableCellReference = null;

      int startTableIndex = textTable.getTextTableIndex(startCell.getTableCell().getTextTable());
      int endTableIndex = textTable.getTextTableIndex(endCell.getTableCell().getTextTable());
     
      ITextTable table = textTable.getTextTable(startTableIndex);
      if(!startCell.getName().getName().equals(endCell.getName().getName())) {
     
        if(startTableIndex != endTableIndex) {
          formula = table.getName()+ "." + startCell.getTableCell().getName().getName() + ":" + table.getCell(endColumnIndex,table.getRowCount()-1).getName().getName();
          textTableCellReference = new TextTableCellReference(formula);
          newTextTableCellReferences.add(textTableCellReference);
          for(int j = startTableIndex+1; j < endTableIndex; j++) {
            table = textTable.getTextTable(j);
            formula = table.getName()+"." +TextTableCellNameHelper.getColumnCharacter(startCell.getName().getColumnIndex()) + "1" + ":" + table.getCell(endColumnIndex,table.getRowCount()-1).getName().getName();
            textTableCellReference = new TextTableCellReference(formula);
            newTextTableCellReferences.add(textTableCellReference);
          }
         
          table = textTable.getTextTable(endTableIndex);
          formula = table.getName()+"." + TextTableCellNameHelper.getColumnCharacter(startCell.getName().getColumnIndex()) + "1" + ":" + endCell.getTableCell().getName().getName();
        }
        else {
          formula = table.getName()+"." + startCell.getTableCell().getName().getName() + ":" + endCell.getTableCell().getName().getName();
        }
      }
      else {
        formula = table.getName() + "." + startCell.getTableCell().getName().getName();
      }
      textTableCellReference = new TextTableCellReference(formula);
      newTextTableCellReferences.add(textTableCellReference);
     
      TextTableCellReference[] references = new TextTableCellReference[newTextTableCellReferences.size()];
      references = (TextTableCellReference[])newTextTableCellReferences.toArray(references);
      textTableFormulaModel.replaceCellReference(textTableCellReferences[i],references);
View Full Code Here


* @author Andreas Br�ker
*/
public class TextTableCellReferenceTest extends TestCase {

  public void testIsRangeReference() {
    TextTableCellReference reference = new TextTableCellReference("<A4:B6>");
    Assert.assertEquals(true, reference.isRangeReference());
  }
View Full Code Here

    TextTableCellReference reference = new TextTableCellReference("<A4:B6>");
    Assert.assertEquals(true, reference.isRangeReference());
  }

  public void testGetTableName() {
    TextTableCellReference reference = new TextTableCellReference("<Table1.A4.1:B6>");
    Assert.assertEquals("Table1", reference.getTableName());
  }
View Full Code Here

    TextTableCellReference reference = new TextTableCellReference("<Table1.A4.1:B6>");
    Assert.assertEquals("Table1", reference.getTableName());
  }

  public void testGetStartColumnIndex() {
    TextTableCellReference reference = new TextTableCellReference("<Table1.A4.1:B6>");
    Assert.assertEquals(0, reference.getStartColumnIndex());
  }
View Full Code Here

    TextTableCellReference reference = new TextTableCellReference("<Table1.A4.1:B6>");
    Assert.assertEquals(0, reference.getStartColumnIndex());
  }

  public void testGetEndColumnIndex() {
    TextTableCellReference reference = new TextTableCellReference("<Table1.A4.1:B6>");
    Assert.assertEquals(1, reference.getEndColumnIndex());
  }
View Full Code Here

    TextTableCellReference reference = new TextTableCellReference("<Table1.A4.1:B6>");
    Assert.assertEquals(1, reference.getEndColumnIndex());
  }

  public void testGetStartRowIndex() {
    TextTableCellReference reference = new TextTableCellReference("<Table1.A4:B6>");
    Assert.assertEquals(3, reference.getStartRowIndex());
  }
View Full Code Here

    TextTableCellReference reference = new TextTableCellReference("<Table1.A4:B6>");
    Assert.assertEquals(3, reference.getStartRowIndex());
  }

  public void testGetEndRowIndex() {
    TextTableCellReference reference = new TextTableCellReference("<Table1.A4:B6>");
    Assert.assertEquals(5, reference.getEndRowIndex());
  }
View Full Code Here

    TextTableCellReference reference = new TextTableCellReference("<Table1.A4:B6>");
    Assert.assertEquals(5, reference.getEndRowIndex());
  }

  public void testSetTableName() {
    TextTableCellReference reference = new TextTableCellReference("<A4:B6>");
    reference.setTableName("Table2");
    Assert.assertEquals("<Table2.A4:B6>", reference.toString());
  }
View Full Code Here

    Assert.assertEquals("<Table2.A4:B6>", reference.toString());
  }

  public void testMoveColumnIndex() {
    try {
      TextTableCellReference reference = new TextTableCellReference("<A4:B6>");
      reference.moveColumnIndex(3);
      Assert.assertEquals("<D4:E6>", reference.toString());
    }
    catch(Exception exception) {
      Assert.fail(exception.getMessage());     
    }
  }
View Full Code Here

    }
  }

  public void testMoveRowIndex() {
    try {
      TextTableCellReference reference = new TextTableCellReference("<A4:B6>");
      reference.moveRowIndex(3);
      Assert.assertEquals("<A7:B9>", reference.toString());
    }
    catch(Exception exception) {
      Assert.fail(exception.getMessage());     
    }
  }
View Full Code Here

TOP

Related Classes of ag.ion.bion.officelayer.internal.text.table.TextTableCellReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.